forumnz Posted January 27, 2008 Share Posted January 27, 2008 Please please help - getting so frustrated. My script is meant to Email someone (that works), and also is meant to insert data into a db. It won't do the database thing. Please look at my code and help me - thanks so much! <?php $name = $_POST['name']; $business_name = $_POST['business_name']; $emailm = $_POST['email']; $contact = $_POST['contact']; $id = $_POST['id']; include('connectdb.php'); $cemail = "[email protected]"; $headers = "From: $cemail\r\n"; $headers .= "Content-type: text/html\r\n"; include('email.php'); $to = $email; ## Below is for new email $message = "Hello, <br /><br />You have been sent an email regarding " . $business_name . ". <br /><br />Please note, this message has not been screened by FoodFinder staff and FoodFinder is not responsible for it's content.<br /><br />Regards,<br />FoodFinder Staff<br /><br />Submitted Content:<br /><br />Name: " . $name . "<br />Contact: " . $contact . "<br />Message: " . $emailm . ""; $subject = "FoodFinder Contact"; mail($to,$subject,$message,$headers); echo $id . "<br>" . $name . "<br>" . $contact . "<br>" . $emailm . "<br>" . $message; ////////////////// $sql="INSERT INTO submitted_emails (buzzid, name, contact, message, email) VALUES ('$id','$name','$contact','$emailm','$message')"; ?> Thanks, Sam. Link to comment https://forums.phpfreaks.com/topic/88092-please-help-insert-error/ Share on other sites More sharing options...
PHP Monkeh Posted January 27, 2008 Share Posted January 27, 2008 Don't make 2 threads about the same subject please Check your other thread for my reply. Link to comment https://forums.phpfreaks.com/topic/88092-please-help-insert-error/#findComment-450666 Share on other sites More sharing options...
forumnz Posted January 27, 2008 Author Share Posted January 27, 2008 Thanks, but I fixed that error. This error is the DB insert. Pleas help, Sam. Link to comment https://forums.phpfreaks.com/topic/88092-please-help-insert-error/#findComment-450679 Share on other sites More sharing options...
revraz Posted January 27, 2008 Share Posted January 27, 2008 Because you don't do anything with the $sql after you define it. You need a mysql_query($sql) in there. Link to comment https://forums.phpfreaks.com/topic/88092-please-help-insert-error/#findComment-450680 Share on other sites More sharing options...
forumnz Posted January 27, 2008 Author Share Posted January 27, 2008 Still not working? Link to comment https://forums.phpfreaks.com/topic/88092-please-help-insert-error/#findComment-450689 Share on other sites More sharing options...
PHP Monkeh Posted January 27, 2008 Share Posted January 27, 2008 Did you actually do what I suggested in the other post? Because you were getting errors because of apostrophes then, and I don't see any changes in your code: Either addslashes() or mysql_real_escape_string() the strings you're inputting. The reason it'll be generating errors is because you have an apostrophe in one of your inputs somewhere. Do this at your string input stage: <?php $name = mysql_real_escape_string($_POST['name']); // OR $name = addslashes($_POST['name']); ?> Link to comment https://forums.phpfreaks.com/topic/88092-please-help-insert-error/#findComment-450694 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.