PHP Server Side Scripting Forum

I am fairly new to php coding, and trying to follow a tutorial on generating login for users and creating members.

The code I have generated doesn't generate any errors, but when I try to login with the username and password it does not acknowledge it, nor if I use an incorrect username/password does it tell me they are incorrect. It seems like it is not reading the table, but it connected.

Anyone have any ideas or can refer me to anywhere that can further shed some light on my issue?

Hi. Looking over your code, it looks like you have a good start. I wouldn't give up on it yet. I usually echo things as I write code to make sure the variables are being passed correctly. And try using mysql_error() after you do a query so you can trouble shoot bad queries. $query_run = mysql_query($query)or die(mysql_error());If($query_run){ do something }//echo the $user_id and the $query_num_rows to make sure they are being set.$user_id = mysql_result($query,0);//no need to specify the 'id' as you already did that in the query.echo $user_id;//if it's empty, something above that line is broken.echo 'User id: '.$user_id;Hope this helps.

Do not forget to filter what user are typing to not be hacked. For example this is a function (includes multiple PHP functions). // my functionfunction MyCustomizedFunction($string){$string = substr($string,0,40); // cut the number of characters$string = strip_tags($string); // get rid of html,php code that may be malicious $string = htmlentities($string); // convert symbols that may be malicious $string = htmlentities($string,ENT_QUOTES);$string = mysql_real_escape_string($string);return $string;}

// here i use the function that i have built$password = MyCustomizedFunction($_POST['password']);