•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 427,097 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,328 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MySQL advertiser: Programming Forums
Views: 655 | Replies: 16
![]() |
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation:
Rep Power: 8
Solved Threads: 240
Umm.. Post the whole page.. I ll tell you what to do next..
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
language Syntax (Toggle Plain Text)
<?php ini_set("max_execution_time", "30000"); # choose a banner include_once('../includes/db_connect.php'); ?> <?php ini_set("max_execution_time", "30000"); session_start(); # remove members from the mailing list when they click from within the newsletter check_admin(); if (isset($HTTP_GET_VARS['mode']) && $HTTP_GET_VARS['mode']=='delete') { $id=$HTTP_GET_VARS['id']; $query="DELETE FROM dir_site_list WHERE site_id = $id"; $return=mysql_query($query,$link); } $query="SELECT * FROM dir_site_list WHERE site_sponsor='N' AND site_live='Y'ORDER BY site_id LIMIT $start,$limit"; $return=mysql_query($query); $TOTAL=mysql_num_rows($return); $sess_id="PHPSESSID=".session_id(); include("$CONST_INCLUDE_ROOT/Templates/maintemplate.header.inc.php"); ?> <?php include('../includes/admin_header.php'); ?> <?php while ($sql_array=mysql_fetch_object($return)) { $linkback_url="http://$sql_array->site_linkback"; $linkback_url=trim($linkback_url); print("Checking:$sql_array->site_id> <a href='$linkback_url' target='blank'>$linkback_url</a>"); flush(); $contents=""; if (@$fp=fopen($linkback_url,'r')) { $chktime=time(); while(!feof($fp)) { $contents.= fread($fp,1024); if (time() >= $chktime+3) break; } fclose($fp); if (strstr($contents,$CONST_LINK_ROOT)) { $test_result="<font color='green'>Passed</font>"; } else { $test_result="<font color='red'>Failed</font> -> <a href='linkchecker.php?mode=delete&id=$sql_array->site_id&start=$start&limit=$limit'><font color='red'>[Delete]</font></a>"; } print(" -> $test_result<br>"); } else { print(" -> <a href='linkchecker.php?mode=delete&id=$sql_array->site_id&start=$start&limit=$limit'><font color='red'>Failed to open</font></a><br>"); } flush(); } print("<br>Link Checking Complete"); mysql_close($link); ?> <p><input type="button" onClick="location.href='linkchecker.php?start=<?php echo $start ?>&limit=<?php echo $limit ?>&<?php echo $sess_id ?>'" value="Refresh" name="btnRefresh"> <input type="button" onClick="location.href='linkchecker.php?start=<?php echo $start+30 ?>&limit=<?php echo $limit ?>&<?php echo $sess_id ?>'" value="Next" name="btnNext"></p> <p> </p> <?include("$CONST_INCLUDE_ROOT/Templates/maintemplate.footer.inc.php");?>
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation:
Rep Power: 8
Solved Threads: 240
Okay.. You have some errors in your script.
1.
When you execute the script for the 1st time, no LIMIT is set. That is, $start and $limit will be empty. Thats the reason you are getting the error.
2. There has to be a whitespace between site_live='Y' and ORDER in the query
3. Since you aren't assigning or calculating $start and $limit, you always get this error.
My suggestion is to ask the person who did this script for you to give you a working pagination script!
1.
•
•
•
•
SELECT * FROM dir_site_list WHERE site_sponsor='N' AND site_live='Y' ORDER BY site_id LIMIT ,
2. There has to be a whitespace between site_live='Y' and ORDER in the query
•
•
•
•
$query="SELECT * FROM dir_site_list WHERE site_sponsor='N' AND site_live='Y'ORDER BY site_id LIMIT $start,$limit";
3. Since you aren't assigning or calculating $start and $limit, you always get this error.
My suggestion is to ask the person who did this script for you to give you a working pagination script!
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
•
•
•
•
Okay.. You have some errors in your script.
1.
When you execute the script for the 1st time, no LIMIT is set. That is, $start and $limit will be empty. Thats the reason you are getting the error.
2. There has to be a whitespace between site_live='Y' and ORDER in the query
3. Since you aren't assigning or calculating $start and $limit, you always get this error.
My suggestion is to ask the person who did this script for you to give you a working pagination script!

