By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,655 Members | 1,860 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,655 IT Pros & Developers. It's quick & easy.

HELP

P: n/a
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
Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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

Jul 17 '05 #2

P: n/a
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
Jul 17 '05 #3

P: n/a
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:10*************@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

Jul 17 '05 #4

P: n/a
On Sun, 09 Jan 2005 05:36:40 GMT, "Shaun Rigby"
<sh**********@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
++++++++++++++++++++++++++++++++++++++++++
Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.