[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cgi-list
Subject:    Re: [CGI] CGI, MySQL-Select
From:       Kevin Smith <KSmith () digitalworkshop ! co ! uk>
Date:       2000-09-26 16:22:49
[Download RAW message or body]

Dear Marcel,

Your syntax should be as follows, remember text fields have to be encased
with single quotes.

$sql = "SELECT user, email FROM mytable WHERE user='$user'";

Regards,

Kevin Smith

-----Original Message-----
From: Marcel [mailto:marcel.tscherkasow@mail.uni-oldenburg.de]
Sent: 26 September 2000 15:26
To: cgi-list@jann.com
Subject: [CGI] CGI, MySQL-Select


Hello,

first I want to thank all, who answered my last question about cgi and
password-protection, especially Bill Luebkert and Maisha Walker!

But here comes the next one:
The cgi-script takes the username and the password on the first page. Then
it
checks, if the person is allowed to use the site or not.  I used htpasswd to
encrypt the password. This works.
   In the next step I try to open the mysql-db to get the emailadress
associatet to the username. I do it as followed:

$sql = "SELECT user, email FROM mytable WHERE user=$user;";

with: $user = param('username');

But the script exits with a syntax error near user. So, how can I fill $user
with the rigt username and how to put in correctly in the $sql?

Thanks
Marcel
-----------------------------------------------------------------
To unsubscribe, send mail to "majordomo@jann.com" with "unsubscribe
cgi-list"
in the body.

CalendarPlus v3.0 with JavaPlus is available NOW!
http://www.calendarplus.com/

The CGI Tips & Tricks website (and archive of the list) is located
at http://perl.jann.com/
-----------------------------------------------------------------
-----------------------------------------------------------------
To unsubscribe, send mail to "majordomo@jann.com" with "unsubscribe cgi-list"
in the body.

CalendarPlus v3.0 with JavaPlus is available NOW!
http://www.calendarplus.com/

The CGI Tips & Tricks website (and archive of the list) is located
at http://perl.jann.com/
-----------------------------------------------------------------

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic