Jump to content

link isn't working to generate page


Bar2aYunie

Recommended Posts

I have a scipt to generate pages with php, but I cannot seem to get the url right. The default page is working and the first step (items) is working just fine. But the next step (color) isn't working. It's either the link that isn't working or the third page itself. Does anybody see what I'm missing or doing wrong?

 

Here's my script:

 

<?php  switch($_GET['step']){
     case "items": 
 $column=2;
          $sizecat=mysql_real_escape_string($_GET['size']);
          echo "<table style='width:100%;'>\n\t\t<tr>";
          $itemsQuery=mysql_query("SELECT DISTINCT thumb_sizecat, sizecat, link_size, size, thumb_size, finalsize FROM `Folders` WHERE `sizecat`='{$sizecat}';");

          while($item=mysql_fetch_array($itemsQuery)){
               $link="?step=color&sizecat=".urlencode($sizecat)."&finalsize=".urlencode($item['finalsize']);
		  
		  if ($column==2) {echo "<tr>";}
			?>
                <td width="25%" align="center"><?php echo "<a href='{$link}'><img src='{$item['thumb_size']}'  alt='{$item['thumb_size']}' /><br />{$item['size']}<br />{$item['finalsize']}<br /></a>" ?></td>
                <?php
			$column++; if ($column==6) { echo "</tr>"; $column=2; }
	  		}
          echo "</tr><tr><td align='center' colspan='4'><input type=button value='Back' onClick='history.go(-1)'></td></tr></table>\r\n";
     break;
     case "color":
     $column=2;
          $finalsize=mysql_real_escape_string($_GET['finalsize']);
          echo "<table style='width:100%;'>\n\t\t<tr>";  
          $colorQuery=mysql_query("SELECT DISTINCT thumb_sizecat, sizecat, link_size, size, thumb_size, finalsize, color, link_color, thumb_color FROM `Folders` WHERE `finalsize`='{$finalsize}';");

          while($item=mysql_fetch_array($colorQuery)){
               $link="?step=material&finalsize=".urlencode($finalsize)."&finalsize=".urlencode($item['finalsize']);
		  
		  if ($column==2) {echo "<tr>";}
			?>
                <td width="25%" align="center"><?php echo "<a href='{$link}'><img src='{$item['thumb_color']}'  alt='{$item['thumb_color']}' /><br />{$item['color']}<br /></a>" ?></td>
                <?php
			$column++; if ($column==6) { echo "</tr>"; $column=2; }
	  		}
          echo "</tr><tr><td align='center' colspan='4'><input type=button value='Back' onClick='history.go(-1)'></td></tr></table>\r\n";
     break;
 default:
          $table = "<table style='width:100%;'><tr>\n";  
          $result = mysql_query("SELECT DISTINCT thumb_sizecat, sizecat, link_size FROM Folders ORDER BY id") or die (mysql_error());  
          while($row = mysql_fetch_array($result)){  
               $row['price1'] = round ((($row['price1']+5) *1.85),0);
               $base_m=5;
               $row['price11'] = $base_m*(ceil(($row['price1'])/$base_m));
		   
               $table.="\t\t<td align='center' style='width:25%;'>"
               ."<a href='?step=items&size=".urlencode($row['sizecat'])."'><img src='{$row['thumb_sizecat']}' alt='{$row['thumb_sizecat']}' />"
               ."<br />{$row['sizecat']}</a></td>\n"; 
               $colnum++;if($colnum % 4 == 0) $table.="\t</tr>\n\t<tr>\n";  
          }  
          $table .= "\t</tr>\n</table>\n";
          echo $table; 
     break;
}
?> 

 

 

Thx in advance!

Link to comment
Share on other sites

Well, after hours of puzzling, I figured out the problem. I do have something else I wanna ask you guys.... (which might save me hours of puzzling, haha)

 

Here's my code:

 

$formaatcat=mysql_real_escape_string($_GET['sizecat']);
	  $eindformaat=$_GET['finalsize'];
	  $thumb_formaat=$_GET['thumb_size'];
	  $bedrukking=$_GET['color'];
	  $papiersoort=$_GET['material'];
          echo "<table style='width:100%;'>\n\t\t<tr><td align='center' colspan='4'><h1>View Prices</h1></td></tr><tr>";  
          $finalQuery=mysql_query("SELECT DISTINCT thumb_size, size, totalsize, Info, material, thumb_material, finalsize, color FROM `Folders` WHERE `sizecat`='{$sizecat}' AND `finalsize`='{$finalsize}' AND `color`='{$color}'  AND `material`='{$material}' AND `thumb_size`='{$thumb_size}';");

 

The select query works for the whole line except for the thumb_size... Without that last part, the query returns three rows (and I only need it to return one row). The thumb_size and the totalsize are the only two things in the database that have their own unique data, unique for every entry. So, to be able to get only one row returned from the query, I need one of those at the end of the query (the others wouldn't even be needed actually).

 

But both of them don't work.... Any idea's??

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.