Ответов: 6 Просмотров: 263
|
Спасибо большое !!
Теперь у меня новый вопрос где-то есть ошибка и не могу её локализовать подскажите пожалуйста, а именно (You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'at line 1server version for the rig' at line 1server version for the rig' at lin' at line 1).
PHP:
скопировать код в буфер обмена
<?PHP if(isset($_POST['close'])) { unset($_SESSION['user']); } if(isset($_SESSION['user'])) { { $title = $_POST['title']; $txt = $_POST['txt']; $ins = "INSERT INTO noticias(title, txt) VALUES('" . $title . "', '" . $txt . "');"; if($_FILES['img']['size'] != 0 && $_FILES['img']['name'] != '') { for($i = 0; count($_FILES['img']['name']) > $i; $i++) { $route = "img/"; $route = $route . $_FILES['img']['name'][$i]; $ins_img = "INSERT INTO image(id_noticia, route) VALUES('" . $last_id . "', '" . $route . "');"; echo $ins_img . '<br>'; } } } ?> <!DOCTYPE html> <html> <head> <link rel="stylesheet" href="style/style.css"> <meta cahrset="utf-8"> <title>Añadir noticia</title> </head> <body> <div id="header"> <h1>Noticias</h1> </div> <div id="nav"> <div id="left"> <ul> <li><a href="index.php">Home</a></li> <li><a href="insert.php">Agregar</a></li> <li><a href="modifity.php">Modificar</a></li> <li><a href="delate.php">Borrar</a></li> <li><a href="admin_users.php">Usuarios</a></li> <li> </li> <li><?PHP echo $_SESSION['user'] . ": 'administrador'";?></li> <li> <form action="<?PHP echo $_SERVER['SCRIPT_NAME'];?>" method="post"> <input type="submit" name="close" value="Cerar secion"> </form> </li> </ul> </div> </div> <div id="content"> <table> <form method="post" action="<?PHP $_SERVER['SCRIPT_NAME']; ?>" enctype="multipart/form-data"> <tr> <td>Títlo: </td> <td><input type="text" name="title" placeholder="Títlo" size="59" maxlength="50"></td> </tr> <tr> <td>Texto de la noticia: </td> <td><textarea name="txt" placeholder="La noticia" cols="50" rows="10" required=""></textarea></td> </tr> <tr> <td>Imagen </td> <td> <tr> <td><input type="file" name="img[]"></td> <td><input type="file" name="img[]"></td> </tr> <tr> <td><input type="file" name="img[]"></td> <td><input type="file" name="img[]"></td> </tr> </td> </tr> <tr> <td><input type="submit" name="set" value="Agregar"></td> </tr> </form> </table> </div> <div id="footer"> <span>Desig dy Eugenio © <?PHP echo $hoy['year'];?></span> </div> </body> </html> <?PHP } else { header("Location: index.php"); } ?>
|