error in mysql syntax

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
m2babaey
Forum Contributor
Posts: 364
Joined: Sun May 20, 2007 9:26 am

error in mysql syntax

Post by m2babaey »

Hi
I can't understand why this code is sending error:

Code: Select all

<?php
mysql_connect('localhost','root','');
mysql_select_db('hameddb');
$name="Javad";
$fn="Ali";
$shsh="11542";
$mc="0794956912";
$age="20";
$cm="bichare";
mysql_query("INSERT INTO `details` (name, father_name, shsh, mellicode, age, comments) VALUSE ('$name', '$fn' ,'$shsh', '$mc', '$age', '$cm')") or die(mysql_error()) ;
?>
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 'VALUSE ('Javad', 'Ali' ,'11542', '0794956912', '20', 'bichare')'
waqas_punjabian
Forum Commoner
Posts: 67
Joined: Wed Aug 10, 2005 9:53 am

Post by waqas_punjabian »

You have error in here:

Code: Select all

VALUSE ('$name', '$fn' ,'$shsh', '$mc', '$age', '$cm')")
use VALUES intead of VALUSE


cheers
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

It should be "VALUES".
(#10850)
tansoft
Forum Newbie
Posts: 12
Joined: Sun Jul 29, 2007 1:04 am

Post by tansoft »

there is a spelling mistake ... use "values"
Post Reply