#1064 - 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 'where id='29'' at line 4
insert into supplier_details
set supplier_tempid='scacsscacsa', name='naman gupta gupta', type='dvsvds',sex='male',
pno='scaasc', postno='12345', mobile='sacevw', email='ewvdv', language='ewvdvwe', service='fwvdv',
country='sdvdvsvds', registered='Yes', address1='2979 sec-32 A chandigarh road', region='ewv qecsdv',
community='cdsdcdsv', about='hello', comment='vdsdsvewv' where id='29'
INSERT
query not work with where condition. you should use UPDATE
query.
update supplier_details set supplier_tempid='scacsscacsa', name='naman gupta gupta', type='dvsvds',sex='male', pno='scaasc', postno='12345', mobile='sacevw', email='ewvdv', language='ewvdvwe', service='fwvdv', country='sdvdvsvds', registered='Yes', address1='2979 sec-32 A chandigarh road', region='ewv qecsdv', community='cdsdcdsv', about='hello', comment='vdsdsvewv' where id='29'
That is not how you INSERT
. it is rather an UPDATE
query.
Notice: you have some errors in the query like
language='ewvdvwe,
address1='2979
sec-32 A chandigarh road',
and whereid='29.
All of them missing'
and one of themsec-32 A chandigarh road',
with invalid-
The fix:
UPDATE supplier_details
SET supplier_tempid='scacsscacsa',
name='naman gupta gupta',
type='dvsvds',sex='male',
pno='scaasc',
postno='12345',
mobile='sacevw',
email='ewvdv',
language='ewvdvwe',
service='fwvdv',
country='sdvdvsvds',
registered='Yes',
address1='2979',
sec = '32 A chandigarh road',
region='ewv qecsdv',
community='cdsdcdsv',
about='hello',
comment='vdsdsvewv'
WHERE id='29';
You are mixing insert and update syntaxes. It should be either
insert into supplier_details values('scacsscacsa', 'naman gupta gupta', 'dvsvds','male', 'scaasc', '12345', 'sacevw', 'ewvdv', 'ewvdvwe', 'fwvdv', 'sdvdvsvds', 'Yes', '2979 sec-32 A chandigarh road', 'ewv qecsdv', 'cdsdcdsv', 'hello', 'vdsdsvewv')
or
update supplier_details set supplier_tempid='scacsscacsa', name='naman gupta gupta', type='dvsvds',sex='male', pno='scaasc', postno='12345', mobile='sacevw', email='ewvdv', language='ewvdvwe', service='fwvdv', country='sdvdvsvds', registered='Yes', address1='2979 sec-32 A chandigarh road', region='ewv qecsdv', community='cdsdcdsv', about='hello', comment='vdsdsvewv' where id='29'
if you want to insert then the rite format is.
<?php
$dbc = mysqli_connect("localhost","username","password","database name");
$string = "INSERT INTO table_name(id, firstname, lastname) VALUES($_POST[id],$_POST[firstname],$_POST[lastname])";
$query = mysqli_query($dbc, $string);
?>
$_POST['something'] should be equal to name='something' inside the form field
I think this is what you're trying to do:
UPDATE supplier_details SET supplier_tempid='scacsscacsa', name='naman gupta gupta', type='dvsvds',sex='male', pno='scaasc', postno='12345', mobile='sacevw', email='ewvdv', language='ewvdvwe', service='fwvdv', country='sdvdvsvds', registered='Yes', address1='2979 sec-32 A chandigarh road', region='ewv qecsdv', community='cdsdcdsv', about='hello', comment='vdsdsvewv' WHERE id='29';
To change an already existed ROW, you need to use the UPDATE statement.