Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » General Discussions » General Discussion » PHP help
PHP help [message #53845] Tue, 04 November 2003 12:22 Go to previous message
General Havoc is currently offline  General Havoc
Messages: 1564
Registered: February 2003
Location: Birmingham, England, Unit...
Karma:
General (1 Star)
I know this may be OT for Renegade but I know some of you are good with PHP and I was wondering if you could help me solve a problem.

I have page that pulls data from a MySQL database into a table on the page. The problem is that I want to pull two different entries into the same rows on the table. Take a look at the code, you can see what it is doing at the moment.

<?PHP
$products = "SELECT * FROM Products ORDER BY id DESC";
$result = mysql_query($products) or die ("Query Failed");

echo "<table width=\"100%\" border=\"1\">";
echo "<TR>";

while ($row = mysql_fetch_object($result)){
echo "<td colspan=\"2\"><font face=\"arial\" size=\"2\">$row->title</font></td>";
echo "</TR><TR>";
echo "<td><font face=\"arial\" size=\"2\">$row->description</font></td>";
echo "<td><IMG SRC=\"upload/$row->image\" width=\"50\" height=\"50\"></td>";
}
echo "</TR>";
echo "</table>";
?>


As you can see it pulls the data into two rows of a table. I need it to pull in title of entry one, then title of entry 2 next to it in the same row. The same for the row underneath, I need it to pull in the data for the second entry in the database.

There is probably a better way of doing it than I am, like using two table rather than messing around with table rows. It looks like it can be done but maybe somone who knows PHP better can help?


Visit my website at http://renhelp.laeubi-soft.de powered by laeubi.de
"SHUT UP AND MOD" - Dante
"ACK is the Simon Cowell of modding" - Ultron10
Scripts.dll Debugger, Map Scripter and Tutorial writer

Computer Science Bsc
Aston University in Birmingham, UK
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Crimson Server?????????
Next Topic: OT: 12 Years Today.
Goto Forum:
  


Current Time: Sat Dec 28 16:14:26 MST 2024

Total time taken to generate the page: 0.00751 seconds