Jump to content


This topic is now archived and is closed to further replies.


Me Again!

Recommended Posts

Hi Guys,

Again posting the second part of my question a little bit modified. All I want to do is to get all the fields data from my database in table rows and not plain row by row so that I can change the colors etc of the different fields. I posted once before also a few hours ago(If you want you can scroll down and read that detail also) and was suggested to get a BOOK. Well, I got a bit success now. I do get the data in rows now but not all the fields. I have 3 fields, ID/Name/Email and with the following code I just get the data of two of the mentioned fields in rows:
$db = mysql_connect("xxxxx",
"xxxxx", "xxxxxx");
if (! @mysql_select_db("jokes") ) {
echo( "<P>Unable to locate the " .
"database at this time.</P>" );
$result = mysql_query(
"SELECT ID, Name, Email FROM contacts");
if (!$result) {
echo("<P>Error performing query: " .
mysql_error() . "</P>");
echo "<table width = 100% border=1>\n";
echo "<tr><td>ID</td><td>Name</td><td>Email</td></tr>\n";
while ($myrow = mysql_fetch_row($result)) {
printf("<tr><td>%s </td><td>%s </td><td>%s </td></tr>\n", $myrow[1], $myrow[2],
echo "</table>\n";

Yes, I finally got it working some how but still as I said just 2 of the fields can be retrieved in rows. I need help to get all 3 of them in rows and columns so that I can get the display as I want it. Any help would be appreciated other then advising to get a PHP book(I have it already and will get more and am learning just since yesterday So Please, only help in code if possible)

Share this post

Link to post
Share on other sites
all arrays (unless otherwise specified) are referenced bginning at 0. so.....

$myrow[0], $myrow[1] amd $myrow[2] shoudl show the info you are expecting.....

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.