Jump to content

return value when running a upodate query?


Liquid Fire

Recommended Posts

when i run an update query like:

 

$query = "UPDATE messages

      SET message = '{$new_message}', style_class = '{$style_class}'

      WHERE id = '{$message_id}'";

 

what is the return value of he mysql_query($query) if it was completed correctly, if was was not completed correctly?

you would request an error statement in the event of a failure, other wise it worked

<?php
$query = "UPDATE messages SET message = '$new_message', style_class = '$style_class' WHERE id = '$message_id'";
mysql_query($query) or die('Invalid query: ' . mysql_error());
?>

 

edit: curly braces around the variables are not required any more

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.