Re: Is this the best way?

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

 



> > Somehow it is getting to this statement and the variable that you  
> > are using just before the ORDER BY part is empty,  Why don't you  
> > show us that statement.
> 
> Requested statement below:
> 
> $query = "SELECT * from ".$linkauth['table']." order by ".$sortOrder;
> 
> The $linkauth['table'] is returned when the authentication is  
> successful. Otherwise it's not written so that you have to log in to  
> see the contents of the database.


Sorry, havn't had a ton of time to go over mailing list messages recently.   
If I recall, you said that the big issue was that this query shouldn't run 
if the user isn't logged in.  So that would point to an issue with your 
logic before you get to this point.  You might see where you're checking 
for the user being logged in or not and make sure everything is within the 
proper "if" grouping.


This specific query and the reason you're getting that MySQL error is 
probably because when a user isn't logged in, your $linkauth['table'] 
variable is empty.  So what you're getting for a SQL statement is:

SELECT * from  order by <$sortOrder if it's populated>



If you fix your "user is/isn't logged in" conditional statement so it doesn't 
get to this SQL query, then you won't have to worry about this error.

You can also check to make sure $linkauth['table'] has something in it before 
running the query.. skip it if it's empty or has an invalid table name.


-TG

-- 
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