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

General discussions related to php

Moderators: egami, macek, gesf

Post Reply
Oleg Butuzov
Last Samuray
Last Samuray
Posts: 824
Joined: Sun Jun 02, 2002 3:09 am

Sun Dec 22, 2002 3:03 am

Code: Select all

<?php 

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

mysql_select_db("xxxxxxxxx",$db);

$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

<?php 

$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()); ;

while($data=mysql_fetch_array($result)){
//print functions for
//$data['rowname'] elements
}
?>

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest