•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 403,298 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,851 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 1286 | Replies: 48 | Solved
![]() |
<?php
error_reporting(E_ALL);
// Show simple format of the records so person can choose the reference name/number
// this is then passed to the next page, for all details
$host = "localhost";
$user = "xxx";
$pass = "xxx";
$db = "phonebook";
//Connecting to MYSQL
$connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");
//Select the database we want to use
mysql_select_db($db) or die ("Could not find database");
// Get all records in all columns from table and put it in $result.
$query = "SELECT * FROM people ORDER BY fname ASC";
// execute query
$result = mysql_query($query) or die ("Error in query: $query. ".mysql_error());
// Get all records in all columns from table and put it in $result.
if (mysql_num_rows($result) > 0) {
while($row=mysql_fetch_row($result)){
echo "ID : $row[0] <br/>";
echo "First Name : $row[1] <br/>";
echo "Last Name : $row[2] <br/>";
echo "Phone Number : $row[3] <br/>";
echo "Extension : $row[4] <br/>";
echo "Title : $row[5] <br/>";
echo "Department : $row[6] <br/>";
echo "Fax Number : $row[7] <hr>";
// Add a link with a parameter(id) and it's value.
echo '<a href="phoneupdate1.php?id='.$row[0].'">Update</a>';
}
} else {
// no
// print status message
echo "No rows found!";
}
//mysql_close();
?>•
•
Join Date: Jan 2008
Posts: 76
Reputation:
Rep Power: 1
Solved Threads: 1
•
•
•
•
ah ok, didn't even think about that being turned off as it is usually on by default.
Me neither, not sure how I came across it to begin with
, but all is good now. I know there are a lot of folks wanting this type of script, is there somewhere we can put it out for others to use now that it is working?
Again, thanks for all your help. Take it easy.
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Other Threads in the PHP Forum


Linear Mode