Hey there. Ok well I've got a MySQL database that contains everybody's username, password, first name, surname etc., and I'm trying to retrieve (and print) a user's first and last name going by their username... For example (hiding database details of course):
($curruser and $currpass are already declared from a seperate PHP file when the person logs in)
The problem I'm having is that when it prints $result and $result2, it prints Resource id #4 and Resource id #5 respectively. Does anyone know why it's doing this? Any help would be appreciated
| Code: |
| $db_user = *******
$db_pass = ******* //connect to the DB and select the database $connection = mysql_connect('localhost', $db_user, $db_pass) or die(mysql_error()); mysql_select_db('*******', $connection) or die(mysql_error()); //set up the queries $query = "SELECT first_name FROM users WHERE user_name='$curruser' AND password='$currpass'"; $query2 = "SELECT last_name FROM users WHERE user_name='$curruser' AND password='$currpass'"; //run the queries $result = mysql_query($query, $connection) or die('This ChrisCh Student Network database is temporarily unavailable. Please try again later.'); $result2 = mysql_query($query2, $connection) or die('This ChrisCh Student Network database is temporarily unavailable. Please try again later.'); print $result; print $result2; |
($curruser and $currpass are already declared from a seperate PHP file when the person logs in)
The problem I'm having is that when it prints $result and $result2, it prints Resource id #4 and Resource id #5 respectively. Does anyone know why it's doing this? Any help would be appreciated
