what wrong with this php code?

Joe B

New member
<?php
if ((!isset($_POST['Login_name'])) or (!isset($_POST['Password'])) or (!isset($_POST['First_name'])) or (!isset($_POST['Last_name'])) or (!isset($_POST['Email']))) {
header("Location: login page.html");
exit;
}
$mysqli = mysqli_connect("localhost", "root", "gotenks", "bpa_site");

$sql = "INSERT INTO user_info (usernames, passwords, f_name, l_name, email)
VALUES
('".$_POST['Login_name']."', '".$_POST['Password']."', '".$_POST['First_name']."', '".$_POST['Last_name']."', '".$_POST['Email']."');
$result = mysqli_query($mysqli, $sql) or die(mysqli_error($mysqli));

if (mysqli_num_rows($result) == 1) {
$domain = 'localhost';
setcookie('logged', '1', '/', $domain, false);
$yourname = ".$_POST['First_name'].";
$yourusername = ".$_POST['Login_name'].";

} else {
exit;
}
?>
<html>
<head>
<title>User Login</title>
</head>
<body>
<?php echo Welcome!; ?>
</body>
</html>


Parse error: syntax error, unexpected $end in C:\Program Files\Apache Group\Apache2\htdocs\createaccount.php on line 30

Go.
just a note: I am new to php. however, i do hours of troubleshooting and searching for answers for every error i come accross before asking on sites like this. I dont think there is anything wrong with my syntax. also, from what ive read, this error is often caused by an unclosed loop. from what i can see there is none. as of now im at a complete loss. help would be greatly appreciated.

Thank you.
EDIT: Ah, I see. let me change that stuff...
about the password thing - this is just for a school assignment.

about those errors. i fixed what you said, but now it is saying:

Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given

im not sure what type mysqli_result is supposed to be. i tried putting quotes around the mysqli_query($mysqli, $sql) or die(mysqli_error($mysqli)); and it said:

Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, string given

lol...
 
Back
Top