RE: [PHP-DB] DB CODEING HELP!!!!!
| From: | Peter Lovatt | Date: | Mon, 24 Mar 2003 01:42:32 +0000 |
| Subject: | RE: [PHP-DB] DB CODEING HELP!!!!! | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-26579@lists.php.net to get a copy of this message | ||
hi
hth
Peter
<?php
//connect to mysql
$mysql_link = mysql_connect("localhost", "mysql_user",
"mysql_password")
or die("Could not connect: " . mysql_error());
//get all columns for the selected rows
$query = 'SELECT *
FROM table_name
WHERE Column_name = "some_value"';
//execute query
$mysql_result = mysql_query($query, $mysql_link);
$retval.='<table width="95%">';
while($row = mysql_fetch_array($mysql_result))
{// enter display code here
$retval.='
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>'.$row["Column_name1"].' </td>
<td>'.$row["Column_name2"].' </td>
<td>'.$row["Column_name3"].' </td>
<td>'.$row["Column_name4"].' </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>';
}// end while
$retval.='</table>';
//output results
print $retval ;
//close mysql link
mysql_close($link);
?>
-----Original Message-----
From: Mike Delorme [mailto:crazymonkey1385@hotmail.com]
Sent: 23 March 2003 21:11
To: MySQL PHP Database Help
Subject: [PHP-DB] DB CODEING HELP!!!!!
this is bugging me. I have tried everything and I cant develop the code
without an error. Can someone plese write me simple code that will go
through a table and print 3 collums of that table? I cant figure it out