Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

What am I missing?

0 views
Skip to first unread message

David Goldstein

unread,
Dec 24, 2009, 12:19:19 PM12/24/09
to
I have a line of code in my PHP that should order results of a query on a
view. Without the "ORDER BY" clause, there is nothing wrong. With it in
the statement, incorrect results are returned from within PHP. I can make
the same query in MySQL and the results are correct.

$sqlSelect = ("SELECT DISTINCT state FROM ".$view." ORDER BY
state ASC");
$resSelect = mysqli_query($sqlConnect, $sqlSelect);
if (!$resSelect) {
$response = "false";
echo $response;
exit;

This is the section of code to which I am referring. Would anyone care to
venture a guess as to why this is not working in the program?

David


Jerry Stuckle

unread,
Dec 24, 2009, 12:49:05 PM12/24/09
to

What do you mean by "incorrect results"? Wrong data? Bad return code?
Program blows up?

Did you try to echo $sqlSelect before the request to see if it's what
you think it is?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstu...@attglobal.net
==================

Peter H. Coffin

unread,
Dec 24, 2009, 1:55:17 PM12/24/09
to

Precisely *what* incorrect results are returning? What does $view
contain? What does $mysqli->error() return?

--
_ o
|/)

David Goldstein

unread,
Dec 24, 2009, 12:19:19 PM12/24/09
to
I have a line of code in my PHP that should order results of a query on a
view. Without the "ORDER BY" clause, there is nothing wrong. With it in
the statement, incorrect results are returned from within PHP. I can make
the same query in MySQL and the results are correct.

$sqlSelect = ("SELECT DISTINCT state FROM ".$view." ORDER BY
state ASC");
$resSelect = mysqli_query($sqlConnect, $sqlSelect);
if (!$resSelect) {
$response = "false";
echo $response;
exit;

This is the section of code to which I am referring. Would anyone care to
venture a guess as to why this is not working in the program?

David


Doug Miller

unread,
Dec 24, 2009, 2:58:07 PM12/24/09
to

It's impossible to venture any meaningful guesses until you tell us what
results you expect to get, and what results you actually get instead.
"Incorrect results are returned" is far too vague for any diagnosis.

Jerry Stuckle

unread,
Dec 24, 2009, 3:18:40 PM12/24/09
to

Did you read any of the responses here so far?

0 new messages