Re: inserting data into columns and rows in php.

From: Date: Tue, 25 Jul 2000 17:48:04 +0000
Subject: Re: inserting data into columns and rows in php.
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-8105@lists.php.net to get a copy of this message
Ed Vul wrote: > how about: > > printTableHeader(); > while("you have stuff from db"){ > echo "<tr>"; > echo "<td>".$blah."</td>; > echo "<td>".$blah."</td>; > echo "<td>".$blah."</td>; > echo "</tr>"; > } > printTableFooter(); > > I do something like that... but i have a different table okei. I try to show an example of my problem: this is another script, I need to modify it to meet my need, maybe I am doing it wrong (still learning the ropes :)). <? //dbase connection $db = mysql_connect("localhost", "xxx","yyy"); mysql_select_db("links",$db); $result = mysql_query("SELECT * FROM links where location='USA' ,$db); printf("<tr>"); if ($myrow = mysql_fetch_array($result)) { do { printf("<td class=txtleft><a href= %s > %s </td>\n", $myrow["link"], $myrow["name"]); } while ($myrow = mysql_fetch_array($result)); } else { } printf("</tr>"); ?> as you can see, this code here grabs data from dbase and inserts it into a table and then closes the table. what I need is to modify it so after 3 insertions it would add an extra line of code and then continue with the original task until all data is inserted into the table from the dbase and the table is closed.. or is there a simpler way of making this thing work? -- Maniac, still learning.

« previous php.general (#8105) next »