bravo14 Posted October 17, 2010 Share Posted October 17, 2010 Hi Guys I am getting a parse error from the following code <?php session_start(); ?> <?php include_once('includes/connect.php'); ?> <?php if($_POST['submit']) { foreach($_POST as $key=>$val){ $$key=mysql_real_escape_string($val); } } ?> <?php //check whether email already registered $check_email_sql=mysql_query("SELECT * FROM `tbl_users` WHERE `email_address`='$email'"); if(mysql_num_rows($check_email_sql)==0) { $add_user=mysql_query("INSERT into `tbl_users` (`email_address`,`password`,`forename`,`surname`,`usertype`) values('$email',md5('$password'),'$forename','$surname','supplier')"); $check_add_user_sql=mysql_query("SELECT * FROM `tbl_users` WHERE `email_address`='$email'"); if(mysql_num_rows($check_add_user_sql)>0) { //upload logo // Your file name you are uploading $file_name = $logo; // random 4 digit to add to our file name // some people use date and time in stead of random digit $random_digit=rand(0000,9999); //combine random digit to you file name to create new file name //use dot (.) to combile these two variables $new_file_name=$random_digit.$file_name; //set where you want to store files //in this example we keep file in folder upload //$new_file_name = new upload file name //for example upload file name cartoon.gif . $path will be upload/cartoon.gif $path= "logos/".$new_file_name; if($ufile !=none) { if(copy($HTTP_POST_FILES['ufile']['tmp_name'], $path)) { echo "Successful<BR/>"; //$new_file_name = new file name //$HTTP_POST_FILES['ufile']['size'] = file size //$HTTP_POST_FILES['ufile']['type'] = type of file echo "File Name :".$new_file_name."<BR/>"; echo "File Size :".$HTTP_POST_FILES['ufile']['size']."<BR/>"; echo "File Type :".$HTTP_POST_FILES['ufile']['type']."<BR/>"; } else { echo "Error"; } } //add supplier info $user_id=$check_add_user_sql['user_id']; $add_supplier=mysql_query("INSERT into `tbl_providers` (`user_id`,`provider_name`,`address1`,`address2`,`address3`,`address4`,`post_code`,`website`,`phone_number`,`email`,`fax_number`,`about`,`logo`) VALUES ('$user_id','$business','$address1','$address2','$address3','$address4','$postcode','$website','$phone','$email','$fax','$about','$new_file_name')"); //add categories to tbl_provider_categories $add_cat_1=mysql_query("INSERT into `tbl_provider_categories` (`user_id`,`cat_id`) VALUES ('$user_id','$category1')"); $add_cat_2=mysql_query("INSERT into `tbl_provider_categories` (`user_id`,`cat_id`) VALUES ('$user_id','$category2')"); $add_cat_4=mysql_query("INSERT into `tbl_provider_categories` (`user_id`,`cat_id`) VALUES ('$user_id','$category3')"); $add_cat_4=mysql_query("INSERT into `tbl_provider_categories` (`user_id`,`cat_id`) VALUES ('$user_id','$category4')"); $add_cat_5=mysql_query("INSERT into `tbl_provider_categories` (`user_id`,`cat_id`) VALUES ('$user_id','$category5')"); } else { header('Location: index.php'); exit; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/template.dwt.php" codeOutsideHTMLIsLocked="false" --> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- InstanceBeginEditable name="doctitle" --> <title>Wedding Buddy | Help make your big day special</title> <!-- InstanceEndEditable --> <link href="css/buddy.css" rel="stylesheet" type="text/css" /> <script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script> <link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" /> <!-- InstanceBeginEditable name="head" --> <!-- InstanceEndEditable --> </head> <body> <div align="center"> <div id="container"> <div id="header"> <div id="login"> <?php if(!isset($_SESSION['auth'])) { echo('<form name="login" method="post" action="newlogin.php"> <input name="username" type="text" width="30" value="Username" /> <input name="password" type="text" width="30" value="Password" /> <input name="submit" type="submit" value="Login" /> </form> Don\'t have an account <a href="register.php" title="Register Here">register here</a>'); } else { echo('<input name="logout" type="button" value="Logout" onClick="logout();" />'); } ?> </div> <img src="images/bridegroom.jpg" /></div> <div id="menu"> <?php if(isset($_SESSION['usertype'])) { if($_SESSION['usertype']="wedding") { include_once('includes/wedding_menu_inc.php'); } elseif ($_SESSION['usertype']="supplier") { include_once('includes/supplier_menu_inc.php'); } else { include_once('includes/standard_menu_inc.php'); } } ?> <script type="text/javascript"> <!-- var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"}); //--> </script> </div> <div id="maintext"><p> </p><!-- InstanceBeginEditable name="maintext" --> <?php if (isset($message)) { echo($message); } ?> <!-- InstanceEndEditable --> </div> </div> </body> <!-- InstanceEnd --></html> I am trying to create user details in one table, upload a logo and add further details into another table, I am not sure if I have approached it in the correct method. The error message is saying Parse error: parse error in C:\wamp\www\wedding_buddy\new_supplier.php on line 150, this is the last line of code. Any ideas or tips for a better way of achieving what I want to do. Quote Link to comment https://forums.phpfreaks.com/topic/216110-parse-error/ Share on other sites More sharing options...
jcbones Posted October 17, 2010 Share Posted October 17, 2010 You are missing the closing bracket on one of your if statements. I think it is if($ufile !=none) { But am not 100% sure. Quote Link to comment https://forums.phpfreaks.com/topic/216110-parse-error/#findComment-1123126 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.