Jump to content

Me Again!


koolgirl

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:
<html>
<body>
<?php
$db = mysql_connect("xxxxx",
"xxxxx", "xxxxxx");
if (! @mysql_select_db("jokes") ) {
echo( "<P>Unable to locate the " .
"database at this time.</P>" );
exit();
}
$result = mysql_query(
"SELECT ID, Name, Email FROM contacts");
if (!$result) {
echo("<P>Error performing query: " .
mysql_error() . "</P>");
exit();
}
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],
$myrow[3]);
}
echo "</table>\n";
?>
</body>
</html>
__________________

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)
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.