How do I display all Records in a Table
Posted: Thu May 24, 2007 12:13 am
Hi Everyone,
Is there any easy way to display all records in a tables. I dont care about formating it. Just want them displayed preferably with the Field Names.
I am new to this and I dont understand arrays yet. So far everything I have found on displaying records I need to use an array. I have the following but I am getting the following error when I try to run it
"Parse error: parse error, unexpected '=' in.... On line 17"
Thanks
Ralph
Is there any easy way to display all records in a tables. I dont care about formating it. Just want them displayed preferably with the Field Names.
I am new to this and I dont understand arrays yet. So far everything I have found on displaying records I need to use an array. I have the following but I am getting the following error when I try to run it
"Parse error: parse error, unexpected '=' in.... On line 17"
Code: Select all
<?php
include 'config.php';
include 'opendb.php';
$query="SELECT * FROM table";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
echo "<b><center>Database Output</center></b><br><br>";
$i=0;
while ($i < $num) {
$field1-name=mysql_result($result,$i,"field1-name");
$field2-name=mysql_result($result,$i,"field2-name");
$field3-name=mysql_result($result,$i,"field3-name");
$field4-name=mysql_result($result,$i,"field4-name");
$field5-name=mysql_result($result,$i,"field5-name");
echo "<b>$field1-name
$field2-name2</b><br>$field3-name<br>$field4-name<br>$field5-name<hr><br>";
$i++;
}
?>Thanks
Ralph