im new to PHP .. just trying some examples ..
i want to return the value "true" after connecting to the database .. but after going into the method "add_to_database()" the value true is not returned ..instead this statement gets printed with the values "INSERT INTO table_users VALUES ('$first','$last','$user','$pass','$mobile','$email')" ...
(Note : the values r added into the database without any problems)
can u tell me what is wrong with my code ? ..thanx
Code: Select all
function is_all_valid(){
if(isset($_POST['but_signin'])){
$fn = check_fname();
$ln = check_lname();
$un = check_uname();
$pas = check_password();
$mob = check_mobile();
$em = check_email();
if($fn == "" & ""== $ln & "" == $un & "" == $pas & "" == $mob & "" == $em){
add_to_database(get_fname(),get_lname(),get_uname(),get_pass(),get_mobile(),get_email());
return "true";
}
else {
return "false";
}
}
else {
return "false";
}
}
function add_to_database($first,$last,$user,$pass,$mobile,$email){
include 'db_connect.php';
$query = "INSERT INTO table_users VALUES ('$first','$last','$user','$pass','$mobile','$email')";
mysql_query($query) or die($query);
}