473,378 Members | 1,493 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Question About Layout

For my online store i would like about three items to be displayed in one row however because of the php code i wouldn't know how to display it like this. currently the items are displayed one after the other only 1 item per row which makes the page look a bit crap. can anyone please help. i will post the code below.

thanks in advanced.


[PHP] if (mysql_num_rows ($get_suit_res) > 0 ) {
$display_block = "<p><em>Sorry no items in this Smart</em></p>";

while ($Suits = mysql_fetch_array($get_suit_res)) {
$Suit_id = $Suits[Suit_ID];
$Suit_title = stripslashes($Suits[Suit_Brand]);
$Suit_price = $Suits[Suit_Price];
$Suit_Image = $Suits[Suit_Image];

$display_block .= "
<table align=\"center\">
<tr>
<td>
<a href=\"showitem.php?Suit_ID=$Suit_id\">$Suit_title </a>
<h2>£$Suit_price</h2>
<img src=\"$Suit_Image\" width=\"100\" height=\"200\"></img>
</td>
</tr>
</table>";
}

$display_block .= "<ul>";
}

}
}
}[/PHP]
Apr 1 '08 #1
11 1153
TheServant
1,168 Expert 1GB
What about instead of having them all in one row and one column, have it in one row and three columns? That's how I would do it if I was using tables already.
Apr 1 '08 #2
thanks for the quick reply servant but i've tried it and still looks shit. basically i want three items on one row. what if i use div instead of tables do u think that'll sort it and if i do can u giv me a brief indication of how to go about it.
Apr 1 '08 #3
TheServant
1,168 Expert 1GB
I have changed you markup, the use of variables in strings was done wrong and badly, have a look at the changes and how I use "." between strings and variables:

[PHP]<?php
echo( "<table align=\"center\">
<tr>
<td><a href=\"showitem.php?Suit_ID=".$Suit_id."\">".$Suit _title."</a></td>
<td><h2>£".$Suit_price."</h2></td>
<td><img src=\"".$Suit_Image."\" width=\"100px\" height=\"200px\"></img></td>
</tr>
</table>
?>[/PHP]

You can use divs, and even though this is no longer a php question, I can help you with it. However I must be going to bed, so I will have a try tomorrow, but by then a moderator is likely to have moved this to the html/CSS forum where you can get better help than I can offer with regards to layout. Just have a go with what I have up top and tell me what you don't like about it.
Apr 1 '08 #4
Markus
6,050 Expert 4TB
For my online store i would like about three items to be displayed in one row however because of the php code i wouldn't know how to display it like this. currently the items are displayed one after the other only 1 item per row which makes the page look a bit crap. can anyone please help. i will post the code below.

thanks in advanced.


[PHP] if (mysql_num_rows ($get_suit_res) > 0 ) {
$display_block = "<p><em>Sorry no items in this Smart</em></p>";

while ($Suits = mysql_fetch_array($get_suit_res)) {
$Suit_id = $Suits[Suit_ID];
$Suit_title = stripslashes($Suits[Suit_Brand]);
$Suit_price = $Suits[Suit_Price];
$Suit_Image = $Suits[Suit_Image];

$display_block .= "
<table align=\"center\">
<tr>
<td>
<a href=\"showitem.php?Suit_ID=$Suit_id\">$Suit_title </a>
<h2>£$Suit_price</h2>
<img src=\"$Suit_Image\" width=\"100\" height=\"200\"></img>
</td>
</tr>
</table>";
}

$display_block .= "<ul>";
}

}
}
}[/PHP]
Hey there Ashraf!
Have a look at this thread!

Regards
Apr 1 '08 #5
Hey there Ashraf!
Have a look at this thread!

Regards
thanks markus just havin a look now. i'll let u know how i got on.

nice one mate.
Apr 1 '08 #6
MARKUSN00B U r thee F%$&*£^ master i made it work man!

Thanks alot mate.
Apr 1 '08 #7
Markus
6,050 Expert 4TB
MARKUSN00B U r thee F%$&*£^ master i made it work man!

Thanks alot mate.
No problems! Haha.

That thread has helped a fair few people, including myself!

