Re: Is this the best way?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Mar 14, 2008, at 5:03 PM, TG wrote:




----- Original Message -----
From: Jason Pruim <japruim@xxxxxxxxxx>
To: TG <tg-php@xxxxxxxxxxxxxxxxxxxxxx>
Cc: "PHP General List" <php-general@xxxxxxxxxxxxx>
Date: Fri, 14 Mar 2008 14:56:32 -0400
Subject: Re:  Is this the best way?


On Mar 14, 2008, at 1:44 PM, TG wrote:


What error are you getting?  Maybe there's some way to fix that too.

The error I get without checking the row count is this:

You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near 'order by LName' at line 1

Ok so the next thing to check is your query. Maybe echo it out so you can
see what's actually attempting to execute.

echo from my actual query
SELECT * FROM current WHERE loginName='japruim' AND loginPassword='mybadpassword' LIMIT 0,1;


I don't see an "ORDER BY" in the SQL listed below.

The ORDER BY actually comes from a different query that should ONLY be done AFTER successful login... It's actually related to the sorting of the records that should be retrieved.


Usually when I get errors like this, it's because a variable I expect to be
populated isn't and it messes up the SQL by leaving a blank where it
expects something.

SELECT * FROM users WHERE username = 'tg' ORDER BY LName

If I had:

$user = "'tg'"

with the single-quotes inside the variable.. if I typo'd on $user and did
something like:

$query = "SELECT * FROM users WHERE username = $usr ORDER BY LName";

Then I'd get:

SELECT * FROM users WHERE username = ORDER BY LName

--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
japruim@xxxxxxxxxx




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux