aebstract Posted July 30, 2008 Share Posted July 30, 2008 $conn = mysql_connect('_','_','_') or trigger_error("SQL", E_USER_ERROR); $db = mysql_select_db('_',$conn) or trigger_error("SQL", E_USER_ERROR); $sql = "SELECT COUNT(*) FROM photo_gallery"; $result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR); $r = mysql_fetch_row($result); $numrows = $r[0]; $rowsperpage = 18; $totalpages = ceil($numrows / $rowsperpage); if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage'])) { $currentpage = (int) $_GET['currentpage']; } else { $currentpage = 1; } if ($currentpage > $totalpages) { $currentpage = $totalpages; } if ($currentpage < 1) { $currentpage = 1; } $offset = ($currentpage - 1) * $rowsperpage; $sql = "SELECT id, photoname FROM photo_gallery LIMIT $offset, $rowsperpage"; $result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR); while ($list = mysql_fetch_assoc($result)) { $photoname = $list['photoname']; $echo_gallery = "<div class=\"photo\">$photoname</div>"; } I've been trying to figure out the problem and I can't even seem to isolate it. I really hope it is something stupid and overlooked. This code is almost exact to the pagination tutorial code and it's producing a white page issue. If I take the code out, the page displays normal. Link to comment https://forums.phpfreaks.com/topic/117327-solved-help-with-pagination-tutorial-white-page/ Share on other sites More sharing options...
unkwntech Posted July 30, 2008 Share Posted July 30, 2008 add error_reporting(E_ALL); to the top and see if it displays any errors. Link to comment https://forums.phpfreaks.com/topic/117327-solved-help-with-pagination-tutorial-white-page/#findComment-603513 Share on other sites More sharing options...
aebstract Posted July 30, 2008 Author Share Posted July 30, 2008 Just placing that directly at the top keeps it a white page. Link to comment https://forums.phpfreaks.com/topic/117327-solved-help-with-pagination-tutorial-white-page/#findComment-603516 Share on other sites More sharing options...
unkwntech Posted July 30, 2008 Share Posted July 30, 2008 Try this then: <?php ini_set('display_errors', '1'); error_reporting(E_ALL); ?> Link to comment https://forums.phpfreaks.com/topic/117327-solved-help-with-pagination-tutorial-white-page/#findComment-603519 Share on other sites More sharing options...
aebstract Posted July 30, 2008 Author Share Posted July 30, 2008 Neat: Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /hermes/web03/b500/pow.berryms/htdocs/new/photos.php on line 4 Fatal error: SQL in /hermes/web03/b500/pow.berryms/htdocs/new/photos.php on line 4 I'm guessing it's some sort of issue with the username/password/database I'm using? I'm sure it's right since I set it up just before I put the info in. Could it have anything to do with using localhost? I've always used it in the past but I think I've heard that some servers you can't use it and this is definitely a new server for me to be on. Link to comment https://forums.phpfreaks.com/topic/117327-solved-help-with-pagination-tutorial-white-page/#findComment-603522 Share on other sites More sharing options...
unkwntech Posted July 30, 2008 Share Posted July 30, 2008 It might be the localhost try 127.0.0.1 instead. localhost opens the connection via a named pipe, and on occasion MySQL will be a bit argumentative. Link to comment https://forums.phpfreaks.com/topic/117327-solved-help-with-pagination-tutorial-white-page/#findComment-603524 Share on other sites More sharing options...
aebstract Posted July 30, 2008 Author Share Posted July 30, 2008 Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on '127.0.0.1' (111) in /hermes/web03/b500/pow.berryms/htdocs/new/photos.php on line 4 Fatal error: SQL in /hermes/web03/b500/pow.berryms/htdocs/new/photos.php on line 4 ;( Link to comment https://forums.phpfreaks.com/topic/117327-solved-help-with-pagination-tutorial-white-page/#findComment-603526 Share on other sites More sharing options...
aebstract Posted July 30, 2008 Author Share Posted July 30, 2008 Hrm, I just changed localhost to: berryms.powwebmysql.com and it's displaying my page again, just not displaying my results correctly edit: which was my fault for not having a . before my = in my loop. Thanks for the help Link to comment https://forums.phpfreaks.com/topic/117327-solved-help-with-pagination-tutorial-white-page/#findComment-603529 Share on other sites More sharing options...
unkwntech Posted July 30, 2008 Share Posted July 30, 2008 Well that's a whole other issue. If you give us some more info, we might be able to help. Link to comment https://forums.phpfreaks.com/topic/117327-solved-help-with-pagination-tutorial-white-page/#findComment-603530 Share on other sites More sharing options...
rameshfaj Posted July 30, 2008 Share Posted July 30, 2008 Are ur sql queries working well?Try to trace it. Link to comment https://forums.phpfreaks.com/topic/117327-solved-help-with-pagination-tutorial-white-page/#findComment-603531 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.