Hello! Trying to learn the language of PHP. I slowed down adding records to MySQL via html form. Html form:

<?php include_once "header.php"?> <?php include_once "menu.php"?> <?php include_once "leftblock.php"?> <div class="content" <form aсtion="/connect.php" method="post"> <label>Логин: </label> <input type="text" name="Pоle1" placeholder="Логин"><br> <label>Пароль:</label> <input type="password" name="Pоle2" placeholder="Пароль"><br> <label>Повторите пароль:</label> <input type="password" name="Pоle3" placeholder="Повторите пароль"><br> <label>Введите телефон:</label> <input type="tel" name="Pole4" placeholder=введите ваш телефон> <input type="submit" name="submit" value="Регистрация"> </form> </div> <?php include_once "footer.php"?> 

php form:

 <?php $host = "localhost"; $user = "host1435288"; $password = "225a32a8"; $db = "host1435288_wwwnvr"; $connect = mysql_connect($host, $user, $password) or die ('error'); $select_db = mysql_select_db($db) or die ('error');?> <?php $i=$_POST['Pоle1']; $f=$_POST['Pоle2']; $n=$_POST['Pоle3']; $o=$_POST['Pоle4']; $link = mysql_pconnect("localhost","root","") or die ("Невозможно подключение к MySQL"); mysql_select_db("dog") or die ("Невозможно открыть таблицу с данными"); $query = ("INSERT INTO prepod (Pole1,Pole2,Pole3,Pole2) VALUES ('".$i."', '".$f."', '".$n."', '".$o."')"); mysql_query ( $query ); if ($query == 'true') echo "Добавлено в базу данных."; mysql_close ($link); ?> 
mySql:

MySql

I can not understand what the error is.

  • 2
    First of all, throw out the textbook in which you have deducted it all, and find something newer - Ipatyev
  • Yes, I agree with the comment @ Ipatiev The fact that you are now trying to study a long time ago is outdated. Better time to stop. - ilyaplot
  • one
    Maybe a person has a learning task to do something with mysql_* . For the general purposes of studying the principles incl. Web programming is not important final technology, PDO will be there or something else. better to question - teran
  • on a subject, execution of request through mysql_query demands two parameters. the first is the query string, the second is the connection. So the code should be $result = mysql_query($query, $link) . After that, you in $result will have true/false depending on the execution. to compare $query with the string "true" generally meaningless, because in $query you have the query text, and the string "true" is not at all in business. So if($result){ ... } - teran
  • one
    @teran I have always assumed that the local inhabitants with the logic of disagreement, but that is so ... - Ipatiev

0