View Full Version : Something wrong in code..need help!!!

08-31-2006, 09:41 AM
I've been at this page for a while now... my first project adn it's slowly coming together..

I think there is a probelm with my code somewhere but I can't see where..

if you look at this page you'll see 7 items.. www.liquidcotton.com

theres actually 8 products in ther database... as you can see when you run this other page which pulls every item with keyword "booze"

for some reason the main page doesn't display one of the items... any ideas????


<title>Liquid Cotton</title>
<link href="style.css" rel="stylesheet" type="text/css">
<SCRIPT language='javascript' src='menu_script/ypSlideOutMenus.js'></SCRIPT>


include 'library/config.php';
include 'library/opendb.php';
include 'menumaker.php';

echo "<body background='images/backgroundTile3.gif'>";


$data1 = mysql_query("SELECT * FROM shirts") or die(mysql_error());
while($info1 = mysql_fetch_array( $data1 )) { //BEGINS SHIRT LOOP

$selectedshirtid = $info1['shirt_id'];

echo "<DIV class=menuContainer id=menu{$selectedshirtid}Container>
<DIV class=menu id=menu{$selectedshirtid}Content>
<DIV class=menuInsert>
<TABLE class=menuTable cellSpacing=1 cellPadding=0 border=0 width=60>

$data2 = mysql_query("SELECT * FROM shirtkeywords
LEFT JOIN keywords ON shirtkeywords.keyword_id = keywords.keyword_id
LEFT JOIN shirts ON shirtkeywords.shirt_id = shirts.shirt_id
WHERE shirtkeywords.shirt_id ='$selectedshirtid'") or die(mysql_error());

while($info2 = mysql_fetch_array( $data2 )) { // BEGINS KEYWORD LOOP

$keyword1 = $info2['keyword'];

<TD bgcolor=#f2f1f1 align='center'><A class=menuLink href='shirtresults.php?keyword={$keyword1}'>$keyword1</A></TD></TR>";


<DIV class=menuContainer id=menu{$selectedshirtid}CContainer>
<DIV class=menu id=menu{$selectedshirtid}CContent>
<DIV class=menuInsert>
<TABLE class=menuTable cellSpacing=1 cellPadding=0 border=0 width=60>

$dataC = mysql_query("SELECT * FROM shirtcolors
LEFT JOIN colors ON shirtcolors.color_id = colors.color_id
LEFT JOIN shirts ON shirtcolors.shirt_id = shirts.shirt_id
WHERE shirtcolors.shirt_id ='$selectedshirtid'") or die(mysql_error());

while($infoC = mysql_fetch_array( $dataC )) {//BEGINS COLOR LOOP

$color = $infoC['color'];

<TD bgcolor=#f2f1f1 align='center'><A class=menuLink href='shirtresults.php?color={$color}'>$color</A></TD></TR>";




$data = mysql_query("SELECT * FROM shirts") or die(mysql_error());

$column = 1;


<tr><td width='680' height='95'><a href='liquid.php'><img src='images/logo.gif' width='271' height='67' border='0'></a></td></tr>
<tr><td width='680' bgcolor='#CCCCCC' height='25'><div align='center'>
<table border='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#111111' width='650' cellpadding='0'>
<td width='24%' align='left'><form method='get' action ='index.html'>
<p valign='middle'><select name='sort' class='cartForm'>
<option>Thumbnail Sort Options:</option>
<option value='index.php'>Alphabetical</option>
<option value='index/name'>Highest Ranked</option>
<option value='/male/newest'>Newest first</option>
<option value='/male/oldest'>Oldest first</option>
<td width='10%'><input type='submit' class ='cartForm' value='Go!'></td>
<form method ='get' action ='shirtresults.php'>
<td width='66%'><p valign='middle' align='right'>
<input type='text' size='25' name='keyword' class='cartForm'>
<input type='submit' class ='cartForm' value='Search'>
<tr><td width='680'>
<img border='0' src='images/spacer.gif' width='15' height='15'></td></tr>

<td width='680'><div align='center'>
<table border='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#111111' width='680' cellpadding='0'>

while($info = mysql_fetch_array( $data )) { // while statement that repeats for every time a row is returned

$selectedshirtid = $info['shirt_id'];

if ($column <= 5) { //if statment to see if the column is less than 5

echo "<td width='136' align='center' valign='top'>
<table border='0' cellspacing='0' style='border-collapse: collapse' width='128' cellpadding='0'>
<tr> <td colspan='5' >
<p align='center'><a href='".$info['link']."'><b>".$info['name']."</b></a></td>
<td colspan='5' height='128'>
<p align='center'><a href='".$info['link']."'>
<img border='0' src='".$info['image']."' width='121' height='121'></a></td>
<td width='30'>
<p align='center'><a href='".$info['link']."'>$10</a></td>
<td width='21'>
<p align='center'>
<img border='0' src='images/thumbup.gif' width='19' height='19'></td>
<td width='21'>5</td>
<td width='21'>
<p align='center'>
<img border='0' src='images/thumbdown.gif' width='19' height='19'></td>
<td width='21'>6</td>
<tr><td colspan='5' height ='5' align = 'center'><font size='1'><a href='wasup'>Show me more like this.</a></font> </td></tr>
<td width='100%' colspan='5' align='center'>
<table border='0' height ='5' cellspacing='0' style ='border-collapse: collapse' width ='110' cellpadding ='0' align='center'>

<td width='45' align='left' valign='middle' ><font size='1'>

<A class=\"bodylink\" onmouseover=\"ypSlideOutMenu.showMenu('menu{$selectedshirtid}C');\" onmouseout=\"ypSlideOutMenu.hideMenu('menu{$selectedshirtid}C');\" href=\"wasup\"><font size='1'>Colors[+]</font></a></td>

<td background ='images/dividerbg.gif' width='65' align='right' valign='middle' background ='images/dividerbg.gif'>

<A class=\"bodylink\" onmouseover=\"ypSlideOutMenu.showMenu('menu{$selectedshirtid}');\" onmouseout=\"ypSlideOutMenu.hideMenu('menu{$selectedshirtid}');\" href=\"wasup\"><font size='1'>Keywords[+]</font></a>

<tr><td colspan='5'><img src='images/line.gif'></td></tr>

$column ++;

} //end of if statement that checks to see the row is up to 5 iimages

else {
echo "</tr><tr>"; //this ends the row

$column = 1;

//resets the column to 1
} //end bracket for the else statement that sets the column back to 1

}//ends big while loop

echo "</table>";


09-05-2006, 01:56 AM

09-05-2006, 08:30 AM
it would be easier to help with less code. Start from basics, forget the html, and just worry about getting the query running properly in a file of its own, and work up from there.
Reading all that code makes my head hurt.