I have just got use of a new dedicated webserver... Now the 1st time a piece of code is ran it doesnt work but then the 2nd it does...
i.e. index.php // stuff... $visitDBID = referrerVisit($rid,$rgid,$visitIP,$visitFromURL); // stuff... //end index.php function referrerVisit($rid,$rgid,$visitIP,$visitFromURL) { $db = dbConnect(); $sql = " insert into referral (RID, RGID, VisitorIP, VisitorDate, VisitorFromURL) values($rid,$rgid,'$visitIP',NOW(),'$visitFromURL') "; echo $sql; $result=mysql_query($sql); if(mysql_error()) { echo "inserted not"; $errormessage = ""; $errormessage .= "SQL: $sql<br>"; $errormessage .= "Error Code: ".mysql_errno().": ".mysql_error(); echo " Sorry, an error has occured. It has been recorded and reported to the Website Administrator.<br><br> Error:<br> $errormessage "; return null; } else { echo "inserted"; return mysql_insert_id($db); } } When it's ran initilly: the sql that i generated looks like: insert into referral (RID, RGID, VisitorIP, VisitorDate, VisitorFromURL) values( insert into referral (RID, RGID, VisitorIP, VisitorDate, VisitorFromURL) values(Resource id #4,Resource id #4,'Resource id #4',NOW(),'Resource id #4') , insert into referral (RID, RGID, VisitorIP, VisitorDate, VisitorFromURL) values(Resource id #4,Resource id #4,'Resource id #4',NOW(),'Resource id #4') ,' and gives the error: Error: SQL: Error Code: 1065: Query was empty However if i refresh the page: it executes correctly... Any ideas? --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.438 / Virus Database: 246 - Release Date: 07/01/03 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php