HELP

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 ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-09-2005
news.blueyonder.co.uk
 
Posts: n/a
Default HELP

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


Reply With Quote
  #2 (permalink)  
Old 01-09-2005
Kartic
 
Posts: n/a
Default Re: HELP

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

Reply With Quote
  #3 (permalink)  
Old 01-09-2005
News Me
 
Posts: n/a
Default Re: HELP

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
Reply With Quote
  #4 (permalink)  
Old 01-09-2005
Shaun Rigby
 
Posts: n/a
Default Re: HELP

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



Reply With Quote
  #5 (permalink)  
Old 01-09-2005
Alan
 
Posts: n/a
Default Re: HELP

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
++++++++++++++++++++++++++++++++++++++++++
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 07:30 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0