Jump to content

[SOLVED] page link


spooke2k

Recommended Posts

hi i have just started programming in php and am having differculty finding out how to seperate my sql recordsets im returning i want to limit how many to display. And have  page one, page 2 next page back etc on on page to display next 20 pictures etc . please see code below and if someone could tell me how it would be appeciated.

 

at the moement code below just throws information out into a table and like i said im new so sorry for newb coding

.

Thanks

 

Spooke2k

 

while($row = mysql_fetch_array($result))

  {

echo "<tr>";

echo "<td>" . $row['prozenid'] . " </td>";

echo "<td>" . $row['productcode'] . "</td>";

echo "<td>£" . $row['price'] . "</td>";

echo '<td><div align="center">

<a href= "http://www.testsite/images/large/'. $row['productcode'].'.jpg">

<img src= image/tn_'. $row['productcode'].'.jpg alt="no image available"

/> <a/> </div>';

echo "</tr>";

}

 

Link to comment
https://forums.phpfreaks.com/topic/54299-solved-page-link/
Share on other sites

 
  <a href= "http://www.testsite/images/large/'. $row['productcode'].'.jpg"> 

is wrong you are missing quotes to escape to a variable try

   <a href= \"http://www.testsite/images/large/". $row['productcode'].".jpg\"> 

 

you need to escape with same quotes you started with rule of thumbs always use double quotes on echo statements and if needed use \" to escape an in echo double quote

 

one sec i'm seeing a lot more issues than that one. Check your other quotes

Link to comment
https://forums.phpfreaks.com/topic/54299-solved-page-link/#findComment-268473
Share on other sites

I cleaned it up a bit

while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['prozenid'] . " </td>";
echo "<td>" . $row['productcode'] . "</td>";
echo "<td>£" . $row['price'] . "</td>";
echo "<td>
	<div align=\"center\">
		<a href= \"http://www.testsite/images/large/". $row['productcode'].".jpg\">
			<img src=\"image/tn_". $row['productcode'].".jpg\" alt=\"no image available\" /> 
		<a />
	</div>";
echo "</tr>";
}

 

 

I think this is correct now

Link to comment
https://forums.phpfreaks.com/topic/54299-solved-page-link/#findComment-268475
Share on other sites

 
  <a href= "http://www.testsite/images/large/'. $row['productcode'].'.jpg"> 

is wrong you are missing quotes to escape to a variable try

   <a href= \"http://www.testsite/images/large/". $row['productcode'].".jpg\"> 

 

you need to escape with same quotes you started with rule of thumbs always use double quotes on echo statements and if needed use \" to escape an in echo double quote

 

one sec i'm seeing a lot more issues than that one. Check your other quotes

 

nope! you gotta check your quotes... he echo '';ed not ""

 

 

 

your talking pagination... http://www.phpfreaks.com/tutorials/43/0.php

Link to comment
https://forums.phpfreaks.com/topic/54299-solved-page-link/#findComment-268477
Share on other sites

while($row = mysql_fetch_array($result))
  {
echo "<tr>";
echo "<td>{$row['prozenid']}</td>"; 
echo "<td>{$row['productcode']}</td>"; 
echo "<td>£{$row['price']}</td>";
echo "<td><div align=\"center
\"> 
   <a href=\"http://www.testsite/images/large/{$row['productcode']}.jpg"> 
   <img src= image/tn_{$row['productcode']}.jpg alt=\"no image available\" 
   /> <a/>   </div>";
echo "</tr>";

Please make sure you use quotes consistently, and {$row['']} can avoid complex quotes.

Ted

}

Link to comment
https://forums.phpfreaks.com/topic/54299-solved-page-link/#findComment-268482
Share on other sites

while($row = mysql_fetch_array($result))
  {
echo "<tr>";
echo "<td>{$row['prozenid']}</td>"; 
echo "<td>{$row['productcode']}</td>"; 
echo "<td>£{$row['price']}</td>";
echo "<td><div align=\"center
\"> 
   <a href=\"http://www.testsite/images/large/{$row['productcode']}.jpg"> 
   <img src= image/tn_{$row['productcode']}.jpg alt=\"no image available\" 
   /> <a/>   </div>";
echo "</tr>";

Please make sure you use quotes consistently, and {$row['']} can avoid complex quotes.

Ted

}

 

you missed one on the part ,.jpg  alt=" should be .jpg alt=\"

Link to comment
https://forums.phpfreaks.com/topic/54299-solved-page-link/#findComment-268484
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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