Jump to content

mysql_insert_id old id...


The Little Guy

Recommended Posts

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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.