spooke2k Posted June 5, 2007 Share Posted June 5, 2007 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>"; } Quote Link to comment https://forums.phpfreaks.com/topic/54299-solved-page-link/ Share on other sites More sharing options...
cooldude832 Posted June 5, 2007 Share Posted June 5, 2007 <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 Quote Link to comment https://forums.phpfreaks.com/topic/54299-solved-page-link/#findComment-268473 Share on other sites More sharing options...
cooldude832 Posted June 5, 2007 Share Posted June 5, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/54299-solved-page-link/#findComment-268475 Share on other sites More sharing options...
taith Posted June 5, 2007 Share Posted June 5, 2007 <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 Quote Link to comment https://forums.phpfreaks.com/topic/54299-solved-page-link/#findComment-268477 Share on other sites More sharing options...
spooke2k Posted June 5, 2007 Author Share Posted June 5, 2007 thanks guys really appeciated. Spooke2k Quote Link to comment https://forums.phpfreaks.com/topic/54299-solved-page-link/#findComment-268478 Share on other sites More sharing options...
ted_chou12 Posted June 5, 2007 Share Posted June 5, 2007 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 } Quote Link to comment https://forums.phpfreaks.com/topic/54299-solved-page-link/#findComment-268482 Share on other sites More sharing options...
cooldude832 Posted June 5, 2007 Share Posted June 5, 2007 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=\" Quote Link to comment https://forums.phpfreaks.com/topic/54299-solved-page-link/#findComment-268484 Share on other sites More sharing options...
ted_chou12 Posted June 5, 2007 Share Posted June 5, 2007 opps, sorry. :-\, thanks for correcting. Ted Quote Link to comment https://forums.phpfreaks.com/topic/54299-solved-page-link/#findComment-268487 Share on other sites More sharing options...
cooldude832 Posted June 5, 2007 Share Posted June 5, 2007 also use the " " it makes it easier to read gotta love the pretty print Quote Link to comment https://forums.phpfreaks.com/topic/54299-solved-page-link/#findComment-268489 Share on other sites More sharing options...
spooke2k Posted June 5, 2007 Author Share Posted June 5, 2007 is bring an error now of missing < on page these lines somewhere any ideas <a href=\"http://www.testpagecom/images/large/{$row['productcode']}.jpg"> <img src= image/tn_{$row['productcode']}.jpg alt="no image available\" Quote Link to comment https://forums.phpfreaks.com/topic/54299-solved-page-link/#findComment-268491 Share on other sites More sharing options...
ted_chou12 Posted June 5, 2007 Share Posted June 5, 2007 <a href=\"http://www.testpagecom/images/large/{$row['productcode']}.jpg\"> <img src= image/tn_{$row['productcode']}.jpg alt=\"no image available\" Red is what I added, I think thats where the error is. Ted Quote Link to comment https://forums.phpfreaks.com/topic/54299-solved-page-link/#findComment-268494 Share on other sites More sharing options...
cooldude832 Posted June 5, 2007 Share Posted June 5, 2007 that and src= \" you have src= no quote for escaping into the location of image fyi if you use a text editor with line numbering php will error out line numbers which is very nice Quote Link to comment https://forums.phpfreaks.com/topic/54299-solved-page-link/#findComment-268496 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.