mysql_num_rows

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux