Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Aug 2006
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Something wrong in code..need help!!!

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

    Code:
    <html>
    
    	<head>
    	<title>Liquid Cotton</title>
    	<link href="style.css" rel="stylesheet" type="text/css">
    <SCRIPT language='javascript' src='menu_script/ypSlideOutMenus.js'></SCRIPT>
    
    
    <?php
    
    include 'library/config.php';
    include 'library/opendb.php';
    include 'menumaker.php';
    error_reporting(0);
    
    echo "<body background='images/backgroundTile3.gif'>";
    
    //BEGINS MENU JAVASCRIPT CREATION
    
    $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>
      <TBODY>";
    
    
    $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'];
    
    echo"<TR>
        <TD bgcolor=#f2f1f1 align='center'><A class=menuLink href='shirtresults.php?keyword={$keyword1}'>$keyword1</A></TD></TR>";
    }//ENDS KEYWORD LOOP
    
    echo"</TBODY>
    </TABLE></DIV></DIV></DIV>
    
    <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>
      <TBODY>";
    
    $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'];
    
    echo"<TR>
        <TD bgcolor=#f2f1f1 align='center'><A class=menuLink href='shirtresults.php?color={$color}'>$color</A></TD></TR>";
    }//ENDS COLOR LOOP
    
    echo"</TBODY>
    </TABLE></DIV></DIV></DIV>";
    
    
    
    }
    
    //BEGINS MENU JAVASCRIPT CREATION
    
    
    
    $data = mysql_query("SELECT * FROM shirts") or die(mysql_error());
    
    $column = 1;
    
    echo
    
    "<table>
    	  <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'>
              <tr>
                <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>-------------------------</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>
    					</select></form></p></td>
                <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'>
                </form></p></td>
                </tr>
            </table></div>
            </td></tr>
    	  <tr><td width='680'>
            <img border='0' src='images/spacer.gif' width='15' height='15'></td></tr>
    	  	  <tr>
    
    
    	  <td width='680'><div align='center'>
    		<table border='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#111111' width='680' cellpadding='0'>
    		  <tr>";
    
    
    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>
    			  </tr>
    			  <tr>
    				<td colspan='5' height='128'>
    				<p align='center'><a href='".$info['link']."'>
    				<img border='0' src='".$info['image']."' width='121' height='121'></a></td>
    			  </tr>
    			  <tr>
    				<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>
    			  <tr><td colspan='5' height ='5'  align = 'center'><font size='1'><a href='wasup'>Show me more like this.</a></font> </td></tr>
    			  <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'>
    
    				<tr>
    				<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>
    	</td>
    				</tr>
    				</table>
    				</td>
    
    			 </tr>
    			 <tr><td colspan='5'><img src='images/line.gif'></td></tr>
    			</table>
    			</td>";
    
    $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>";
    ?>
    
    
    </body>
    </html>

  • #2
    New Coder
    Join Date
    Aug 2006
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts
    bump.

  • #3
    Senior Coder
    Join Date
    Sep 2005
    Posts
    1,791
    Thanks
    5
    Thanked 36 Times in 35 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •