An alternative approach to this:
while($row = mysql_fetch_row($result) {
// do stuff
}
is to use a database abstraction library like PEAR::DB.
<?php
// Include the DB library -- it's probably in your path already
require_once('DB.php');
// Connect to the database
$dsn = "mysql://[EMAIL PROTECTED]:host/database";
$objDB = DB::connect($dsn);
// Tell the DB object that we want an Associative Array as a result
$objDB->setFetchMode(DB_FETCHMODE_ASSOC);
$sql = "SELECT * FROM table";
// The GetAll method returns your results in an array, or an object,
depending on your preference
$result = $db->getAll($sql);
// Check for errors
if(PEAR::isError($result)) {
// You've got a problem...
echo $result->getMessage();
die();
}
?>
> _____
>
>From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
>Of Wade
>Sent: Monday, April 18, 2005 1:38 PM
>To: [email protected]
>Subject: [php_mysql] SELECT * question
>
>
>04182005 1333 GMT-6
>
>If I say
> $sql = "SELECT * FROM table"
> $result=mysql_query($sql);
>would i be correct in thinking that, if Im calling everything then
>$result must be an array? Well, pointer to points?
>
>Wade
>
>
>
>
>[Non-text portions of this message have been removed]
>
>
>
>The PHP_mySQL group is dedicated to learn more about the PHP_mySQL web
>database possibilities through group learning.
>
>
>
> _____
>
>Yahoo! Groups Links
>
>
>* To visit your group on the web, go to:
>http://groups.yahoo.com/group/php_mysql/
>
>
>* To unsubscribe from this group, send an email to:
>[EMAIL PROTECTED]
><mailto:[EMAIL PROTECTED]>
>
>
>* Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
><http://docs.yahoo.com/info/terms/> .
>
>
>
>
>[Non-text portions of this message have been removed]
>
>
>
>The PHP_mySQL group is dedicated to learn more about the PHP_mySQL web
>database possibilities through group learning.
>Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
The PHP_mySQL group is dedicated to learn more about the PHP_mySQL web database
possibilities through group learning.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/php_mysql/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/