form problem

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

User avatar
irealms
Forum Contributor
Posts: 215
Joined: Mon Apr 28, 2003 7:10 am
Location: Leeds

Post 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.'"';
	}
}
?>
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

It's probably because mysql_num_rows() can't be used with UPDATE queries - take a look at mysql_affected_rows().

Mac
User avatar
irealms
Forum Contributor
Posts: 215
Joined: Mon Apr 28, 2003 7:10 am
Location: Leeds

Post 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!
Post Reply