0

Really New to PHP and MYSQL learning from youtube videos but am lost to where i went wrong

Worked fine before buy i tried adding in a search bar and now i get Parse error: syntax error, unexpected 'username' (T_STRING) in C:\xampp\htdocs\Registration\index.php on line 25 Anyways Heres The Code <?php mysql_connect("localhost","root","password") or die("could not connect"); mysql_select_db("registration") or die("could not find db"); $output = ''; //collect if(isset($_POST['search'])) { $searchq = $_POST['search']; $query = mysql_query("SELECT * FROM anime WHERE Title '%$searchq%'") or die("Could not search!"); $count = mysql_num_rows($query); if($count == 0){ $output = 'There was no search results!'; }else{ while($row = mysql_fetch_array($query)) { $title = $row['firstname']; $output .= '<div>'.$title.'</div>; } session_start(); if (!isset($_SESSION['username'])) { $_SESSION['msg'] = "You must log in first"; header('location: login.php'); } if (isset($_GET['logout'])) { session_destroy(); unset($_SESSION['username']); header("location: login.php"); } ?> <!DOCTYPE html> <html> <head> <title>Home</title> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <form action="index.php" method="post"> <input type="text" name="search" placeholder="search..."/> <input type="submit" value=">>" /> </form> <?php print("$output");?> <div id="nav"> <div> </div> </div> <div id="content"> <div id="feed"> </div> <div id="temp"> </div> </div> </div> <div class="content"> <!-- notification message --> <?php if (isset($_SESSION['success'])) : ?> <div class="error success" > <h3> <?php echo $_SESSION['success']; unset($_SESSION['success']); ?> </h3> </div> <?php endif ?> <!-- logged in user

30th May 2018, 6:17 AM
Đäřnėł Ţhømpßøñ
Đäřnėł Ţhømpßøñ - avatar
2 ответов
+ 2
You are missing a single quotation mark on line 18 code reads like this: $output .= '<div>'.$title.'</div>; should read like this: $output .= '<div>'.$title.'</div>';
30th May 2018, 6:47 AM
ODLNT
ODLNT - avatar
0
The ODLNT guy really helped me but now am getting Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\Registration\index.php on line 85 This is confusing finding where brackets are missing and quotes am so scared to accidentally remove something and have everything just completely stop working
31st May 2018, 1:53 AM
Đäřnėł Ţhømpßøñ
Đäřnėł Ţhømpßøñ - avatar