MySQL Queries w/ Arrays problem
Posted: Tue Dec 24, 2002 9:16 am
Hey,
I am writing a login script for a program of mine. In the environment I was testing I had PHP 4.0.6, but moving to my clients box, I encountered the standard problem , since he had PHP 4.2.3.
Now, my problem was with the MySQL query. The actual problem was with ""s and ' ' s.
My original code was:
Then I had to use the POST array, which would mean that I would have to make my variables from $username to $_POST['username'] or $_POST["username"], and the same for password. However both of the quotation makrs are used from before, so using them inside the query would get things screwed up (cut the var in half, getting an error).
I know I can change the names of the form objects, so that I don't have to use quotes in the array, but I am sure there's another way.
Thanks in advance,
Xelmepa
I am writing a login script for a program of mine. In the environment I was testing I had PHP 4.0.6, but moving to my clients box, I encountered the standard problem , since he had PHP 4.2.3.
Now, my problem was with the MySQL query. The actual problem was with ""s and ' ' s.
My original code was:
Code: Select all
$query = "SELECT * FROM admins WHERE usr='$username' AND pwd='$password'";I know I can change the names of the form objects, so that I don't have to use quotes in the array, but I am sure there's another way.
Thanks in advance,
Xelmepa