Hi.
I'm new to php and mysql. I appreciate any help getting this result into a variable...
I wrote the INSERT code on another page, and it works fine. I can see it work in phpMyAdmin. Now that I'm able to create an account for someone to then login, why can't I get that result back out? I know it's probably something simple, but I can't find a tutorial that addresses mysql_result() clearly. By clearly, I mean break it down like you're talking to a 'tarded third grader.
Once I can get these results to display by echoing them out on the page, I can go back to trying to compare them.
<?php
session_start();
include 'config.php';
include 'opendb.php';
$user = $_POST['user'];
$pass = $_POST['pass'];
$user = mysql_real_escape_string($user);
$pass = mysql_real_escape_string($pass);
$getuser =("SELECT user FROM users WHERE user=\'$user\'");
$getpass =("SELECT pass FROM users WHERE pass=\'$pass\'");
if (!$getuser) {
die('Could not query getuser:' . mysql_error());
}
if (!$getpass) {
die('Could not query getpass:' . mysql_error());
}
//I think my problem is here I tried $user_result = mysql_result($getuser, 0);
//which should return the first record, right? It didn't work either...
//I have also tried several variations of these
//none of which have worked...
$user_result = mysql_result($getuser);
$pass_result = mysql_result($getpass);
if (!user_result) {
die('No user result');
}//if this does not stop it...
if (!pass_result) {
die('No pass result');
}//and this does not stop it...
echo $user_result;
echo $pass_result;
//why don't these echo out?
include 'closedb.php';
?>