MySQL : mysql_result function : error in page....please help

General discussions related to php

Moderators: macek, egami, gesf

User avatar
Oleg Butuzov
Last Samuray
Last Samuray
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Postby Oleg Butuzov » Sun Dec 22, 2002 3:03 am

Code: Select all


$db = mysql_connect("localhost", "xxxxxxx", "xxxxxx");


$result = mysql_query("SELECT * FROM employees",$db);

printf("First Name: %s<br>\n", mysql_result($result,0,"first"));

printf("Last Name: %s<br>\n", mysql_result($result,0,"last"));

printf("Address: %s<br>\n", mysql_result($result,0,"address"));

printf("Position: %s<br>\n", mysql_result($result,0,"position"));


try this

Code: Select all


$db = mysql_connect("localhost", "xxxxxxx", "xxxxxx") or die(mysql_error());

mysql_select_db("xxxxxxxxx",$db) or die(mysql_error());

$result = mysql_query("SELECT * FROM employees",$db) or die(mysql_error()); ;

//print functions for
//$data['rowname'] elements

Return to “PHP General”

Who is online

Users browsing this forum: No registered users and 1 guest