php - MySQL won't connect to database,nighter create username and password -
hello have problem script won't create , connect database in anyform. here code :
<?php $host="fdb4.biz.nf" $username="1373217_users"; $passowrd="1234"; $db_name="1373217_users"; // database name $tbl_name="members"; // table name mysql_connect("$host", "$username", "$passowrd") or die("database not connect"); mysql_select_db("$db_name") or die("database selected not found"); $sql="insert `members` ('user') values ('$_post[username]')"; $username=$_post['username']; $password=$_post['password']; $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); $sql="select * $tbl_name username='$myusername' , password='$mypassword'"; $result=mysql_query($sql); $sql="insert `members` (`username`) values ('{$_post['username']}')"; // mysql_num_row counting table row $count=mysql_num_rows($result); // if result matched $myusername , $mypassword, table row must 1 row if($count==1){ // register $myusername, $mypassword , redirect file "login_success.php" session_register("myusername"); session_register("mypassword"); header("location:login_success.php"); } else { echo "wrong username or password"; } ?>
this login.php , error gave me :
parse error: syntax error, unexpected t_variable in /srv/disk11/1373217/www/tracklist.co.nf/login.php on line 4
could please tell me why ? thanks.
you have syntax error missed putting semicolon after $host statement put this
$host="fdb4.biz.nf";