473,387 Members | 1,304 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,387 software developers and data experts.

update syntax

This is misfiring. Anyone see the problem?

mysql_query("UPDATE scfmforening SET scfmpad=$scfmpad, scfmpnm=$scfmpnm,
scfmort=$scfmort, scfmwww=$scfmwww, scfmwww=$scfmwww, scfmept=$scfmept,
scfmkom=$scfmkom WHERE scfmnum=$scfchknum ");

Thanks for any help in this matter.

Garry Jones
Oct 9 '06 #1
5 2271
Garry Jones wrote:
This is misfiring. Anyone see the problem?

mysql_query("UPDATE scfmforening SET scfmpad=$scfmpad, scfmpnm=$scfmpnm,
scfmort=$scfmort, scfmwww=$scfmwww, scfmwww=$scfmwww, scfmept=$scfmept,
scfmkom=$scfmkom WHERE scfmnum=$scfchknum ");

Thanks for any help in this matter.

Garry Jones

all char fields must have it's values enclosed in quotes. That might be
the case

--

B.r.K.o.N.j.A = Bionic Robotic Knight Optimized for Nocturnal Judo and
Assasination
Oct 9 '06 #2
Gary,
This is in the query twice:

scfmwww=$scfmwww, scfmwww=$scfmwww

Is that supposed to be that way?
Garry Jones wrote:
This is misfiring. Anyone see the problem?

mysql_query("UPDATE scfmforening SET scfmpad=$scfmpad, scfmpnm=$scfmpnm,
scfmort=$scfmort, scfmwww=$scfmwww, scfmwww=$scfmwww, scfmept=$scfmept,
scfmkom=$scfmkom WHERE scfmnum=$scfchknum ");

Thanks for any help in this matter.

Garry Jones
Oct 9 '06 #3
Garry Jones wrote:
This is misfiring. Anyone see the problem?

mysql_query("UPDATE scfmforening SET scfmpad=$scfmpad, scfmpnm=$scfmpnm,
scfmort=$scfmort, scfmwww=$scfmwww, scfmwww=$scfmwww, scfmept=$scfmept,
scfmkom=$scfmkom WHERE scfmnum=$scfchknum ");

Thanks for any help in this matter.
Try it with appropriate substitutes for the $variables
outside the PHP script (in a command-line SQL tool)

UPDATE scfXXX set scfYYY=14, scfZZZ=88 WHERE scfKKK=-13;

--
File not found: (R)esume, (R)etry, (R)erun, (R)eturn, (R)eboot
Oct 9 '06 #4
"Pedro Graca" <he****@dodgeit.comskrev i meddelandet
news:sl*******************@ID-203069.user.individual.net...

Try it with appropriate substitutes for the $variables outside the PHP
script (in a command-line SQL tool)

Thanks to all, I was missing a quote in my actuall text, now it is working.

Garry Jones
Sweden
Oct 9 '06 #5
Garry Jones wrote:
This is misfiring. Anyone see the problem?

mysql_query("UPDATE scfmforening SET scfmpad=$scfmpad, scfmpnm=$scfmpnm,
scfmort=$scfmort, scfmwww=$scfmwww, scfmwww=$scfmwww, scfmept=$scfmept,
scfmkom=$scfmkom WHERE scfmnum=$scfchknum ");
Another way to validate SQL commands (the way I most often use) is:

a) instead of putting the command inside the mysql_query() build it
outside
b) check the return value from mysql_query()
c) output an error message and stop the script (or, maybe better,
log the error somewhere and let the user know there was an error)

<?php
// a)
$sql = "UPDATE scfXXX SET scfYYY=$scfZZZ WHERE scfKKK=$scfQQQ";

// b)
$res = mysql_query($sql);

// c)
if (!$res === false) {
// There was an error in the query
exit('Error in [' . $sql . ']: ' . mysql_error());
/* or
mail('m*@somewhere.com', 'SQL Error',
'Error in [' . $sql . ']: ' . mysql_error());
exit('Cannot do that right now. Please try again in a few minutes.');
*/
}

--
File not found: (R)esume, (R)etry, (R)erun, (R)eturn, (R)eboot
Oct 10 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Dave | last post by:
I have 2 tables, one with names, and another with addresses, joined by their CIVICID number (unique to the ADDRESSINFO table) in Oracle. I need to update a field in the NAMEINFO table for a...
14
by: bolidev | last post by:
I'm new to SQL and can't figure out how to update my table (StoreItemStatus) that contains the current status for items in each store (STORE_KEY, ITEM_KEY, STATUS,...). I get updated status info...
17
by: kalamos | last post by:
This statement fails update ded_temp a set a.balance = (select sum(b.ln_amt) from ded_temp b where a.cust_no = b.cust_no and a.ded_type_cd = b.ded_type_cd and a.chk_no = b.chk_no group by...
6
by: HeadScratcher | last post by:
I am trying to speed up my update statements by removing inner select statements. Example: update orders set shipname = (select contactName from customers where customerid = orders.customerID)...
3
by: Jerry | last post by:
Well, here is some weirdness. First, I noticed that I have 2 Set keywords (silly me). so I removed the 2nd "Set" but still got a syntax error. Then I removed the Where clause, and now it works...
5
by: Al | last post by:
Hi, I need to update tables in access 97. The table names have spaces (not my choice). My update fails even though I use the OleDbCommandBuilder. Here is a code I am using myDataAdapter = New...
9
by: zMisc | last post by:
When I try to update record, I kept getting this error: Row cannot be located for updating. Some values may have been changed since it was last read. No other users are accessing the database...
2
by: WU | last post by:
Hallo, mir ist die Update Syntax im SQL bekannt aber für das was ich möchte, reicht mein wissen leider nicht aus. Habe 2 Tabellen mit folgenden Feldern 1. Tabelle: LaufendeNr, Datum 2....
2
by: explode | last post by:
I made nova oledbdataadapter select update insert and delete command and connection veza. dataset is Studenti1data, I made it by the new data source wizard,and made datagridview and bindingsource...
1
by: sibusiso | last post by:
HI Can Any one help I have extra field on a table like FDate, FYear, FMonth, FDay, FDatename I have a triger that I will update this field every time transaction hapened, this field must...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.