 |
|
 |
|
Next: recyclebin
|
| Author |
Message |
External

Since: Jul 16, 2007 Posts: 17
|
(Msg. 1) Posted: Sun Sep 02, 2007 5:56 pm
Post subject: Error with < in SQL Archived from groups: alt>php>sql (more info?)
|
|
|
I have started using the new mysql_* extensions. Here is the code I am
trying to run:
$temp2 = "SELECT * FROM assignments2 WHERE daydue < '247' && progress !=
'100'";
$temp2 = mysqli_query($mysqli,$temp2) or die(mysqli_error($mysqli));
$temp2 = mysqli_fetch_array($temp2) or die(mysqli_error($mysqli));
This query doesn't work (though it throws no errors). Only when I change
the "<" to "<=" does the script work. Why doesn't the less than operator
work? >> Stay informed about: Error with in SQL |
|
| Back to top |
|
 |  |
External

Since: Jun 11, 2007 Posts: 37
|
(Msg. 2) Posted: Sun Sep 02, 2007 8:55 pm
Post subject: Re: Error with < in SQL [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Sep 2, 4:42 pm, "Matthew White" wrote:
> I have started using the new mysql_* extensions. Here is the code I am
> trying to run:
> $temp2 = "SELECT * FROM assignments2 WHERE daydue < '247' && progress !=
> '100'";
> $temp2 = mysqli_query($mysqli,$temp2) or die(mysqli_error($mysqli));
> $temp2 = mysqli_fetch_array($temp2) or die(mysqli_error($mysqli));
>
> This query doesn't work (though it throws no errors). Only when I change
> the "<" to "<=" does the script work. Why doesn't the less than operator
> work?
What datatype is daydue? Why are you enclosing numbers (247 and 100)
in quotes? >> Stay informed about: Error with in SQL |
|
| Back to top |
|
 |  |
External

Since: Jul 16, 2007 Posts: 17
|
(Msg. 3) Posted: Sun Sep 02, 2007 8:56 pm
Post subject: Re: Error with < in SQL [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
"ZeldorBlat" wrote in message
> On Sep 2, 4:42 pm, "Matthew White" wrote:
>> I have started using the new mysql_* extensions. Here is the code I am
>> trying to run:
>> $temp2 = "SELECT * FROM assignments2 WHERE daydue < '247' &&
>> progress !=
>> '100'";
>> $temp2 = mysqli_query($mysqli,$temp2) or
>> die(mysqli_error($mysqli));
>> $temp2 = mysqli_fetch_array($temp2) or
>> die(mysqli_error($mysqli));
>>
>> This query doesn't work (though it throws no errors). Only when I change
>> the "<" to "<=" does the script work. Why doesn't the less than operator
>> work?
>
> What datatype is daydue? Why are you enclosing numbers (247 and 100)
> in quotes?
>
"daydue" is an integer. The numbers are in quotes because that's how I
usually enclose data values in SQL queries, be they numbers or otherwise.
Matt >> Stay informed about: Error with in SQL |
|
| Back to top |
|
 |  |
External

Since: Jun 18, 2007 Posts: 57
|
(Msg. 4) Posted: Mon Sep 03, 2007 2:02 am
Post subject: Re: Error with < in SQL [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On 2 Sep, 21:42, "Matthew White" wrote:
> I have started using the new mysql_* extensions. Here is the code I am
> trying to run:
> $temp2 = "SELECT * FROM assignments2 WHERE daydue < '247' && progress !=
> '100'";
> $temp2 = mysqli_query($mysqli,$temp2) or die(mysqli_error($mysqli));
> $temp2 = mysqli_fetch_array($temp2) or die(mysqli_error($mysqli));
>
> This query doesn't work (though it throws no errors). Only when I change
> the "<" to "<=" does the script work. Why doesn't the less than operator
> work?
"This query doesn't work",
Very helpful this, very discriptive!
What precisely doesn't work about it? Do you just get no data output?
If so, please post some of the output from when it does "work". >> Stay informed about: Error with in SQL |
|
| Back to top |
|
 |  |
External

Since: Jun 18, 2007 Posts: 57
|
(Msg. 5) Posted: Mon Sep 03, 2007 5:35 am
Post subject: Re: Error with < in SQL [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On 3 Sep, 13:10, "Matthew White" wrote:
> "Captain Paralytic" wrote in message
>
>
>
>
>
>
>
> > On 2 Sep, 21:42, "Matthew White" wrote:
> >> I have started using the new mysql_* extensions. Here is the code I am
> >> trying to run:
> >> $temp2 = "SELECT * FROM assignments2 WHERE daydue < '247' &&
> >> progress !=
> >> '100'";
> >> $temp2 = mysqli_query($mysqli,$temp2) or
> >> die(mysqli_error($mysqli));
> >> $temp2 = mysqli_fetch_array($temp2) or
> >> die(mysqli_error($mysqli));
>
> >> This query doesn't work (though it throws no errors). Only when I change
> >> the "<" to "<=" does the script work. Why doesn't the less than operator
> >> work?
>
> > "This query doesn't work",
> > Very helpful this, very discriptive!
> > What precisely doesn't work about it? Do you just get no data output?
> > If so, please post some of the output from when it does "work".
>
> When it fails, it just returns a blank page, disregarding all other code
> below it. If it completes, it will display the names and dates of all
> assignments that are overdue.- Hide quoted text -
>
> - Show quoted text -
It can't return a blank page. It is a query. It returns a data
resourse.
Now I asked you to "please post some of the output from when it does
"work"."
Instead you told me about the data that the program displays on a web
page (I assume).
Now can you please post some of the output FROM THE QUERY! >> Stay informed about: Error with in SQL |
|
| Back to top |
|
 |  |
External

Since: Jul 16, 2007 Posts: 17
|
(Msg. 6) Posted: Mon Sep 03, 2007 9:56 am
Post subject: Re: Error with < in SQL [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
"Captain Paralytic" wrote in message
> On 2 Sep, 21:42, "Matthew White" wrote:
>> I have started using the new mysql_* extensions. Here is the code I am
>> trying to run:
>> $temp2 = "SELECT * FROM assignments2 WHERE daydue < '247' &&
>> progress !=
>> '100'";
>> $temp2 = mysqli_query($mysqli,$temp2) or
>> die(mysqli_error($mysqli));
>> $temp2 = mysqli_fetch_array($temp2) or
>> die(mysqli_error($mysqli));
>>
>> This query doesn't work (though it throws no errors). Only when I change
>> the "<" to "<=" does the script work. Why doesn't the less than operator
>> work?
>
> "This query doesn't work",
> Very helpful this, very discriptive!
> What precisely doesn't work about it? Do you just get no data output?
> If so, please post some of the output from when it does "work".
>
When it fails, it just returns a blank page, disregarding all other code
below it. If it completes, it will display the names and dates of all
assignments that are overdue. >> Stay informed about: Error with in SQL |
|
| Back to top |
|
 |  |
External

Since: Jul 16, 2007 Posts: 17
|
(Msg. 7) Posted: Mon Sep 03, 2007 11:57 am
Post subject: Re: Error with < in SQL [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
"Captain Paralytic" wrote in message
> On 3 Sep, 13:10, "Matthew White" wrote:
>> "Captain Paralytic" wrote in message
>>
>>
>>
>>
>>
>>
>>
>> > On 2 Sep, 21:42, "Matthew White" wrote:
>> >> I have started using the new mysql_* extensions. Here is the code I
>> >> am
>> >> trying to run:
>> >> $temp2 = "SELECT * FROM assignments2 WHERE daydue < '247' &&
>> >> progress !=
>> >> '100'";
>> >> $temp2 = mysqli_query($mysqli,$temp2) or
>> >> die(mysqli_error($mysqli));
>> >> $temp2 = mysqli_fetch_array($temp2) or
>> >> die(mysqli_error($mysqli));
>>
>> >> This query doesn't work (though it throws no errors). Only when I
>> >> change
>> >> the "<" to "<=" does the script work. Why doesn't the less than
>> >> operator
>> >> work?
>>
>> > "This query doesn't work",
>> > Very helpful this, very discriptive!
>> > What precisely doesn't work about it? Do you just get no data output?
>> > If so, please post some of the output from when it does "work".
>>
>> When it fails, it just returns a blank page, disregarding all other code
>> below it. If it completes, it will display the names and dates of all
>> assignments that are overdue.- Hide quoted text -
>>
>> - Show quoted text -
>
> It can't return a blank page. It is a query. It returns a data
> resourse.
>
> Now I asked you to "please post some of the output from when it does
> "work"."
>
> Instead you told me about the data that the program displays on a web
> page (I assume).
>
> Now can you please post some of the output FROM THE QUERY!
The query returns a mysqli_result object, then stalls on the
mysqli_fetch_array. This results in a blank page. If I removed the <, the
query returns the same object, and returns an array after
mysqli_fetch_array. That's the only ouput. >> Stay informed about: Error with in SQL |
|
| Back to top |
|
 |  |
External

Since: Dec 01, 2003 Posts: 397
|
(Msg. 8) Posted: Mon Sep 03, 2007 11:57 am
Post subject: Re: Error with < in SQL [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Captain Paralytic wrote:
> On 3 Sep, 13:10, "Matthew White" wrote:
>>>> I have started using the new mysql_* extensions. Here is the code I am
>>>> trying to run:
>>>> $temp2 = "SELECT * FROM assignments2 WHERE daydue < '247' &&
>>>> progress !=
>>>> '100'";
>>>> $temp2 = mysqli_query($mysqli,$temp2) or
>>>> die(mysqli_error($mysqli));
>>>> $temp2 = mysqli_fetch_array($temp2) or
>>>> die(mysqli_error($mysqli));
Matthew, don't reuse variables in that manner, suddenly the variable with the
query is the variable containing the resource. You make your own code a lot
harder to follow, specially when you haven't looked on it for a while, you
will never know what the $temp2 will be when you jump down to line 100 and
have to fix some error you got.
$mysqli = new mysqli('server','login','pass','database');
$temp2 = "SELECT * FROM assignments2 WHERE daydue < 247 && progress <> 100";
$res=$mysqli->query($temp2);
if($mysqli->error) {
echo $mysqli->error;
flush();
ob_flush();
exit;
}
flush();
ob_flush();
$row=$res->fetch_array();
flush();
ob_flush();
>>>> This query doesn't work (though it throws no errors). Only when I change
>>>> the "<" to "<=" does the script work. Why doesn't the less than operator
>>>> work?
>>> "This query doesn't work",
>>> Very helpful this, very discriptive!
>>> What precisely doesn't work about it? Do you just get no data output?
>>> If so, please post some of the output from when it does "work".
>> When it fails, it just returns a blank page, disregarding all other code
>> below it. If it completes, it will display the names and dates of all
>> assignments that are overdue.- Hide quoted text -
>>
>> - Show quoted text -
>
> It can't return a blank page. It is a query. It returns a data
> resourse.
His script dies somewhere on the page before it's finished, so there is no
flushing of the output buffer, which makes the page to appear as an empty page.
The solution is to use flush()/ob_flush() after each thing done on the page,
this will then show the last thing that happens before the error, which will
make things a lot easier to fix, when you know where in the code you will be next.
Had this problem myself a couple of days ago, had gladly turned off the
buffering in php.ini, if it hadn't been that some of the older php scripts
will stop working as someone hasn't been smart enough when designing it and
had headers sent after outputs.
--
//Aho >> Stay informed about: Error with in SQL |
|
| Back to top |
|
 |  |
External

Since: Dec 01, 2003 Posts: 397
|
(Msg. 9) Posted: Mon Sep 03, 2007 11:57 am
Post subject: Re: Error with < in SQL [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Matthew White wrote:
> "Captain Paralytic" wrote in message
>> Now can you please post some of the output FROM THE QUERY!
>
> The query returns a mysqli_result object, then stalls on the
> mysqli_fetch_array. This results in a blank page. If I removed the <,
> the query returns the same object, and returns an array after
> mysqli_fetch_array. That's the only ouput.
I think Paul will be happy if you would tell what happens if you run that
query directly on the mysql server (use the terminal frontend mysql and cut
and paste the query).
--
//Aho >> Stay informed about: Error with in SQL |
|
| Back to top |
|
 |  |
External

Since: Dec 12, 2006 Posts: 238
|
(Msg. 10) Posted: Tue Sep 04, 2007 10:51 am
Post subject: Re: Error with < in SQL [Login to view extended thread Info.] Imported from groups: per prev. post (more info?)
|
|
|
|
|
| Back to top |
|
 |  |
External

Since: Jul 16, 2007 Posts: 17
|
(Msg. 11) Posted: Wed Sep 05, 2007 8:56 pm
Post subject: Re: Error with < in SQL [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
"J.O. Aho" wrote in message
> Matthew White wrote:
>> "Captain Paralytic" wrote in message
>
>>> Now can you please post some of the output FROM THE QUERY!
>>
>> The query returns a mysqli_result object, then stalls on the
>> mysqli_fetch_array. This results in a blank page. If I removed the <,
>> the query returns the same object, and returns an array after
>> mysqli_fetch_array. That's the only ouput.
>
> I think Paul will be happy if you would tell what happens if you run that
> query directly on the mysql server (use the terminal frontend mysql and
> cut
> and paste the query).
>
>
> --
>
> //Aho
PHPMyAdmin returns:
Showing rows 0 - 0 (1 total, Query took 0.0163 sec)
and one row that fits the description. It seems to be a problem exclusively
with mysqli_fetch_array. >> Stay informed about: Error with in SQL |
|
| Back to top |
|
 |  |
External

Since: Jul 16, 2007 Posts: 17
|
(Msg. 12) Posted: Wed Sep 05, 2007 11:27 pm
Post subject: Re: Error with < in SQL [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
"Tom" wrote in message
> On Mon, 03 Sep 2007 16:09:42 +0200, J.O. Aho wrote...
>>
>>Matthew White wrote:
>>> "Captain Paralytic" wrote in message
>>
>>>> Now can you please post some of the output FROM THE QUERY!
>>>
>>> The query returns a mysqli_result object, then stalls on the
>>> mysqli_fetch_array. This results in a blank page. If I removed the <,
>>> the query returns the same object, and returns an array after
>>> mysqli_fetch_array. That's the only ouput.
>>
>>I think Paul will be happy if you would tell what happens if you run that
>>query directly on the mysql server (use the terminal frontend mysql and
>>cut
>>and paste the query).
>>
>>
>
>
> Sometimes that's the more direct and easier way for checking your MySQL
> syntax.
> : )
>
> Tom
> --
> Newsguy.com
> Basic Accounts $5.95 / month or $39.95 / 12 months
> http://newsguy.com/overview.htm
>
PHPMyAdmin returns the row when I use this query. It must be a problem with
mysqli_fetch_array. >> Stay informed about: Error with in SQL |
|
| Back to top |
|
 |  |
External

Since: Jun 18, 2007 Posts: 57
|
(Msg. 13) Posted: Thu Sep 06, 2007 1:42 am
Post subject: Re: Error with < in SQL [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On 6 Sep, 00:27, "Matthew White" wrote:
> "J.O. Aho" wrote in message
>
>
>
>
>
>
>
> > Matthew White wrote:
> >> "Captain Paralytic" wrote in message
>
> >>> Now can you please post some of the output FROM THE QUERY!
>
> >> The query returns a mysqli_result object, then stalls on the
> >> mysqli_fetch_array. This results in a blank page. If I removed the <,
> >> the query returns the same object, and returns an array after
> >> mysqli_fetch_array. That's the only ouput.
>
> > I think Paul will be happy if you would tell what happens if you run that
> > query directly on the mysql server (use the terminal frontend mysql and
> > cut
> > and paste the query).
>
> > --
>
> > //Aho
>
> PHPMyAdmin returns:
>
> Showing rows 0 - 0 (1 total, Query took 0.0163 sec)
>
> and one row that fits the description. It seems to be a problem exclusively
> with mysqli_fetch_array.- Hide quoted text -
>
> - Show quoted text -
But by the time you get to use mysqli_fetch_array, the query is
finished with, so how can the < in the query be making the difference? >> Stay informed about: Error with in SQL |
|
| Back to top |
|
 |  |
| Related Topics: | query error - how can i fix this? Errore query SQL : CREATE TABLE `tags` ( `tag_link_id` int(11) NOT NULL default '0', `tag_lang` varchar(4) NOT NULL default 'en', `tag_date` timestamp NOT NULL, `tag_words` varchar(64) NOT NULL default '', UNIQUE KEY..
msql 3.7 in php 5.1 error... - Hi. I am attempting to get msql3 installed with php. Using php version php5.1-200604070430 and msql-3.7. I am getting the following error on compile. /usr/lib/gcc/x86_64-pc-linux-gnu/3.4.6/../../../../x86_64-pc-linux-gnu/bin/ld: ..
Foreign key error - Why does creating the following table give me the error: ERROR 1005 (HY000): Can't create table (errno: 150) CREATE TABLE orderProducts ( orderID integer(10), productID integer(10), quantity integer(10), PRIMARY KEY (orderID, productID), FOREIGN KEY..
Error message levels - My message levels are turned up too high and the one that installed php for me is new to it. I need to have them turned down some. I get the following message from a simple query: Warning: mssql_pconnect() [function.mssql-pconnect]: message: Cannot....
MySQL bug? or user error? - I've come across what I believe is a bug in MySQL or some schizophrenic behavior in it. I tested the following on three versions of mysql: Linux, MySQL 5.0.18 Mac MySQL 5.0.15 64 bit Mac MySQL 5.0.24a 64 bit I have a table of articles that have... |
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|
 |
|
|