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
https://forums.phpfreaks.com/topic/6365-me-again/
Share on other sites

Archived

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

×
×
  • 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.