0

I'm trying to write a script that will send a user to there profile after they register for site iv got a filling that there a problem with the mysqli_query syntax I keep getting error PHP Parse error: syntax error, unexpected '{' Can someone maybe help me with this

<?php
//  set  database  connection
require("dbconfig.php");


//  lets  get  our  posts //

$email = $_POST['email'];
$pass = $_POST['password'];
$bn = $_POST['bandname'];
$state = $_POST['state'];
$genre = $_POST['genre'];
$description = $_POST['description'];
$image = $_FILES['image'];

/// valid  image  types ///

$image_type = array("image/jpg","image/jpeg","image/bmp","image/gif","image/png");


///  folder  that  will  hold the  image

$imagepath = "images/";


$imagepath .= $image["name"];


// move the  file from the tmp  folder to the  image  folder

if (move_uploaded_file($image['tmp_name'], $imagepath)){

$foo = `mogrify -quality 92 -scale 500x $imagepath`;    
}   



 //  insert  data into mysql 

if (!mysqli_query($ms,"insert into dbusers (email, password, bandname, state, genre,  description ,image)

    values ('$email','$pass','$bn ','$state','$genre','$description','".$image['name']    . "')" ){

     }else {    

     $id=mysqli_insert_id($sql);// Get the associated ID number

                               // Set up a login session
    session_start();
    $_SESSION ['id'       ] = $id;
    $_SESSION ['bandname' ] = $bandname;
    $_SESSION ['password' ] = $password;
    header("Location:ympprofile.php?listid=$id");  
 }    
?>  
  • You are missing a closing `)` on the `if (!mysqli_query...` line. That's the first thing I spot visually - there may be others. – Michael Berkowski Dec 07 '14 at 19:05
  • Please read over [How can I prevent SQL injection in PHP](http://stackoverflow.com/questions/60174/how-can-i-prevent-sql-injection-in-php) -- now is the time to begin learning to use `prepare()/bind_param()/execute()` with MySQLi to protect your code (currently vulnerable) from SQL injection. – Michael Berkowski Dec 07 '14 at 19:05

1 Answers1

0

You are missing a closing parentheses.

if (!mysqli_query($ms,"insert into dbusers (email, password, bandname, state, genre,  description ,image)

values ('$email','$pass','$bn ','$state','$genre','$description','".$image['name']    . "')" )
)<------ you were missing this
JJJ
  • 3,314
  • 4
  • 29
  • 43