473,400 Members | 2,145 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,400 software developers and data experts.

UPDATE query appears to complete but nothing changes in data

Greetings:

I have an UPDATE query (php 5.1.6/mysql 5.0.24a on apache 2.2) that
appears to execute with no errors (php,mysql, or apache) but the data in
the "UPDATED" table doesn't change. I've checked privileges for
connecting account and that isn't an issue. Maybe it's my query:

$editO = "
UPDATE organization
SET
orgname = '$name',
office = '$off',
address1 = '$add1',
address2 = '$add2',
city = '$city',
state = '$state',
country = '$country',
zip = '$ZIP',
phone1 = '$phone1',
phone2 = '$phone2',
fax = '$fax',
email = '$email',
website = '$website',
notes = '$notes',
lasteditdate = '$lastedit',
publish = '$pub',
updatedby = '$uname'
WHERE org_id = '$orgid'";

include_once 'dsn.php';
$res=mysql_query($editO)
or die('Query Failed: ' . mysql_error());

I've shuffled it around to get rid of whitespace to no effect. Any
advice is appreciated.

--

Regards,

Jeff Gardner
___________________________

"Contrary to popular belief, Unix is user friendly. It just happens
to be very selective about who its friends are." --Kyle Hearn
Sep 11 '06 #1
9 1712
One

Jeff Gardner wrote:
Greetings:

I have an UPDATE query (php 5.1.6/mysql 5.0.24a on apache 2.2) that
appears to execute with no errors (php,mysql, or apache) but the data in
the "UPDATED" table doesn't change. I've checked privileges for
connecting account and that isn't an issue. Maybe it's my query:

$editO = "
UPDATE organization
SET
orgname = '$name',
office = '$off',
address1 = '$add1',
address2 = '$add2',
city = '$city',
state = '$state',
country = '$country',
zip = '$ZIP',
phone1 = '$phone1',
phone2 = '$phone2',
fax = '$fax',
email = '$email',
website = '$website',
notes = '$notes',
lasteditdate = '$lastedit',
publish = '$pub',
updatedby = '$uname'
WHERE org_id = '$orgid'";

include_once 'dsn.php';
$res=mysql_query($editO)
or die('Query Failed: ' . mysql_error());

I've shuffled it around to get rid of whitespace to no effect. Any
advice is appreciated.
Can you echo out the statment being processed and post it as well ?

Sep 11 '06 #2
One wrote:
Jeff Gardner wrote:
>Greetings:

I have an UPDATE query (php 5.1.6/mysql 5.0.24a on apache 2.2) that
appears to execute with no errors (php,mysql, or apache) but the data in
the "UPDATED" table doesn't change. I've checked privileges for
connecting account and that isn't an issue. Maybe it's my query:

$editO = "
UPDATE organization
SET
orgname = '$name',
office = '$off',
address1 = '$add1',
address2 = '$add2',
city = '$city',
state = '$state',
country = '$country',
zip = '$ZIP',
phone1 = '$phone1',
phone2 = '$phone2',
fax = '$fax',
email = '$email',
website = '$website',
notes = '$notes',
lasteditdate = '$lastedit',
publish = '$pub',
updatedby = '$uname'
WHERE org_id = '$orgid'";

include_once 'dsn.php';
$res=mysql_query($editO)
or die('Query Failed: ' . mysql_error());

I've shuffled it around to get rid of whitespace to no effect. Any
advice is appreciated.

Can you echo out the statment being processed and post it as well ?
It's from a form that is pre-populated with existing data:

$org = trim($_POST['name']);
$off = trim($_POST['off']);
$ad1 = trim($_POST['add1']);
$ad2 = trim($_POST['add2']);
$city = trim($_POST['city']);
$state = trim($_POST['state']);
$country = trim($_POST['country']);
$zip = trim($_POST['ZIP']);
$phone1 = trim($_POST['phone1']);
$phone2 = trim($_POST['phone2']);
$fax = trim($_POST['fax']);
$email = trim($_POST['email']);
$website = trim($_POST['website']);
$cleanNotes = htmlspecialchars($_POST['notes']);
$notes = trim($cleanNotes);
$lastedit = date ('D \t\h\e jS \of M Y \@ h:i:s a T');
$pub = trim($_POST['pub']);

