I added $ myrowmysql_fetch_row ($ res); why can't I get a row of data (!) Warning: mysql_fetch_row () expectsparameter1toberesource, arraygiveninD: wampwwwchaxun. phpo... I added $ myrow = mysql_fetch_row ($ res); why can't I get a row of data (! ) Warning: mysql_fetch_row () expects parameter 1 to be resource, array given in D: \ wamp \ www \ chaxun. php on line 7
prepare("select * from test"); $stmt->execute(); //$myrow = mysql_fetch_row($stmt->execute()); $res=$stmt->fetch(); $myrow = mysql_fetch_row($res); print_r($myrow);?>
Reply content:
I added $ myrow = mysql_fetch_row ($ res); why can't I get a row of data (! ) Warning: mysql_fetch_row () expects parameter 1 to be resource, array given in D: \ wamp \ www \ chaxun. php on line 7
prepare("select * from test"); $stmt->execute(); //$myrow = mysql_fetch_row($stmt->execute()); $res=$stmt->fetch(); $myrow = mysql_fetch_row($res); print_r($myrow);?>
PDOStatement: rowCount-returns the number of rows affected by the previous SQL statement.
PDOStatement: fetch-get the next row from the result set
Query ('select * from users'); // get a row $ result = $ query-> fetch (); print_r ($ result ); $ total = $ pdo-> query ('select * from test'); // count $ count = $ total-> rowCount (); echo $ count;
Use a while loop.