Try doing it this way...

$hostname = "yourhostname";
$username = "username";
$password = "password";
$table1 = "yourtablename";
$db1 = "yourdbname";

/* make connection to database */
MYSQL_CONNECT($hostname, $username, $password) OR DIE("Unable to connect to
database");
@MYSQL_SELECT_DB( "$db1") or die( "Unable to select database");

$query = "SELECT * FROM $table1";
$result = MYSQL_QUERY($query);

$field1 = MYSQL_RESULT($result, 0, "field1");
print "$field1<BR>";

This just prints the first row. You might want to do it in counter.

But don't email me asking me advance topics about mysql & php, baby pa rin
ako rito. ;-)

> -----Original Message-----
> From: Gene Ordanza II [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, March 29, 2000 3:16 PM
> To: [EMAIL PROTECTED]
> Subject: [plug] PHP/MySQL Question ...
> 
> 
> Hi,
>       I'm having problem running my PHP script accessing 
> MySQL database.
> 
> Error Message:
>       Warning: 0 is not MySQL result index in script1 on line 11
> 
> Code:
>       $data = mysql_query("select * from table1", $db1);
>       printf("%s<br>", mysql_result($data,0,"field1"));   # line 11
> 
> 
>       Comment, suggestions and hints are appreciated. TIA.
> 
> 
> --gene
> 
> 
> 
> -
> Philippine Linux Users Group. Web site and archives at 
http://plug.linux.org.ph
To leave: send "unsubscribe" in the body to [EMAIL PROTECTED]

-
Philippine Linux Users Group. Web site and archives at http://plug.linux.org.ph
To leave: send "unsubscribe" in the body to [EMAIL PROTECTED]

Reply via email to