how about using mysql_fetch_array() function ?
<?php
$db1 = mysql_connect("localhost", "");
mysql_select_db("mydb",$db1);
$result = mysql_query("SELECT * FROM table1",$db1);
if ($myrow = mysql_fetch_array($result)) {
printf("%s", $myrow["field1"]);
} else {
echo "Sorry, no records were found!";
}
?>
hth,
[EMAIL PROTECTED]
Gene Ordanza II wrote:
> 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]