The Little Guy Posted October 7, 2009 Share Posted October 7, 2009 I have a script that runs for MANY days/hours, and I use: mysql_insert_id and after a while, this starts returning the same id every time until I shut the script down and then restart the script. What would be causing this? Should I be using mysql_pconnect instead of mysql_connect? // My local database connection $dblocal = mysql_connect("localhost", "root", "pass") or die ("Error connecting to database."); mysql_select_db("spider", $dblocal) or die ("Couldn't select the database."); // My Remote database connection $dbremote = mysql_connect("mydb.com", "username", "password") or die ("Error connecting to database."); mysql_select_db("iconnect", $dbremote) or die ("Couldn't select the database."); do{ // Lots more code here $sql = mysql_query("SELECT * FROM `mp3` WHERE `url` = '$todb'", $dbremote); if(mysql_num_rows($sql) == 0){ echo "Add mp3: ".$todb."\n"; $mp3 = mysql_real_escape_string($todb); mysql_query("INSERT INTO `mp3` (`url`) VALUES ('$mp3')", $dbremote); $cid = mysql_insert_id($dbremote); $shell = new COM('WScript.Shell'); $shell->Run("C:\WINDOWS\system32\cmd.exe /c php C:\php_files\id3.php $cid", 0); $m++; $add = TRUE; } }while (TRUE); Link to comment https://forums.phpfreaks.com/topic/176795-mysql_insert_id-old-id/ Share on other sites More sharing options...
fooDigi Posted October 7, 2009 Share Posted October 7, 2009 it seems you have a remote and local... shouldn't you be taking the data from one to the other? it looks like it is taking it from the remote and trying to insert into the remote... im guessing you want to pull the data to the local side???? Link to comment https://forums.phpfreaks.com/topic/176795-mysql_insert_id-old-id/#findComment-932155 Share on other sites More sharing options...
The Little Guy Posted October 7, 2009 Author Share Posted October 7, 2009 I first pull data from the local that code would be found here: // Lots more code here next I check a page and find all the links. If it is an mp3 files (from the header), insert the mp3 url into the remote db, next get that ID and run a php file, to update all the info from that remote file... if that makes any sense. Link to comment https://forums.phpfreaks.com/topic/176795-mysql_insert_id-old-id/#findComment-932167 Share on other sites More sharing options...
The Little Guy Posted October 7, 2009 Author Share Posted October 7, 2009 any other suggestions? Link to comment https://forums.phpfreaks.com/topic/176795-mysql_insert_id-old-id/#findComment-932550 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.