Jump to content

UPDATE not being called


aman1649

Recommended Posts

Hey guys, I am still kinda new to php and I can't seem to get this to work.  Basically I am calling a script and first I need it retrieve certain values which is working fine, but then after that is called I need it to clear those values it just displayed.  To do that I am using UPDATE but it doesn't seem to be calling the UPDATE part.  Any ideas?  Here is the code:

 

@mysql_select_db("$db_name") or die ("No DataBase Found");
$result = mysql_query("SELECT * FROM members WHERE id='$_POST[id]'");
while ($row = mysql_fetch_array($result))
{
	$message = $row['message'];
	$sender = $row['sender'];

	echo $message . "\n" . $sender;
}

mysql_query("UPDATE memebers SET message='' WHERE id='$_POST[id]'"); //These never get 
mysql_query("UPDATE memebers SET sender='' WHERE id='$_POST[id]'");//called or so it seems

Link to comment
https://forums.phpfreaks.com/topic/223819-update-not-being-called/
Share on other sites

Hey guys, I am still kinda new to php and I can't seem to get this to work.  Basically I am calling a script and first I need it retrieve certain values which is working fine, but then after that is called I need it to clear those values it just displayed.  To do that I am using UPDATE but it doesn't seem to be calling the UPDATE part.  Any ideas?  Here is the code:

 

@mysql_select_db("$db_name") or die ("No DataBase Found");
$result = mysql_query("SELECT * FROM members WHERE id='$_POST[id]'");
while ($row = mysql_fetch_array($result))
{
	$message = $row['message'];
	$sender = $row['sender'];

	echo $message . "\n" . $sender;
}

mysql_query("UPDATE memebers SET message='' WHERE id='$_POST[id]'"); //These never get 
mysql_query("UPDATE memebers SET sender='' WHERE id='$_POST[id]'");//called or so it seems

 

You mispelled members in your last two queries.

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.