hmm i still cant get it to work. here's my problem:
i used flat ASCII database before it grew to a size when i needed to go mySQL. old code:
<?php
if ($page) {
$fp = @fopen("photo.txt", 'r');
$array = explode("\n", fread($fp, filesize("photo.txt")));
for($x=$page;$x<$page+100;$x++) {
$temp = explode("|",$array[$x]);
if ($temp[0]) {
$getdomain = parse_url($temp[0]);
$host = str_replace($getdomain[path],"",$temp[0]);
echo "$x - $temp[1] - $temp[2] - $host - $temp[0]<br>\n";
}
}
$prev = $page-100;
$next = $page+100;
$span = "<a href=\"?page=$prev\"><< Previous 100</a> - <a href=\"?page=$next\">Next 100 >></a>";
}
else {
$fp = @fopen("photo.txt", 'r');
$array = explode("\n", fread($fp, filesize("photo.txt")));
for($x=0;$x<100;$x++) {
$temp = explode("|",$array[$x]);
if ($temp[0]) {
$getdomain = parse_url($temp[0]);
$host = str_replace($getdomain[path],"",$temp[0]);
echo "$x - $temp[1] - $temp[2] - $host - $temp[0]<br>\n";
}
}
$span = "<a href=\"?page=100\">Next 100 >></a>";
}
?>
if you see in the old code i made pages to span with 100 results on each. and thats what i am trying to do with my new code that gets all data from mySQL:
<?php
$link = mysql_connect('localhost', 'user', 'pass') or die('Could not connect: ' . mysql_error());
mysql_select_db('mmorpw_photo') or die('Could not select database');
$query = 'SELECT * FROM photo';
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
while($line = mysql_fetch_row($result)) {
$num++;
for($x=0; $x <= count($line); $x++) {
$size = $line[3];
$url = $line[1];
}
print "$num - $size - $url<BR>\n";
}
mysql_free_result($result);
mysql_close($link);
?>
you see, my old technique works fine with if/else, but when i try to add it to my new code, it just wont work. do you think you could point me to the right direction here?