473,396 Members | 1,914 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

php and mysql update

65
Hi All,

Can anybody see anything wrong with the following......its a mysql update query, however when ran (and adding vardump) i get nothing added to the database....

the error is.........


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 '' at line 1 UPDATE tbl_sellers SET propertytype = 'House
', propertyaddress = 'jhgjhgjhg

', propadd2 = 'jhgjhgjgh

', proptown = 'jgjghjgh

', propstatecounty = 'jhgjhgjgh

', proppostzip = 'jghjhgjhg

', propcountry = '

', propbedrooms = 'jhgjhgjhg

', propgarage = 'Yes

', eighteenplus = '

' WHERE ID = 20

the code is

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. session_start();
  3. echo $prop_id = $_SESSION['ID'] . "<br>";
  4. echo $propertytype = $_POST['propertytype'] . "<br>";
  5. echo $propertyaddress = $_POST['propertyaddress'] . "<br>";
  6. echo $propadd2 = $_POST['propadd2'] . "<br>";
  7. echo $proptown = $_POST['proptown'] . "<br>";
  8. echo $propstatecounty = $_POST['propstatecounty'] . "<br>";
  9. echo $proppostzip = $_POST['proppostzip'] . "<br>";
  10. echo $propcountry = $_POST['propcounry'] . "<br>";
  11. echo $propbedrooms = $_POST['propbedrooms'] . "<br>";
  12. echo $propgarage = $_POST['propgarage'] . "<br>";
  13. echo $eighteenplus = $_POST['eighteenplus'] . "<br>";
  14. ?> 
  15. <?php
  16. $host="localhost"; // Host name
  17. $username="user"; // Mysql username
  18. $password="pword"; // Mysql password
  19. $db_name="dbname"; // Database name
  20.  
  21. // Connect to server and select databse.
  22. mysql_connect("$host", "$username", "$password")or die("cannot connect");
  23. mysql_select_db("$db_name")or die("cannot select DB");
  24.  
  25.  
  26.                 $sql = "UPDATE tbl_sellers propertytype = '$propertytype', 
  27.                 propertyaddress = '$propertyaddress', 
  28.                 propadd2 = '$propadd2', 
  29.                 proptown = '$proptown', 
  30.                 propstatecounty = '$propstatecounty', 
  31.                 proppostzip = '$proppostzip', 
  32.                 propcountry = '$propcountry', 
  33.                 propbedrooms = '$propbedrooms', 
  34.                 propgarage = '$propgarage', 
  35.                 eighteenplus = '$eighteenplus'
  36.                 WHERE ID = $prop_id";
  37. $result = mysql_query($sql);
  38. var_dump($result);
  39. echo "thanks";
  40. ?>
  41.  
Feb 3 '10 #1
1 1995
Hi,

You are missing "SET" in your MySQL query -- it should be:
$sql = "UPDATE tbl_sellers SET propertytype = ...
Feb 4 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Reply via newsgroup | last post by:
Folks, When performing an update in mysql (using PHP), can I find out how many records were matched? mysql_affected_rows() won't work... and I have the following problem that I thought I...
5
by: red85 | last post by:
hello i have mysql 4.1 with win2000 SP3, i know that it is only an alpha and i don't know if someone else has already posted this problem: when i execute this sql UPDATE tableX SET...
0
by: M.C. Scheffers | last post by:
Hello all, I'm developing an VB application which uses the SAX parser and ADO VB to insert.update data in in MySQL. The perormance is very bad. If I use the same data and insert/update to a MS...
0
by: Mike Chirico | last post by:
Interesting Things to Know about MySQL Mike Chirico (mchirico@users.sourceforge.net) Copyright (GPU Free Documentation License) 2004 Last Updated: Mon Jun 7 10:37:28 EDT 2004 The latest...
1
by: David | last post by:
Hi, I have a quick question. I have a .asp application in which certain parts, clients can now edit/update/add information to their records in our DB. I basically use an include statement at...
15
by: Cheryl Langdon | last post by:
Hello everyone, This is my first attempt at getting help in this manner. Please forgive me if this is an inappropriate request. I suddenly find myself in urgent need of instruction on how to...
3
by: Juan Antonio Villa | last post by:
Hello, I'm having a problem replicating a simple database using the binary log replication, here is the problem: When the master sends an update to the slave, an example update reads as follows:...
0
by: cwho.work | last post by:
Hi! We are using apache ibatis with our MySQL 5.0 database (using innodb tables), in our web application running on Tomcat 5. Recently we started getting a number of errors relating to...
6
Atli
by: Atli | last post by:
This is an easy to digest 12 step guide on basics of using MySQL. It's a great refresher for those who need it and it work's great for first time MySQL users. Anyone should be able to get...
0
by: silversubey | last post by:
I am trying to convert mssql triggers to mysql. I am very new to Mysql and would like some help with my code. My queries work but there has to be a more efficient way to write them. I would greatly...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.