--

Regards,

Jeff Gardner
___________________________

"Contrary to popular belief, Unix is user friendly. It just happens
to be very selective about who its friends are." --Kyle Hearn
Sep 11 '06 #3
One

Jeff Gardner wrote:
One wrote:
Jeff Gardner wrote:
Greetings:

I have an UPDATE query (php 5.1.6/mysql 5.0.24a on apache 2.2) that
appears to execute with no errors (php,mysql, or apache) but the data in
the "UPDATED" table doesn't change. I've checked privileges for
connecting account and that isn't an issue. Maybe it's my query:

$editO = "
UPDATE organization
SET
orgname = '$name',
office = '$off',
address1 = '$add1',
address2 = '$add2',
city = '$city',
state = '$state',
country = '$country',
zip = '$ZIP',
phone1 = '$phone1',
phone2 = '$phone2',
fax = '$fax',
email = '$email',
website = '$website',
notes = '$notes',
lasteditdate = '$lastedit',
publish = '$pub',
updatedby = '$uname'
WHERE org_id = '$orgid'";

include_once 'dsn.php';
$res=mysql_query($editO)
or die('Query Failed: ' . mysql_error());

I've shuffled it around to get rid of whitespace to no effect. Any
advice is appreciated.
Can you echo out the statment being processed and post it as well ?
It's from a form that is pre-populated with existing data:

$org = trim($_POST['name']);
$off = trim($_POST['off']);
$ad1 = trim($_POST['add1']);
$ad2 = trim($_POST['add2']);
$city = trim($_POST['city']);
$state = trim($_POST['state']);
$country = trim($_POST['country']);
$zip = trim($_POST['ZIP']);
$phone1 = trim($_POST['phone1']);
$phone2 = trim($_POST['phone2']);
$fax = trim($_POST['fax']);
$email = trim($_POST['email']);
$website = trim($_POST['website']);
$cleanNotes = htmlspecialchars($_POST['notes']);
$notes = trim($cleanNotes);
$lastedit = date ('D \t\h\e jS \of M Y \@ h:i:s a T');
$pub = trim($_POST['pub']);
Well - if we could see the insert statment that would heklp.
Check your field lengths - see if yuo're trying to insert too much data
into a particular field.
Check the date format for the lastedit field.

Sep 11 '06 #4
One wrote:
Jeff Gardner wrote:
>One wrote:
>>Jeff Gardner wrote:
Greetings:

I have an UPDATE query (php 5.1.6/mysql 5.0.24a on apache 2.2) that
appears to execute with no errors (php,mysql, or apache) but the data in
the "UPDATED" table doesn't change. I've checked privileges for
connecting account and that isn't an issue. Maybe it's my query:

$editO = "
UPDATE organization
SET
orgname = '$name',
office = '$off',
address1 = '$add1',
address2 = '$add2',
city = '$city',
state = '$state',
country = '$country',
zip = '$ZIP',
phone1 = '$phone1',
phone2 = '$phone2',
fax = '$fax',
email = '$email',
website = '$website',
notes = '$notes',
lasteditdate = '$lastedit',
publish = '$pub',
updatedby = '$uname'
WHERE org_id = '$orgid'";

include_once 'dsn.php';
$res=mysql_query($editO)
or die('Query Failed: ' . mysql_error());

I've shuffled it around to get rid of whitespace to no effect. Any
advice is appreciated.
Can you echo out the statment being processed and post it as well ?
It's from a form that is pre-populated with existing data:

$org = trim($_POST['name']);
$off = trim($_POST['off']);
$ad1 = trim($_POST['add1']);
$ad2 = trim($_POST['add2']);
$city = trim($_POST['city']);
$state = trim($_POST['state']);
$country = trim($_POST['country']);
$zip = trim($_POST['ZIP']);
$phone1 = trim($_POST['phone1']);
$phone2 = trim($_POST['phone2']);
$fax = trim($_POST['fax']);
$email = trim($_POST['email']);
$website = trim($_POST['website']);
$cleanNotes = htmlspecialchars($_POST['notes']);
$notes = trim($cleanNotes);
$lastedit = date ('D \t\h\e jS \of M Y \@ h:i:s a T');
$pub = trim($_POST['pub']);

