Witam, mam problem z insertem z mojego kodu, wydaje mi się że jest poprawny.
Połaczenie z bazą jest OK, tabela post dodana a w niej kolumny z identycznymi nazwami.
W rezultacie po submicie mam tylko info że zapytanie niepoprawne a w bazie nie ma danych z formularza.
<html>
<head>
</head>
<body>
<form method="post" action="ins_post.php" enctype="multipart/form-data">
<table width="600" align="center" border="5px">
<tr>
<td align="center" colspan="4px" ><h2> Dodaj Post</h2></td>
</tr>
<tr>
<td>Tytul</td>
<td><input type="text" name="tytul"></td>
</tr>
<tr>
<td>Keywords</td>
<td><input type="text" name="keywords"></td>
</tr>
<tr>
<td>Zawartość</td>
<td><textarea rows="25" cols="50" name="content"></textarea></td>
</tr>
<tr>
<td>Obrazek</td>
<td><input type="file" name="img"></td>
</tr>
<tr>
<td>Autor</td>
<td><input type="text" name="autor"></td>
</tr>
<tr>
<td>Miasto</td>
<td><input type="text" name="miasto"></td>
</tr>
<tr>
<td><input type="submit" name="submit" value="Submit" /></td>
</tr>
</form>
</body>
</html>
<?php include("./config_mysql.php");
if(isset($_POST['submit'])){ $post_tytul = $_POST['tytul'];
$post_keywords = $_POST['keywords'];
$post_content = $_POST['content'];
$post_data = date('d-m-y'); $post_autor = $_POST['autor'];
//$post_img = $_FILES['img']['name'];
//$img_tmp = $_FILES['img']['tmp_name'];
$post_miasto = $_POST['miasto'];
if($post_tytul=='' or $post_keywords=='' or $post_autor=='' or $post_content=='' or $post_miasto=='')
{
echo("<script>confirm('Wpisz wartości!')</script>"); }
else {
//move_uploaded_file($img_tmp,"/img/$post_img");
// kolumny wpisane bez `- również zapytanie niepoprawne
$insert_query = "INSERT INTO post (`post_tytul`,`post_autor`,`post_keywords`,`post_content`,`post_data`,`post_
miasto`) VALUES ('$post_tytul','$post_autor'.'$post_keywords','$post_content','$post_data','$post_miasto')";
echo ("<center><h1>Dodano wpis !</h1></center>"); }
}
}
?>