Page 2 of 2

Posted: Wed Jun 11, 2003 6:09 am
by irealms
ok thanks :)

is this right? as i'm getting that it's not a valid resource

Code: Select all

<?php
else
{
$editedquery = "UPDATE blog set date='$_POST[date]', title='$_POST[title]', entry='$_POST[entry]' where id = '$_POST[id]'"; 
$editedresult = mysql_query($editedquery, $db_conn) or die("query [$editedquery] failed: ".mysql_error()); 
//line below is not a valid resouce it says
if (mysql_num_rows($editedresult) >0)
	{
	echo 'You have updated article '.$artid.' "'.$title.'"';
	}
}
?>

Posted: Wed Jun 11, 2003 6:53 am
by twigletmac
It's probably because mysql_num_rows() can't be used with UPDATE queries - take a look at mysql_affected_rows().

Mac

Posted: Wed Jun 11, 2003 7:07 am
by irealms
thats great thanks!

i used the affected rows and removed the if with the rows command in. The manual says mysql won't update if the data matches what is there so i took out the if statement. Thanks for the help!