So what else is new, you ask? Well, the thing about this particular problem is that on one occasion it works and on most of others it doesn't...
It doesn't throw any error any warning nor notice...
It just keeps loading the page and does nothing...
There is not even The 30 second timeout warning nor anything of that kind...
Also, I can't figure out what are the particular terms for this script to fail (well it doesn't fails exactly but it fails to deliver proper results). On same two situations with same data once it fails and once it doesn't...
What I do with this script is like follows:
mysql_close($dblink);//closing previous database connection
$dblink2 = mysql_connect($DBServer,'username','pass');
mysql_select_db('db_name',$dblink2);
$uniq = '';
while(!$uniq){
if($randmaxx){
$randmax = $randmaxx;
}
$uniq_str = strtolower(substr(md5(rand(0,$randmax)), 0,7));
$ucmd = "select id from table_name where uid = '$uniq_str'";
$urow = mysql_query($ucmd);
if(@mysql_num_rows($urow)==0){
$uniq=1;
}
}
$sqln = mysql_query("INSERT INTO table_name (fileds list) VALUES (values list)");
mysql_close($dblink2);
$dblink = mysql_connect($DBServer,$DBUser,$DBPass);
mysql_select_db($DBName,$dblink);
As it is clear from this (I hope) is that I first close previous connection to the database and then connect to the same MySQL server but different database (they are both mine) and perform an action of determing the random user id, insert needed values to the other database's table and then disconnect from this last connection and connect back to the first one...
In short:
step 1. disconnect from link1
step 2. connect to the link 2
step 3. insert needed data in the table through link 2.
step 4. disconnect from the link2
step 5. connect back to the link 1.
It might be usefull to know that all is going well prior to the step 1 I just described and the code works as it should...
Does anybody have a clue on what is happening and what should I do to make this script work every time?
The server administrator reported that the script worked for him and if there is a failure to deliver proper results it might be the programmer's (mine) fault...
I would welcome any help at all...
Any ideas including "man, you are an idiot..." ideas are most welcome...