Paging big text with images
Posted: Wed Jul 11, 2007 9:30 pm
Hello everybody!
I need help/solution to page big text with images from MySQL.I tried many things,but I can't do it
Here is the code:
Problem is that sometimes the SQL cuts the image tag like this 
Please someone to write me the solution/code.
p.p.Sorry for my bad english!
Greetings to all!
I need help/solution to page big text with images from MySQL.I tried many things,but I can't do it
Here is the code:
Code: Select all
<?php
if(isset($_GET['page']) && (int)$_GET['page'] >= 1 && (int)$_GET['page'] < 100 ) {
$page=(int)$_GET['page'];
} else {
$page=1;
}
$show=1000; //Letters per page
$from = (($page * $show) - $show + 1);
$q = mysql_query("SELECT SUBSTRING(text,$from,$show) AS Page FROM test") or die(mysql_error());
$q2 = mysql_fetch_array(mysql_query("SELECT LENGTH(text) AS Len FROM test")) or die(mysql_error());
$total_results = (int)$q2['Len'];
if (mysql_num_rows($q) == 0) {
echo "empty!";
} else {
while ($fet = mysql_fetch_array($q)) {
$the = $fet['Page'];
}
}
echo $the;
echo "<br/>all:$total_results<br/>";
$total_pages = ceil($total_results / $show);
if($page > 1) {
$prev = ($page - 1);
echo "<a href='?page=$prev'><prev</a> ";
}
for($i = 1; $i <= $total_pages; $i++) {
if(($page) == $i) {
echo "<b>[$i]</b>";
} else {
echo " <a href='?page=$i'>$i</a> ";
}
}
if($page < $total_pages) {
$next = ($page + 1);
echo " <a href='?page=$next'>next></a>";
}
?>and the text after this goes like link (because the <a tag is unclosed).<a href="test.html"><img src="test.png....
Please someone to write me the solution/code.
p.p.Sorry for my bad english!
Greetings to all!