This could sound cheeky, but would you have any advice on how to fix it that it can at least work for now. OKAY, I am cheeky.
Thanks for all your help.
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation:
Rep Power: 8
Solved Threads: 240
You can initialise $start and $limit value. Try the following script. If it works, then, Yay! If it doesn't, then you can post your question in php forum. There are many people who loves to write scripts ! You might get help from any one of them!
php Syntax (Toggle Plain Text)
<?php ini_set("max_execution_time", "30000"); # choose a banner include_once('../includes/db_connect.php'); ?> <?php ini_set("max_execution_time", "30000"); session_start(); # remove members from the mailing list when they click from within the newsletter check_admin(); $start = isset($_REQUEST['start']) ? $_REQUEST['start']:"0"; $limit = 10; // how many records you want to show per page if (isset($HTTP_GET_VARS['mode']) && $HTTP_GET_VARS['mode']=='delete') { $id=$HTTP_GET_VARS['id']; $query="DELETE FROM dir_site_list WHERE site_id = $id"; $return=mysql_query($query,$link); } $query="SELECT * FROM dir_site_list WHERE site_sponsor='N' AND site_live='Y'ORDER BY site_id LIMIT $start,$limit"; $return=mysql_query($query); $TOTAL=mysql_num_rows($return); $sess_id="PHPSESSID=".session_id(); include("$CONST_INCLUDE_ROOT/Templates/maintemplate.header.inc.php"); ?> <?php include('../includes/admin_header.php'); ?> <?php while ($sql_array=mysql_fetch_object($return)) { $linkback_url="http://$sql_array->site_linkback"; $linkback_url=trim($linkback_url); print("Checking:$sql_array->site_id> <a href='$linkback_url' target='blank'>$linkback_url</a>"); flush(); $contents=""; if (@$fp=fopen($linkback_url,'r')) { $chktime=time(); while(!feof($fp)) { $contents.= fread($fp,1024); if (time() >= $chktime+3) break; } fclose($fp); if (strstr($contents,$CONST_LINK_ROOT)) { $test_result="<font color='green'>Passed</font>"; } else { $test_result="<font color='red'>Failed</font> -> <a href='linkchecker.php?mode=delete&id=$sql_array->site_id&start=$start&limit=$limit'><font color='red'>[Delete]</font></a>"; } print(" -> $test_result<br>"); } else { print(" -> <a href='linkchecker.php?mode=delete&id=$sql_array->site_id&start=$start&limit=$limit'><font color='red'>Failed to open</font></a><br>"); } flush(); } print("<br>Link Checking Complete"); mysql_close($link); ?> <p><input type="button" onClick="location.href='linkchecker.php?start=<?php echo $start ?>&limit=<?php echo $limit ?>&<?php echo $sess_id ?>'" value="Refresh" name="btnRefresh"> <input type="button" onClick="location.href='linkchecker.php?start=<?php echo $start+30 ?>&limit=<?php echo $limit ?>&<?php echo $sess_id ?>'" value="Next" name="btnNext"></p> <p> </p> <?include("$CONST_INCLUDE_ROOT/Templates/maintemplate.footer.inc.php");?>
Last edited by nav33n : Jul 25th, 2008 at 2:54 am.
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
![]() |
•
•
•
•
•
•
•
•
DaniWeb MySQL Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource (PHP)
- PHP problem! (PHP)
- pagination not displaying results (PHP)
- Using a Serch option on a mag site. (PHP)
- Mysql num rows(): Invalid argument (PHP)
- DB-Authentication php/mysql on Mac OSX v3 (PHP)
Other Threads in the MySQL Forum
- Previous Thread: use more than two tables
- Next Thread: Mysql IsNull check



Linear Mode