Re: ASP to PHP language problems
| From: | Alistair Hayward | Date: | Wed, 10 Mar 2004 23:26:53 +0000 |
| Subject: | Re: ASP to PHP language problems | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-180066@lists.php.net to get a copy of this message | ||
Richard Davey wrote:
A few ways to do this: $total_records = mysql_num_rows($result); for ($i=0; $i < $total_records; $i++) {I get this error: mysql_num_rows(): supplied argument is not a valid MySQL result resource Question: Where you have the //do stuff comment, I assume this is where my HTML code will go. But can I put it between the open brackets? I.E: { html code } ?$data = mysql_fetch_assoc($result); print_r($data);} $data will now be an array holding the first set of information. The print_r line just displays it so you can see it easily. Instead of a FOR loop you could do a "while" loop checking to see the end of the $result set, i.e.: while ($row = mysql_fetch_array($result, MYSQL_NUM)) {// do stuff print_r($row);} AH> <%=rst.fields("whatever").value%> <?=$data['whatever']?>