RE: DB CODEING HELP!!!!!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
</tr>
<tr>
    <td>'.$row["Column_name1"].'&nbsp;</td>
    <td>'.$row["Column_name2"].'&nbsp;</td>
    <td>'.$row["Column_name3"].'&nbsp;</td>
    <td>'.$row["Column_name4"].'&nbsp;</td>
</tr>
<tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</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:  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



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux