Displaying database results

Displaying database results

// This is a query to your database

SELECT * FROM contacts

//This is a basic MySQL command which will tell the script to select all the records in the contacts table:

$query="SELECT * FROM contacts"; $result=mysql_query($query);

//In this case the whole contents of the database is now contained in a special array with the name $result. Before you can go through the data in your result variable, you must know how many database rows there are.

$num=mysql_numrows($result);

This will set the value of to be the number of rows stored in (the output you got from the database). This can then be used in a loop to get all the data and output it on the screen.

$i=0;
while ($i < $num) {
CODE
$i++;
}

How to send email confirmation after form submission
Connecting to a database
Displaying database results
How to use an array
How to edit and replace data
Number format in PHP
Convert unix timestamp to Excel
Combine padding into one single line using CSS
Displaying year using PHP
404 redirect using htaccess
Highlight textarea on click
Htaccess maintenance redirect
Comment out lines in a htaccess file