[thelist] another PHP Sql question...

jsWalter jsWalter at torres.ws
Fri Aug 29 01:13:54 CDT 2003


I am querying a database just fine.

getting back what I expect, just fine.

But now I've been thrown a wrench in the form of double row display.

my client wants...

     a    b
     c    d
     e    f
     ...

Well, I've reached the end on my PHP/SQL knowledge (which really isn't all
that far!)

Right now I'm doing (very much shortened)...


      // Query the database
      $result = $db->query($strSql);

      // Always check that $result is not an error
      if (DB::isError($result))
         die ($result->getMessage());

	while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
	{
		extract ($row);
		echo $feild_A . '<br />';
	}

OK, this is fine for a straight list!

But I need to create...

	<tr>
		<td>row_1/feild_A</td>
		<td>row_1/feild_B</td>
	</tr>
	<tr>
		<td>row_2/feild_A</td>
		<td>row_2/feild_B</td>
	</tr>
      ...

And using the method of WHILE() doesn't cut it.

Can some one enlighten me what syntax can I use to hit 2 rows at a time?

Thanks

Walter




More information about the thelist mailing list