problem with update query

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Locked
rbroadwe
Forum Newbie
Posts: 10
Joined: Wed May 06, 2009 5:18 pm

problem with update query

Post by rbroadwe »

Code: Select all

if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
 
 
$sql = 'UPDATE appt
        SET fname = "$fname", lname = "$lname", street = "$street", zip = "$zip", phone = "$phone", problem = "$problem", booked = "Y"
        WHERE id="$id"';
 
mysql_select_db("robbroa1_fox", $con);
$retval = mysql_query( $sql, $con );
if(! $retval )
{
  die('Could not update data: ' . mysql_error());
}
echo "Updated data successfully\n";
mysql_close($con);
it doesn't error and it echos that it worked but it doesn't update the rows and I dont know why. Does anyone see the problem? Thank you!
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: problem with update query

Post by Benjamin »

You posted the same question already. Don't double post. Locked
Locked