Results 1 to 1 of 1
I dont know what I do wrong..
But well this is how my code looks:
Code:
mysql_connect($place_db,$user_db,$passwd_db); //Connect to the MySQL database
@mysql_select_db($db) or die( "Unable to select database");
mysql_query($query);
...
- 11-22-2007 #1
PHP + MySQL + My Knowledge = Fail
I dont know what I do wrong..
But well this is how my code looks:
So, he connect to the Databse and before he calls the Function proceed_login() he makes the $db var a Array of MySQL Data.Code:mysql_connect($place_db,$user_db,$passwd_db); //Connect to the MySQL database @mysql_select_db($db) or die( "Unable to select database"); mysql_query($query); $sql="SELECT * FROM members WHERE name='$name' and passwd='$passwd'"; $result=mysql_query($sql); $count=mysql_num_rows($result); if($count==1){ $sql = mysql_query("SELECT * FROM members WHERE name='$name' and passwd='$passwd'") or die(mysql_error()); $db = mysql_fetch_array( $sql ); proceed_login();
So, well that works fine. I tested it and it works.
But now comes the weird part.
That function is declared earlyer in the code.
And here the code is:
It does not give any error.Code:<? function proceed_login ( ) { if($db['active'] != "yes") {//This users account is NOT active... Die die("Account not active."); } $today = getdate(); if($db['expdate'] <= $today[10]) // Check Unix DateStamp
So the $db string exist. The code comes there since I tested it..
So I thought Id check my mySQL database.
I did open phpMyAdmin.
Got to the right databse
and yea it was there.
So, why doesnt that work?
cheers,
Robin
Edit:
Ok, Im a moron, I forgot to make the $db variable Global or Parse it..
I fixed it -.-'


Reply With Quote