Note that there are some explanatory texts on larger screens.

plurals
  1. POUnknow php error in sql INSERT INTO
    text
    copied!<p>I have problem in my registration. Look on my code:</p> <pre><code>//player.php &lt;?php session_start(); class Player { var $name; function _construct($name) { $this-&gt;$name = $name; } function CreatePlayer($name, $pass, $mail, $date, $type) { if($_POST['submit']) { $link = mysql_connect("localhost","wewewe", "wewewe"); if(!$con) { die( $return = mysql_error()); } mysql_select_db("wewewe", $con); mysql_query("INSERT INTO USERS (name, pass, mail, date, type) VALUES ('$name', '$pass', '$mail', '$date','$type')"); mysql_close(link); } return $return; } function LoginPlayer($name, $pass) { $link = mysql_connect("localhost","username", "pass"); mysql_select_db("con", $con); $result = mysql_query("SELECT FROM USERS WHERE pass='$pass' AND name='$name'"); $count = mysql_num_rows($result); if($count==1) { $_SESSION['name'] = $name; $_SESSION['logged'] = true; } mysql_close($link); } } ?&gt; //reg.php &lt;html&gt; &lt;form action="log.php" method="post"&gt; Meno: &lt;input type="text" name="meno"&gt; &lt;br&gt; Heslo: &lt;input type="text" name="heslo"&gt; &lt;br&gt; Mail: &lt;input type="text" name="mail"&gt; &lt;br&gt; Date: &lt;input type="text" name="date"&gt; &lt;br&gt; Type: &lt;input type="text" name="type"&gt; &lt;br&gt; &lt;input type="submit"&gt; &lt;br&gt; &lt;/form&gt; &lt;?php include 'player.php'; $name = $_POST['meno']; $pass = $_POST['heslo']; $mail = $_POST['mail']; $date = $_POST['date']; $type = $_POST['type']; $obj = new Player($name); $res = $obj-&gt;CreatePlayer($name, $pass, $mail, $date, $type); if($res==true) { echo "jo!"; } else { echo $res; } ?&gt; </code></pre> <p>My problem is that if I write text to all fields and press ok, my page will restart but without any error message. And when I will look to a database, theres nothing. Why? Can anybody plese help me?</p> <p>EDIT:</p> <pre><code> &lt;?php session_start(); class Player { var $name; function _construct($name) { $this-&gt;$name = $name; } function CreatePlayer($name, $pass, $mail, $date, $type) { if($_POST['submit']) { $con = mysql_connect("localhost","wewewe", "wewewe"); if(!$con) { die( $return = mysql_error()); } mysql_select_db("wewewe", $con); $query = "INSERT INTO USERS (name, pass, mail, date, type) VALUES ('$name', '$pass', '$mail', '$date','$type')"; $retrn = var_dump($query); // SHOWS YOU QUERY STRING mysql_query($query) or die(mysql_error()); // EXECUTES QUERY OR THROWS EXCEPTON (SHOWS ERROR TOO) mysql_close($con); } return $return; } function LoginPlayer($name, $pass) { $link = mysql_connect("localhost","username", "pass"); mysql_select_db("con", $con); $result = mysql_query("SELECT FROM USERS WHERE pass='$pass' AND name='$name'"); $count = mysql_num_rows($result); if($count==1) { $_SESSION['name'] = $name; $_SESSION['logged'] = true; } mysql_close($link); } } ?&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload