You are here: Re: UPDATE query appears to complete but nothing changes in data « PHP Programming Language « IT news, forums, messages
Re: UPDATE query appears to complete but nothing changes in data

Posted by Jeff Gardner on 09/11/06 14:27

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,state,country,zip,phone1,phone2,fax,email,website,notes,lasteditdate,createdate,createdby,publish,updatedby)

VALUES
('','$org','$off','$ad1','$ad2','$city','$state','$country','$zip','$phone1','$phone2','$fax','$email','$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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация