[PHP] Stumped Newbie: Can't get results in db query even though everything checks - what am I missing?

2001-03-08 Thread Nicole Lallande

Greetings,

I keep getting the message that I cannot get results.  I have a simple
user authentication code that uses a mysql database to authenticate
from.  Initially I had the code working when I had the mysql_connect
variables in the code itself.  When I moved the connection variables to
an include file and then called them as variables, it was necessary to
change the variable names in the database (both were initially
$username, $password).  Now, while I have the connection and opening the
db correct I can't get results.  Here is my code:

require("connect.inc.php");

$connection = mysql_connect("$hostname","$username","$password") or die
("Unable to connect to database.");
echo "I'm connected.br";
**__A-OK here

mysql_select_db("dnaUsers") or die ("Unable to select database.");
echo "I've opened the dnaUsers db.br";
echo "$ruser, $rpassbr"; //this is from the html login form
**__Yup, no problem so far - 

// Formulate the query  
$sql = "SELECT rep_name FROM reps WHERE username='$ruser' and
password='$rpass'";
// Execute the query and put the results in $result
$result = mysql_query($sql,$connection) or die ("Couldn't get
results.");  

**__Here it is - crash and burn - the database name is correct, the
fields are correct, the username and password are in the db and have
been input correctly and are even being passed from the form correctly. 

I have checked the names of all the fields to ensure they match the
variables in the query, checked that the values in the fields are
correct -  (yes, I have checked that they match.) 

I have searched the archives but the hard thing about the archives is
formulating the question in a way that will yield an answer.  Sorry if
this has been asked before.

TIA,

Nicole
-- 

Nicole Lallande
[EMAIL PROTECTED]
760.753.6766


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Stumped Newbie: Can't get results in db query even though everything checks - what am I missing?

2001-03-08 Thread Nicole Lallande

Greetings,

I keep getting the message that I cannot get results.  I have a simple
user authentication code that uses a mysql database to authenticate
from.  Initially I had the code working when I had the mysql_connect
variables in the code itself.  When I moved the connection variables to
an include file and then called them as variables, it was necessary to
change the variable names in the database (both were initially
$username, $password).  Now, while I have the connection and opening the
db correct I can't get results.  Here is my code:

require("connect.inc.php");

$connection = mysql_connect("$hostname","$username","$password") or die
("Unable to connect to database.");
echo "I'm connected.br";
**__A-OK here

mysql_select_db("dnaUsers") or die ("Unable to select database.");
echo "I've opened the dnaUsers db.br";
echo "$ruser, $rpassbr"; //this is from the html login form
**__Yup, no problem so far - 

// Formulate the query  
$sql = "SELECT rep_name FROM reps WHERE username='$ruser' and
password='$rpass'";
// Execute the query and put the results in $result
$result = mysql_query($sql,$connection) or die ("Couldn't get
results.");  

**__Here it is - crash and burn - the database name is correct, the
fields are correct, the username and password are in the db and have
been input correctly and are even being passed from the form correctly. 

I have checked the names of all the fields to ensure they match the
variables in the query, checked that the values in the fields are
correct -  (yes, I have checked that they match.) 

I have searched the archives but the hard thing about the archives is
formulating the question in a way that will yield an answer.  Sorry if
this has been asked before.

TIA,

Nicole


-- 

Nicole Lallande
[EMAIL PROTECTED]
760.753.6766


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Stumped Newbie: Can't get results in db query even though everything checks - what am I missing?

2001-03-08 Thread Joe Sheble (Wizaerd)


I'd start by adding the mysql_error() function in your die() statement...
$result = mysql_query($sql,$connection) or die ("Couldn't get results: " . 
mysql_error());

it might give more information to help you find the problem...

At 10:15 AM 3/8/01 -0800, Nicole Lallande wrote:
Greetings,

I keep getting the message that I cannot get results.  I have a simple
user authentication code that uses a mysql database to authenticate
from.  Initially I had the code working when I had the mysql_connect
variables in the code itself.  When I moved the connection variables to
an include file and then called them as variables, it was necessary to
change the variable names in the database (both were initially
$username, $password).  Now, while I have the connection and opening the
db correct I can't get results.  Here is my code:

require("connect.inc.php");

$connection = mysql_connect("$hostname","$username","$password") or die
("Unable to connect to database.");
echo "I'm connected.br";
**__A-OK here

mysql_select_db("dnaUsers") or die ("Unable to select database.");
echo "I've opened the dnaUsers db.br";
echo "$ruser, $rpassbr"; //this is from the html login form
**__Yup, no problem so far -

// Formulate the query
$sql = "SELECT rep_name FROM reps WHERE username='$ruser' and
password='$rpass'";
// Execute the query and put the results in $result
$result = mysql_query($sql,$connection) or die ("Couldn't get
results.");

**__Here it is - crash and burn - the database name is correct, the
fields are correct, the username and password are in the db and have
been input correctly and are even being passed from the form correctly.

I have checked the names of all the fields to ensure they match the
variables in the query, checked that the values in the fields are
correct -  (yes, I have checked that they match.)

I have searched the archives but the hard thing about the archives is
formulating the question in a way that will yield an answer.  Sorry if
this has been asked before.

TIA,

Nicole
--

Nicole Lallande
[EMAIL PROTECTED]
760.753.6766


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]