Well - if we could see the insert statment that would heklp.
Check your field lengths - see if yuo're trying to insert too much data
into a particular field.
Check the date format for the lastedit field.
apologies... here is the statement that initially creates the record.
It executes just fine. The variables are derived from the same
arguments as the UPDATE variables.

$newOrgIns = "INSERT INTO organization
(org_id,orgname,office,address1,address2,city,stat e,country,zip,phone1,phone2,fax,email,website,note s,lasteditdate,createdate,createdby,publish,update dby)

VALUES
('','$org','$off','$ad1','$ad2','$city','$state',' $country','$zip','$phone1','$phone2','$fax','$emai l','$website','$notes','$lastedit','$lastupdate',' $uname','$pub','$uname')";
include_once 'dsn.php';
$res=mysql_query($newOrgIns)
or die('Query Failed: ' . mysql_error());;

--

Regards,

Jeff Gardner
___________________________

"Contrary to popular belief, Unix is user friendly. It just happens
to be very selective about who its friends are." --Kyle Hearn
Sep 11 '06 #5
Jeff Gardner wrote:
One wrote:
>Jeff Gardner wrote:
>>Greetings:

I have an UPDATE query (php 5.1.6/mysql 5.0.24a on apache 2.2) that
appears to execute with no errors (php,mysql, or apache) but the
data in the "UPDATED" table doesn't change. I've checked
privileges for connecting account and that isn't an issue. Maybe
it's my query: $editO = "
UPDATE organization
SET
orgname = '$name',
office = '$off',
address1 = '$add1',
address2 = '$add2',
city = '$city',
state = '$state',
country = '$country',
zip = '$ZIP',
phone1 = '$phone1',
phone2 = '$phone2',
fax = '$fax',
email = '$email',
website = '$website',
notes = '$notes',
lasteditdate = '$lastedit',
publish = '$pub',
updatedby = '$uname'
WHERE org_id = '$orgid'";

include_once 'dsn.php';
$res=mysql_query($editO)
or die('Query Failed: ' . mysql_error());

I've shuffled it around to get rid of whitespace to no effect. Any
advice is appreciated.

Can you echo out the statment being processed and post it as well ?
It's from a form that is pre-populated with existing data:

$org = trim($_POST['name']);
$off = trim($_POST['off']);
$ad1 = trim($_POST['add1']);
$ad2 = trim($_POST['add2']);
$city = trim($_POST['city']);
$state = trim($_POST['state']);
$country = trim($_POST['country']);
$zip = trim($_POST['ZIP']);
$phone1 = trim($_POST['phone1']);
$phone2 = trim($_POST['phone2']);
$fax = trim($_POST['fax']);
$email = trim($_POST['email']);
$website = trim($_POST['website']);
$cleanNotes = htmlspecialchars($_POST['notes']);
$notes = trim($cleanNotes);
$lastedit = date ('D \t\h\e jS \of M Y \@ h:i:s a T');
$pub = trim($_POST['pub']);
Isn't some "must be escaped" character in some $_POST[] field? Some stupid
characters are:
" ' ; \ @

--
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your mail
from another non-spammer site please.)
Sep 11 '06 #6
Petr Vileta wrote:
Jeff Gardner wrote:
>One wrote:
>>Jeff Gardner wrote:
Greetings:

I have an UPDATE query (php 5.1.6/mysql 5.0.24a on apache 2.2) that
appears to execute with no errors (php,mysql, or apache) but the
data in the "UPDATED" table doesn't change. I've checked
privileges for connecting account and that isn't an issue. Maybe
it's my query: $editO = "
UPDATE organization
SET
orgname = '$name',
office = '$off',
address1 = '$add1',
address2 = '$add2',
city = '$city',
state = '$state',
country = '$country',
zip = '$ZIP',
phone1 = '$phone1',
phone2 = '$phone2',
fax = '$fax',
email = '$email',
website = '$website',
notes = '$notes',
lasteditdate = '$lastedit',
publish = '$pub',
updatedby = '$uname'
WHERE org_id = '$orgid'";

