Forum Moderators: coopster
Here is my code any help would be greatly appriciated
$target = "../Assets/newsletter_attach/";
$target = $target . basename( $_FILES['attach']['name']);
if (isset ($_POST['name']))
{//1
$name = $_POST['name'];
$body = $_POST['body'];
$attach = ($_FILES['attach']['name']);
//$name = stripslashes($name);
//$body = stripslashes($body);
//$nameCHecker = mysqli_real_escape_string($myConnection, $name);
//$nameCHecker = eregi_replace("`", "", $nameCHecker);
$sql_name_check = mysqli_query($myConnection,"SELECT newletter_name FROM newsletters WHERE newletter_name='$name'");
$name_check = mysqli_num_rows($sql_name_check);
if ((!$name) ¦¦ (!$body) ¦¦ (!$attach))
{
$msg = "You have not entered the following information:<br />";
if(!$name){
$msg .= "* Please enter the name of your mailer<br />";
}
if(!$body) {
$msg .= "* Please enter the body for your mailer<br />";
}
if(!$attach) {
$msg .= "* Please attach an image for your mailer<br />";
}
else if($name_check > 0){
$msg = "The name for your emailer already exists, Please change emailer name & try again.";
}
else {
$sql = mysqli_query($myConnection,"INSERT INTO newsletters (newletter_name, body, attach) VALUES ('$name', '$body', '$attach')") or die (mysqli_error($myConnection));
$movefile = (move_uploaded_file($_FILES['attach']['tmp_name'], $target));
$msg = "Your new emailer " $name " has been uploaded, you can now select this mailer to send to users";
}
}
}
?>
Insert that echo query straight into a mysql shell and see if it returns an error.
(mysqli_error($myConnection));