Jump to content

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

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.