include_once 'dsn.php';
$res=mysql_query($editO)
or die('Query Failed: ' . mysql_error());

I've shuffled it around to get rid of whitespace to no effect. Any
advice is appreciated.

Can you echo out the statment being processed and post it as well ?
It's from a form that is pre-populated with existing data:

$org = trim($_POST['name']);
$off = trim($_POST['off']);
$ad1 = trim($_POST['add1']);
$ad2 = trim($_POST['add2']);
$city = trim($_POST['city']);
$state = trim($_POST['state']);
$country = trim($_POST['country']);
$zip = trim($_POST['ZIP']);
$phone1 = trim($_POST['phone1']);
$phone2 = trim($_POST['phone2']);
$fax = trim($_POST['fax']);
$email = trim($_POST['email']);
$website = trim($_POST['website']);
$cleanNotes = htmlspecialchars($_POST['notes']);
$notes = trim($cleanNotes);
$lastedit = date ('D \t\h\e jS \of M Y \@ h:i:s a T');
$pub = trim($_POST['pub']);
Isn't some "must be escaped" character in some $_POST[] field? Some
stupid characters are:
" ' ; \ @
All input is shot through mysql_escape_string. The same data INSERTS
properly.

--

Regards,

Jeff Gardner
___________________________

"Contrary to popular belief, Unix is user friendly. It just happens
to be very selective about who its friends are." --Kyle Hearn
Sep 11 '06 #7
Jeff Gardner wrote:
Petr Vileta wrote:
>Jeff Gardner wrote:
>>One wrote:
Jeff Gardner wrote:
Greetings:
>
I have an UPDATE query (php 5.1.6/mysql 5.0.24a on apache 2.2) that
appears to execute with no errors (php,mysql, or apache) but the
data in the "UPDATED" table doesn't change. I've checked
privileges for connecting account and that isn't an issue. Maybe
it's my query: $editO = "
UPDATE organization
SET
orgname = '$name',
office = '$off',
address1 = '$add1',
address2 = '$add2',
city = '$city',
state = '$state',
country = '$country',
zip = '$ZIP',
phone1 = '$phone1',
phone2 = '$phone2',
fax = '$fax',
email = '$email',
website = '$website',
notes = '$notes',
lasteditdate = '$lastedit',
publish = '$pub',
updatedby = '$uname'
WHERE org_id = '$orgid'";
>
include_once 'dsn.php';
$res=mysql_query($editO)
or die('Query Failed: ' . mysql_error());
>
I've shuffled it around to get rid of whitespace to no effect. Any
advice is appreciated.

Can you echo out the statment being processed and post it as well ?

It's from a form that is pre-populated with existing data:

$org = trim($_POST['name']);
$off = trim($_POST['off']);
$ad1 = trim($_POST['add1']);
$ad2 = trim($_POST['add2']);
$city = trim($_POST['city']);
$state = trim($_POST['state']);
$country = trim($_POST['country']);
$zip = trim($_POST['ZIP']);
$phone1 = trim($_POST['phone1']);
$phone2 = trim($_POST['phone2']);
$fax = trim($_POST['fax']);
$email = trim($_POST['email']);
$website = trim($_POST['website']);
$cleanNotes = htmlspecialchars($_POST['notes']);
$notes = trim($cleanNotes);
$lastedit = date ('D \t\h\e jS \of M Y \@ h:i:s a T');
$pub = trim($_POST['pub']);
Isn't some "must be escaped" character in some $_POST[] field? Some
stupid characters are:
" ' ; \ @
All input is shot through mysql_escape_string. The same data INSERTS
properly.
Could it be something simple like the mysql_autocommit() is set off?

