koolgirl Posted April 1, 2006 Share Posted April 1, 2006 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) Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted April 2, 2006 Share Posted April 2, 2006 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..... Quote Link to comment Share on other sites More sharing options...
koolgirl Posted April 2, 2006 Author Share Posted April 2, 2006 Hi Again GuruWell, Now I can call you GURUUUuuu lolIt is working perfectMany Thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.