RE: [PHP-DB] newbie: MySQL Problem or severe ignorance..
| From: | Rick Emery | Date: | Wed, 02 Jan 2002 14:46:53 +0000 |
| Subject: | RE: [PHP-DB] newbie: MySQL Problem or severe ignorance.. | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-15303@lists.php.net to get a copy of this message | ||
Go with:
$query = "SELECT * from counter";
$result = mysql_query($query) or die("Error:".mysql_error());
$i = 0;
while( $row=mysql_fetch_array(result) {
echo "$i = ".$row['time']."<BR>";
$i++;
}
this assumes that you've opened your server connection and selected database
prior to executing the snippet
-----Original Message-----
From: Chris Hogben [mailto:heinz.ketchup@ntlworld.com]
Sent: Monday, December 31, 2001 3:56 PM
To: php-db@lists.php.net
Subject: [PHP-DB] newbie: MySQL Problem or severe ignorance..
I've just been looking at this snippet, and wondering why it's not working..
Either i'm doing something wrong, or i'm just totally ignorant.. (More
likely the latter). But if anyone can help me out, please let me know..
---
$query = "SELECT * from counter";
$result = mysql_query($query);
$numone = mysql_numrows($result);
$i = 0;
while ($i <= $numone) {
$seekrow = mysql_data_seek($result, $i);
$fetchrow = mysql_fetch_row($result);
$time = $fetchrow["time"];
echo "$i = $time<br>";
$i++;
}
---
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
For additional commands, e-mail: php-db-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net