daveh33 Posted January 8, 2008 Share Posted January 8, 2008 I have a script which exports numbers from a mysql database - it currently exports all numbers in a loops whilst checking if the number is in another database (reject list) - if it is, the number isn't displayed. My code is: - <?php $f = $_GET['function']; $id = $_GET['id']; if ($f!="all" && $f!="get10k") { include_once("header.php"); } require_once("../dbconnect.php"); $result = mysql_query("SELECT * FROM data_lists WHERE id='$id'") or die(mysql_error()); $row = mysql_fetch_array($result) or die(mysql_error()); $tablename = $row['tablename']; $name = $row['name']; $lp = $row['lastprocessed']; if ($f=="all") { $result = mysql_query("SELECT DISTINCT(number) FROM $tablename") or die(mysql_error()); while ($row = mysql_fetch_array($result)) { $number = $row['number']; $result1 = mysql_query("SELECT DISTINCT(number) FROM STOPS") or die(mysql_error()); $row1 = mysql_fetch_array($result1); $stop = $row1['number']; if ($number!=$stop) { echo $number; echo "<br />"; } } mysql_query("UPDATE data_lists SET lastupdate='$date' WHERE id='$id'") or die(mysql_error()); exit(); } I am trying to duplicate this code - so instead of getting all the rows - it gets 10,000 rows, I added the field 'lastprocessed' to data_lists so when the query is successfully executed I can record the starting point for next time the query is ran. Can anyone offer any advise on how to complete this? All help is much appreciated Quote Link to comment https://forums.phpfreaks.com/topic/85001-export-mysql-with-limit/ Share on other sites More sharing options...
rajivgonsalves Posted January 8, 2008 Share Posted January 8, 2008 Is the a date field in your main table where your doing a export. Quote Link to comment https://forums.phpfreaks.com/topic/85001-export-mysql-with-limit/#findComment-433507 Share on other sites More sharing options...
daveh33 Posted January 8, 2008 Author Share Posted January 8, 2008 The database with the numbers only had 1 field 'number'. The database data_lists has 'lastupdated' & 'created' Quote Link to comment https://forums.phpfreaks.com/topic/85001-export-mysql-with-limit/#findComment-433511 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.