Jump to content

Link Error


june_c21

Recommended Posts

I run this query on mysql and it showed 2 row of data, meaning i can get display of 2 pages (page 1 and page 2). It work fine when in page 1 but when i click next , the img and data doesn't show up.

 

If i change $id = 1 , it can show page 1 and page 2 with data.

Anyone know what cause this problem ?

 

The reason i use $_GET because i need to take the $id value from another page... code as show below.

 


<?php
$host = 'localhost';
$user = 'admin';
$password = '';
$dbase = 'ad';


$dblink = mysql_connect($host,$user,$password);
mysql_select_db($dbase,$dblink);

$query = "SELECT id,title,description,sortorder,fname,flag FROM addcat WHERE flag=1 ORDER BY sortorder ";
$sql_result = @mysql_query($query, $dblink);
echo "<table border=3 align=center width=90% bordercolor= '#0000FF'>";
echo "<tr><td align =center><b> Cover Page </b></td>";
echo "<td align =center><b>Title</b></td>";
echo "<td align =center><b>Description </b></td>";

while($myrow = @mysql_fetch_array($sql_result))
{
echo "<tr><td align=center><span class=style2><a href=book.php?id=" . $myrow[0] ."><img src= 'admin/upload/$myrow[4]' border='0' width='100' height='100'/></a></span</td>";
echo "<td align=center><span class=style2>" . $myrow[1]. "</span</td>";
echo "<td align=center><span class=style2>" . $myrow[2]. "</span</td></tr>";

}
echo "</table>";
?>


 

 

<?php
$host = 'localhost';
$user = 'admin';
$password = '';
$dbase = 'ad';

$dblink = mysql_connect($host,$user,$password);
mysql_select_db($dbase,$dblink);


include_once("pagination.class.php");  // include main class filw which creates pages
$pagination    =    new pagination();

$id = (int)$_GET['id'];
$query ="SELECT imagemap.title,page.title,page.pageno,imagemap.x1,imagemap.x2,imagemap.y1,imagemap.y2,imagemap.link,page.fname FROM 

page,imagemap WHERE imagemap.title = '$id' AND imagemap.pageno = page.pageno ";


$pagination->createPaging($query,1);
echo '<table border="1" width="400" align="center">';
while($row=mysql_fetch_object($pagination->resultpage)) {
    // echo '<tr><td>'.$row->name.'</td><td>'.$row->age.'</td></tr>'; // display name and age from database

// echo "<tr><td  align=center><img src= 'admin/upload/$row->fname' border='0' width ='450' height='600'/></td></tr>";

echo "<map name='mymap'>";
echo "<area shape = 'rect' href='http://$row->link' coords ='$row->x1,$row->y1,$row->x2,$row->y2'>";

echo "</map>";
echo "<tr><td><img usemap ='#mymap' src='admin/upload/$row->fname' border='0'></td></tr>";

}


echo '</table>';
echo '<table border="1" width="400" align="center">';
echo '<tr><td>';
$pagination->displayPaging();
echo '</td></tr>';
echo '</table>';
?> 


Link to comment
https://forums.phpfreaks.com/topic/174553-link-error/
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.