--
Thanks in Advance...
IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
Sep 11 '06 #8
IchBin wrote:
Jeff Gardner wrote:
>Petr Vileta wrote:
>>Jeff Gardner wrote:
One wrote:
Jeff Gardner wrote:
>Greetings:
>>
>I have an UPDATE query (php 5.1.6/mysql 5.0.24a on apache 2.2) that
>appears to execute with no errors (php,mysql, or apache) but the
>data in the "UPDATED" table doesn't change. I've checked
>privileges for connecting account and that isn't an issue. Maybe
>it's my query: $editO = "
>UPDATE organization
>SET
>orgname = '$name',
>office = '$off',
>address1 = '$add1',
>address2 = '$add2',
>city = '$city',
>state = '$state',
>country = '$country',
>zip = '$ZIP',
>phone1 = '$phone1',
>phone2 = '$phone2',
>fax = '$fax',
>email = '$email',
>website = '$website',
>notes = '$notes',
>lasteditdate = '$lastedit',
>publish = '$pub',
>updatedby = '$uname'
>WHERE org_id = '$orgid'";
>>
>include_once 'dsn.php';
>$res=mysql_query($editO)
>or die('Query Failed: ' . mysql_error());
>>
>I've shuffled it around to get rid of whitespace to no effect. Any
>advice is appreciated.
>
Can you echo out the statment being processed and post it as well ?
>
It's from a form that is pre-populated with existing data:

$org = trim($_POST['name']);
$off = trim($_POST['off']);
$ad1 = trim($_POST['add1']);
$ad2 = trim($_POST['add2']);
$city = trim($_POST['city']);
$state = trim($_POST['state']);
$country = trim($_POST['country']);
$zip = trim($_POST['ZIP']);
$phone1 = trim($_POST['phone1']);
$phone2 = trim($_POST['phone2']);
$fax = trim($_POST['fax']);
$email = trim($_POST['email']);
$website = trim($_POST['website']);
$cleanNotes = htmlspecialchars($_POST['notes']);
$notes = trim($cleanNotes);
$lastedit = date ('D \t\h\e jS \of M Y \@ h:i:s a T');
$pub = trim($_POST['pub']);
Isn't some "must be escaped" character in some $_POST[] field? Some
stupid characters are:
" ' ; \ @
All input is shot through mysql_escape_string. The same data INSERTS
properly.

Could it be something simple like the mysql_autocommit() is set off?
Apparently, since org_id is of a numeric data type, the variable $orgid
does not need to be quoted in the UPDATE query.

--

Regards,

Jeff Gardner
___________________________

"Contrary to popular belief, Unix is user friendly. It just happens
to be very selective about who its friends are." --Kyle Hearn
Sep 12 '06 #9
Just typing:

echo $editO;

Should have given you your answer pretty fast, echoing what is really
being executed is often the best way to debug SQL issues.

Sep 12 '06 #10

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

Similar topics

8
by: Perre Van Wilrijk | last post by:
Hello, I have 2 ways of updating data I'm using often 1) via a cursor on TABLE1 update fields in TABLE2 2) via an some of variables ... SELECT @var1=FLD1, @var2=FLD2 FROM TABLE1 WHERE...
9
by: Dom Boyce | last post by:
Hi First up, I am using MS Access 2002. I have a database which records analyst rating changes for a list of companies on a daily basis. Unfortunately, the database has been set up (by my...
4
by: deko | last post by:
I'm a little nervous about slamming my database with a dozen Update queries in a loop that all modify RecordSources of open forms. Will the use of DoEvents and/or a Sleep function ameliorate any...
8
by: Maxi | last post by:
There is a lotto system which picks 21 numbers every day out of 80 numbers. I have a table (name:Lotto) with 22 fields (name:Date,P1,P2....P21) Here is the structure and sample data: ...
3
by: Greg Strong | last post by:
Hello All, Is the only solution to an update query which requires the records in a certain order to dump the records into a temp table in the required order, then do the update query? I've...
15
by: graham | last post by:
Hi all, <bitching and moaning section> I am asking for any help I can get here... I am at the end of my tether... I don;t consider myself a genius in any way whatsoever, but I do believe I have...
7
by: Jean Christophe Avard | last post by:
Hi! I have a dataset that retreive all the item information from the database. I need to be able to edit them, in the dataset and in the database. I have this code, could anyone tell me if I'm...
30
by: Charles Law | last post by:
Here's one that should probably have the sub-heading "I'm sure I asked this once before, but ...". Two users are both looking at the same data, from a database. One user changes the data and...
4
by: eBob.com | last post by:
In my class which contains the code for my worker thread I have ... Public MustInherit Class Base_Miner #Region " Delegates for accessing main UI form " Delegate Sub DelegAddProgressBar(ByVal...
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.