PHP.SU

Программирование на PHP, MySQL и другие веб-технологии
PHP.SU Портал     На главную страницу форума Главная     Помощь Помощь     Поиск Поиск     Поиск Яндекс Поиск Яндекс     Вакансии  Пользователи Пользователи

Страниц (1): [1]

> Найдено сообщений: 1
Jackie Отправлено: 30 Мая, 2016 - 03:16:32 • Тема: Не заполняется бд • Форум: SQL и Архитектура БД

Ответов: 1
Просмотров: 34
Что не так с кодом, почему вводимые в поля значения не записываются в бд?
CODE (htmlphp):
скопировать код в буфер обмена
  1.  
  2.  <?php
  3.        ini_set('display_errors', 0);
  4.            $host = "localhost";
  5.            $user = "root";
  6.            $db = "imcody";
  7.  
  8.            mysql_connect($host,$user,'') or die(mysql_error());
  9.            mysql_select_db($db) or die();
  10.  
  11.            if(isset($_POST['submit'])){
  12.                $full_name = $_POST['full_name'];
  13.                $email = $_POST['email'];
  14.                $password = $_POST['password'];
  15.                $repeat = $_POST['repeat'];
  16.                if($password == $repeat){
  17.                    $password=md5($password);
  18.                    $query = mysql_query($db, "INSERT INTO user (full_name, email, password) VALUES (0,'".$_POST['full_name']."','".$_POST['email']."','".$_POST['password']."')") or die(mysql_error());
  19.                }else{
  20.                    die('Password must match!');
  21.                }
  22.            }
  23.        ?>
  24.  
  25.         <form action="registration.php" method="post" style='margin: auto; width: 300px;'>
  26.             <ul>
  27.                 <li> <input type="text" name="full_name" placeholder=" | Full name" required style=" marging-buttom:10px; height:25px; width: 300px" /></li>
  28.                 <li><input type="text" name="email" placeholder=" | Email" requred style="height:25px; width: 300px" /></li>
  29.                 <li><input type="password" name="password" placeholder=" | Password" required style="height:25px; width: 300px" /></li>
  30.                 <li><input type="password" name="repeat" placeholder=" | Repeat password" required style="height:25px; width: 300px" /></li>
  31. <li><input type="submit" name="submit" value="Ok &#9996;" class="button" style=" margin: auto; width: 220px; padding:20px 20px; " /></li>
  32.             </ul>
  33.         </form>
  34.  
  35.  
  36.  

Страниц (1): [1]
Powered by PHP  Powered By MySQL  Powered by Nginx  Valid CSS  RSS

 
Powered by ExBB FM 1.0 RC1. InvisionExBB