See you next time

Regards :)
Apr 1 '08 #8
i'm having another slight problem similar to the one before. this time i want the following code to execute so that only one line of "Suits, Shirts and Trousers" is printed but for some reason it prints out three identical lines:

[PHP]$display_block = "<h1>Smartegories</h1>
<p>select Smart to see items.</p>";

$get_Smarts = "SELECT Smart_ID, Smart_title, Smart_description
FROM Smart
ORDER BY Smart_title";

$get_Smart_res = mysql_query ($get_Smarts) or die (mysql_error());

if (mysql_num_rows($get_Smart_res) < 1) {
$display_block = "<p><em>Sorry no Smarts to browse</em></p>";
} else {

while ($Smarts = mysql_fetch_array ($get_Smart_res)) {
$Smart_ID = $Smarts [Smart_ID];
$Smart_title = strtoupper (stripslashes ($Smarts[Smart_title]));
$Smart_desc = stripslashes ($Smarts [Smart_description]);

echo "
<table>
<tr>
<td><a href=\"$_SERVER[PHP_SELF]?Smart_ID=1\"><h2>Shirts</h2></a></strong></td>
</tr>
<tr>
<td><a href=\"$_SERVER[PHP_SELF]?Smart_ID=2\"><h2>Suits</h2></a></strong></td>
</tr>
<tr>
<td><a href=\"$_SERVER[PHP_SELF]?Smart_ID=3\"><h2>Trousers</h2></a></strong></td>
</tr>
<table>";[/PHP]


can someone please help. i hope that i'v made it clear.
Apr 2 '08 #9
Markus
6,050 Expert 4TB
After 'ORDER BY' use the LIMIT clause
[php]
ORDER BY Smart_title
LIMIT 1
[/php]

Regards :)
Apr 2 '08 #10
nice one markus much appreciated.
Apr 2 '08 #11
Markus
6,050 Expert 4TB
nice one markus much appreciated.
No problem!
See you around dude(tte)
Apr 2 '08 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Alexander Ross | last post by:
I've made several sites using PHP but they generally didn't have any exciting layout to worry about. I've also made plenty of static sites using Dreamweaver and complicated layout tables. Now I'm...
2
by: Adelard | last post by:
Here is my xsl and xml, I want the xml node: LABEL3 ( General Information ) to move under the ROW when viewing or printing this PDF Document. How can I do it? Thanks
7
by: glutinous | last post by:
I've looked at manuals and experimented until my brain's oozing out of my ears, and I still can't figure out what I anticipate will prove to be fairly basic css layout knowledge. I'd be amazed if...
10
by: Volker Lenhardt | last post by:
For a QApplication (PyQt) on the small screen of my Zaurus 5500 PDA I try to layout my data output in a QScrollView as the central widget. I'd prefer to use QGridLayout, but cannot add it to the...
29
by: MP | last post by:
Greets, context: vb6/ado/.mdb/jet 4.0 (no access)/sql beginning learner, first database, planning stages (I think the underlying question here is whether to normalize or not to normalize this...
15
by: Gary Peek | last post by:
Can anyone tell us the browsers/versions that exhibit errors when tables are nested too deeply? And how many levels of nesting produces errors? (not a tables vs CSS question)
27
by: Murray R. Van Luyn | last post by:
Hi, Is using frames in a website as big an issue nowadays as it was maybe 5 or so years ago? I can remember that you used to have to have a frame site, as well as a non frame site for browsers...
3
by: Daniel | last post by:
Hey guys, I last made a site using Asp.net in vis studio 2003. Now in 2005 and .net 2 i want to make anothe rbut i cant get the layour working. Before i used to make eveyrhting position...
5
by: Ed Sproull [MSFT] | last post by:
First I'm pretty new to ASP.NET and I'm having a simple problem. I have small website with a header, sidebar and the the content. I want my content to appear beside my sidebar which seems to be a...
2
by: BjornB | last post by:
Hi! I'm totally new to Python and I'm jus nw trying to create my first application with wxPython, exciting! However, I have a problem: I'm creating a Frame with a menu and buttonpanel...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.