Closed Thread Icon

Topic awaiting preservation: Sessions and SQL (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=12781" title="Pages that link to Topic awaiting preservation: Sessions and SQL (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Sessions and SQL <span class="small">(Page 1 of 1)</span>\

 
Trigger
Paranoid (IV) Inmate

From:
Insane since: Jun 2002

posted posted 06-10-2003 22:51

In tryigto run a sql statement
it being

SELECT * FROM users WHERE username = $_POST[usermame]

and it woudlnt work it told me a invalid sql resource was used in mysql_fetch_array and so I ran mysql_error() to find that the sql statement was treating 'username' there as the variable $username which contains the username of the person currently logged in via array I set earlier.. I dont have acsses to set Globals off which should fix the problem.

so I was wondering if anyone else had a solution
i orginaly thought icould set $username =NUll but this cuases all sorts of problems elsewhere

anwyay any help would be appreciated as always

Thanks
Trigger

DL-44
Maniac (V) Inmate

From: under the bed
Insane since: Feb 2000

posted posted 06-10-2003 23:38

Try putting the variable in quotes -

"SELECT * FROM users WHERE username = '$_POST[username]'"

I will also often set things ahead of time for ease of use later, such as -

$username = $_POST['username'];

and then use

"SELECT * FROM users WHERE username = '$username'"

[This message has been edited by DL-44 (edited 06-10-2003).]

« BackwardsOnwards »

Show Forum Drop Down Menu