Forum Moderators: coopster

Message Too Old, No Replies

PHP MYSQL update issue

MYSQL updating with PHP

         

Adminsdeath

8:37 pm on Dec 4, 2003 (gmt 0)

10+ Year Member



I normally do not ask for much help on php or mysql but this one has me stumped as to the actual cause of the issue.

I have a script that updates about 3000 records hourly well my main issue is this. The update starts and about 400 records into the update script, it stops . Sometimes it may go all the way and sometimes it does not.
Nothing changes in the scripting from one event to the next. As in sructured data wise.Is there a limit to the mysql_query update feature to PHP or MYSQL that wold cause this.

This is an example of my issue.

$tonytiger = mysql_query("select * from world");
while($goathurder = mysql_fetch_arrary($tonytiger))
{
$rickeet = mysql_query("select * from yukon where timeline='$goathurder[hunted]'");
$poco = mysql_fetch_array($rickeet);

$place = $goathurder[place] + $poco[place];
$yoogie = mysql_query("update location set place='$place' where hunted='$goathurder[hunted]'");
}

Now this query has been known to complete many times with 3000 records but its the time it does not that is my question.

brotherhood of LAN

8:45 pm on Dec 4, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



>$goathurder[hunted]

You may want to quote the brackets, $goathurder['hunted']....do you not get warnings in the script because of this?

Also, try using the mysql_escape_string(); function on the strings you put into the database, that could be why some records get updated and some dont.

//forgot

welcome to webmasterworld!

Adminsdeath

8:54 pm on Dec 4, 2003 (gmt 0)

10+ Year Member


When you say some get updated and some do not are you saying this is why at a point it will stop updating not skip a record or two. It does not skip it ends.

Now as for the ['hunted'] I like that it does define to query better. But actually i do not get script errors from it but it does answer a question to another issue I had it makes sense as to why it does not work at all. lol...

Can you explain the use of the escape_string(); function in a little more detail to me for I am not aware of it

brotherhood of LAN

8:58 pm on Dec 4, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



>mysql_escape_string()

it will escape strings before you put them into the database
[php.net...]

do you get any errors from the script? it's worth viewing the script and seeing what it says.

Another possibility is the script is timing out? the php default is 30 seconds....does it stop after 30 seconds?

Just trying to narrow it down, you know what it's like, a stray character here and tehre and it can all go to pot ;)

Adminsdeath

9:14 pm on Dec 4, 2003 (gmt 0)

10+ Year Member


Now that makes sense a timeout issue.

now as for the
mysql_escape_string(); function
Now thats seems to be a better then a str_replace
which I do use.
lol..
didnt show that part heheh..

Thank you I can work on that resolve with a better direction thank you for the light.

Rick..