INSERT queries and num_rows just don't go together. And whatever you've done with mysql_affected_rows() is just some kind of silly mistake on your part, almost for sure... On Tue, May 30, 2006 11:28 pm, John Taylor-Johnston wrote: > How can I get an integer value for mysql_affected_rows()? I get text: > > " n Database Transfer(s)". > > I would like to create my own error flag and exit; if the number of > affected rows is <= 0. > > The example for mysql-num-rows in the manual does not work. I have > MySQL > - 4.1.12. > > $num_rows = mysql_num_rows($result); > echo "$num_rows Rows\n"; > > http://ca3.php.net/manual/en/function.mysql-num-rows.php > > I get: > Warning: mysql_num_rows(): supplied argument is not a valid MySQL > result > resource in /var/www/html2/db/tools/test.php on line 29 > Rows Database Transfer > > Here is my code. > > -------------------------------------------------------------------------------- > > $sql ="insert into `jtjohnston`.`ccl` > (RNum,YR,AU,ST,SD,SC,BT,BD,BC,AT,AD,AC,SR,PL,PR,JR,VNum,INum,DT,PG,LG,SF,OL,KW,AUS,TUS,GEO,AN,RB,SA,CO,RR) > > select > RNum,YR,AU,ST,SD,SC,BT,BD,BC,AT,AD,AC,SR,PL,PR,JR,VNum,INum,DT,PG,LG,SF,OL,KW,AUS,TUS,GEO,AN,RB,SA, > CONCAT(`CO`,' <Transfered: ".date("F jS, Y, g:i a").">;'),RR > FROM ".$_POST["dbtable"]." > WHERE id=".$_POST["transferthis"].";"; > > echo "<pre>".htmlspecialchars($sql)."</pre><hr size=\"1\">\n"; > > $myconnection = mysql_connect($server,$user,$pass); > mysql_select_db($db,$myconnection); > > $result = mysql_query($sql) or die(print mysql_error()); > > echo mysql_affected_rows(); > #$num_rows = mysql_num_rows($result); > #echo "$num_rows Rows\n"; > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php