|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
MySQL problem with ASP (about session) (sql query)
Hello I'm paul. From Thailand.
I used to use Access with ASP. Now, I turn to MySQL for better database. It's working well. Until now I have problem with query MySQL. I have to use session("ID") that keep ID value of user who login. Yes, after login session("ID") will hold value such as 1. conn.Open "driver="&mysql&";Server="&servers&";Database="&database&";UID="&user&";Pwd="&password&"; option=3;" sql="select * from ad where ID="&session("ID") set rs = server.createobject("ADODB.RecordSet") rs.cursorlocation = 3 rs.Open sql,conn,1,3 The Error Line is line 2 I try to change to this... ID=session("ID") conn.Open "driver="&mysql&";Server="&servers&";Database="&database&";UID="&user&";Pwd="&password&"; option=3;" sql="select * from ad where ID="&ID It error too But when I try this....... ID=1 conn.Open "driver="&mysql&";Server="&servers&";Database="&database&";UID="&user&";Pwd="&password&"; option=3;" sql="select * from ad where ID="&ID It's no problem But the problem is I have to chage ID to be the ID of user who loged in. So I have to use session("ID") Please Help How to do this case |
|
#2
|
|||
|
|||
|
Does the session("id") have the right information?
Do quick check to make sure your session ID is set correctly or exists. It should work in either way you have it there. &Session("ID") or ID = Session("ID") ( I prefer the variable way, seems less troublesome)
I can't see anything wrong with the syntax (but then again I am a only a basic scripter!) |
|
#3
|
|||
|
|||
|
Hi,
I have also faced the same problem but i came out of it Just change the query in the following format sql="select * from ad where ID="&cstr(session("ID")) Just had the cstr() method to the session id Thats it Fasil |
![]() |
| Viewing: Dev Articles Community Forums > Databases > MySQL Development > MySQL problem with ASP (about session) (sql query) |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|