This is a discussion on HELP within the PHP Language forums, part of the PHP Programming Forums category; hi, i am using Apache, with PHP 4.3.10, and MySQL, i am creating a products webpage using both ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
hi,
i am using Apache, with PHP 4.3.10, and MySQL, i am creating a products webpage using both HTML and PHP. The system works where: - The File Connects & Logs on to the sql database and selects appropriate table - file searches database in specified column using a defined variable however when i put in the variable "hard drives" it gives me the list of hard drives all in 1 table cell causing it to mangle up, is there any way that i can get each product to go down into each cell? If you want to view the page the link is http://82.42.112.231/connect.php Any help would be greatly appreciated shaun |
|
|||
|
Shaun,
Without your code, it will be difficult to pinpoint the exact error but let me try... It appears that when you read your query results from MySQL, you are not creating a new table row for each row your read (<tr>... </tr>). Instead you are looping through your result set producing multiple <td></td> for each row read into the same <tr></tr>. What you want is this: <table> <!-- Loop here by row --> <tr> <!-- Loop here by column --> <td>item 1 Description Value</td> <td>item 1 Price Value</td> <td>item 1 Price With VAT</td> </tr> <tr> <td>item 2 Description Value</td> <td>item 2 Price Value</td> <td>item 2 Price With VAT</td> </tr> ..... </table> So in PHP, it will be: <table> <?php while ($row = mysql_fetch_row($queryid)) { ?> <tr> <td><?=$row['item_desc'];?></td> <td><?=$row['item_price_novat'];?></td> <td><?=$row['item_price_vat'];?></td> </tr> <?php } // End while() ?> </table> (if you want a generalized solution, you can put the <td></td> part in a loop too, this time looping over the columns. Hope that helped. --Kartic |
|
|||
|
news.blueyonder.co.uk wrote:
> hi, > i am using Apache, with PHP 4.3.10, and MySQL, i am creating a products > webpage using both HTML and PHP. The system works where: > - The File Connects & Logs on to the sql database and selects appropriate > table > - file searches database in specified column using a defined variable > > however when i put in the variable "hard drives" it gives me the list of > hard drives all in 1 table cell causing it to mangle up, is there any way > that i can get each product to go down into each cell? > > If you want to view the page the link is http://82.42.112.231/connect.php > > Any help would be greatly appreciated > > shaun > > It's kinda tough to guess what's wrong with your code when all we can see is its output. Need to see connect.php. NM -- convert uppercase WORDS to single keystrokes to reply |
|
|||
|
OK, av managed to get it to go across the page with the relevant info, what
code can i use to get it on the next row? "News Me" <newsTWOme@pacifierDOTcom> wrote in message news:10u1fhk2vabjh4a@corp.supernews.com... > news.blueyonder.co.uk wrote: >> hi, >> i am using Apache, with PHP 4.3.10, and MySQL, i am creating a products >> webpage using both HTML and PHP. The system works where: >> - The File Connects & Logs on to the sql database and selects appropriate >> table >> - file searches database in specified column using a defined variable >> >> however when i put in the variable "hard drives" it gives me the list of >> hard drives all in 1 table cell causing it to mangle up, is there any way >> that i can get each product to go down into each cell? >> >> If you want to view the page the link is http://82.42.112.231/connect.php >> >> Any help would be greatly appreciated >> >> shaun > > It's kinda tough to guess what's wrong with your code when all we can see > is its output. Need to see connect.php. > > NM > > -- > convert uppercase WORDS to single keystrokes to reply |
|
|||
|
On Sun, 09 Jan 2005 05:36:40 GMT, "Shaun Rigby"
<shaunrigby16@hotmail.com> wrote: >OK, av managed to get it to go across the page with the relevant info, what >code can i use to get it on the next row? > Without seeing your "real" php code it's hard to say, but basically when you have read enough fields/items for a row then do a </tr> <tr> and read the next lot of fields/items. Don't forget if an field is blank it still needs a field in your database. Alan -- ++++++++++++++++++++++++++++++++++++++++++ Jenal Communications Manufacturers and Suppliers of HF Selcall P O Box 1108, Morley, WA, 6943 Tel: +61 8 9370 5533 Fax +61 8 9467 6146 Web Site: http://www.jenal.com Contact: http://www.jenal.com/?p=1 ++++++++++++++++++++++++++++++++++++++++++ |