Re: Re: Query stopping after 2 records?
| From: | Miller, Terion | Date: | Tue, 05 May 2009 12:39:25 +0000 |
| Subject: | Re: Re: Query stopping after 2 records? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-292261@lists.php.net to get a copy of this message | ||
Miller: She already posted this was solved.
On 5/4/09 5:27 PM, "Martin Zvarík" <mzvarik@gmail.com> wrote:
If the query stopped after getting 2 entries then this has nothing to do
with max_execution_time.
But stupid topic anyway, I don't know why are we even trying to figure
what Miller meant, he most probably solved it already...
Andrew Hucks napsal(a):
> When you say die, does it just stop, or do you get an error message?
> Depending on how long it's taking to perform the action, the script
> will stop just because it's taking a while. (by default, I think it's
> 30 seconds.)
>
> If so, use: ini_set("max_execution_time", "time in seconds");
>
> On Mon, May 4, 2009 at 3:43 PM, Martin Zvarík <mzvarik@gmail.com> wrote:
>
>> Miller, Terion napsal(a):
>>
>>> I need help/advice figuring out why my query dies after 2 records. Here
>>> is
>>> the query:
>>>
>>> // Build your INSERT statement here
>>>
>>> $query = "INSERT into
warrants (wid, name, age,
>>> warrant, bond, wnumber,
>>> crime) VALUES (";
>>> $query .= " '$wid', '$name', '$age',
>>> '$warrant',
>>> '$bond', '$wnumber', '$crime' )";
>>> $wid = mysql_insert_id();
>>>
>>> // run query
>>> mysql_query($query) or die ("GRRRRRRR");
>>>
>>>
>>> echo $query;
>>>
>>> It inserts two records and dies half way thru the 3rd?
>>> Thanks in advance for clues to fix this.
>>> T.Miller
>>>
>>>
>> Should be:
>> ------------------
>>
>> $sql = ...
>>
>> $query = mysql_query($sql) or die(...
>>
>> while ($r = mysql_fetch_array($query)) { ....
>>
>> ------------------
>>
>> Notice that you need to assign the mysql_query to a $query variable!
>>
>>
>> If you understand this, then there's most probably a mistake in your SQL
>> statement.
>>
>>
>> Martin
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>>
>
>