You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right [closed]

StackOverflow https://stackoverflow.com/questions/23627378

Question

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 ''users' VALYES('','users')' at line 1

I use phpMyAdmin Version information: 4.2.0 (up to date).

But I have : The phpMyAdmin configuration storage is not completely configured, some extended features have been deactivated. To find out why click here.

Open new phpMyAdmin window

Your configuration file contains settings (root with no password) that correspond to the default MySQL privileged account. Your MySQL server is running with this default, is open to intrusion, and you really should fix this security hole by setting a password for user 'root'.

My code is :

<?php 

$connect = mysql_connect('localhost','root','') or die(mysql_error());
mysql_select_db('Happydate_db');
if (isset($_POST['submit']))
$users = $_POST['users'];
$query = mysql_query("INSERT INTO users VALYES('',`users`)")or die(mysql_error())

?>
<form method="post" action="signup.php">
<input  type="text" name="users" placeholder= " | users" required/> <br>
<input  type="submit" name="submit" value="signup" />
</form>

What it can be?

Was it helpful?

Solution

It is not VALYES. It is VALUES

 $query = mysql_query("INSERT INTO users VALUES('','users')")or die(mysql_error())

For reference http://www.w3schools.com/sql/sql_insert.asp

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top