UPDATE query appears to complete but nothing changes in data

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jeff Gardner

    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_quer y($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
  • One

    #2
    Re: UPDATE query appears to complete but nothing changes in data


    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_quer y($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 ?

    Comment

    • Jeff Gardner

      #3
      Re: UPDATE query appears to complete but nothing changes in data

      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_que ry($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 = htmlspecialchar s($_POST['notes']);
      $notes = trim($cleanNote s);
      $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

      Comment

      • One

        #4
        Re: UPDATE query appears to complete but nothing changes in data


        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_quer y($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 = htmlspecialchar s($_POST['notes']);
        $notes = trim($cleanNote s);
        $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.

        Comment

        • Jeff Gardner

          #5
          Re: UPDATE query appears to complete but nothing changes in data

          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',
          >>>lasteditda te = '$lastedit',
          >>>publish = '$pub',
          >>>updatedby = '$uname'
          >>>WHERE org_id = '$orgid'";
          >>>>
          >>>include_on ce 'dsn.php';
          >>>$res=mysql_q uery($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 = htmlspecialchar s($_POST['notes']);
          >$notes = trim($cleanNote s);
          >$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,address 1,address2,city ,state,country, zip,phone1,phon e2,fax,email,we bsite,notes,las teditdate,creat edate,createdby ,publish,update dby)

          VALUES
          ('','$org','$of f','$ad1','$ad2 ','$city','$sta te','$country', '$zip','$phone1 ','$phone2','$f ax','$email','$ website','$note s','$lastedit', '$lastupdate',' $uname','$pub', '$uname')";
          include_once 'dsn.php';
          $res=mysql_quer y($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

          Comment

          • Petr Vileta

            #6
            Re: UPDATE query appears to complete but nothing changes in data

            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',
            >>lasteditdat e = '$lastedit',
            >>publish = '$pub',
            >>updatedby = '$uname'
            >>WHERE org_id = '$orgid'";
            >>>
            >>include_onc e 'dsn.php';
            >>$res=mysql_qu ery($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 = htmlspecialchar s($_POST['notes']);
            $notes = trim($cleanNote s);
            $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.)


            Comment

            • Jeff Gardner

              #7
              Re: UPDATE query appears to complete but nothing changes in data

              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',
              >>>lasteditda te = '$lastedit',
              >>>publish = '$pub',
              >>>updatedby = '$uname'
              >>>WHERE org_id = '$orgid'";
              >>>>
              >>>include_on ce 'dsn.php';
              >>>$res=mysql_q uery($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 = htmlspecialchar s($_POST['notes']);
              >$notes = trim($cleanNote s);
              >$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_st ring. 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

              Comment

              • IchBin

                #8
                Re: UPDATE query appears to complete but nothing changes in data

                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
                >>>>privilege s 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',
                >>>>lasteditdat e = '$lastedit',
                >>>>publish = '$pub',
                >>>>updatedby = '$uname'
                >>>>WHERE org_id = '$orgid'";
                >>>>>
                >>>>include_onc e '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 = htmlspecialchar s($_POST['notes']);
                >>$notes = trim($cleanNote s);
                >>$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_st ring. The same data INSERTS
                properly.
                >
                Could it be something simple like the mysql_autocommi t() 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-)

                Comment

                • Jeff Gardner

                  #9
                  Re: UPDATE query appears to complete but nothing changes in data

                  IchBin wrote:
                  Jeff Gardner wrote:
                  >Petr Vileta wrote:
                  >>Jeff Gardner wrote:
                  >>>One wrote:
                  >>>>Jeff Gardner wrote:
                  >>>>>Greeting s:
                  >>>>>>
                  >>>>>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
                  >>>>>privileg es 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',
                  >>>>>lasteditda te = '$lastedit',
                  >>>>>publish = '$pub',
                  >>>>>updatedb y = '$uname'
                  >>>>>WHERE org_id = '$orgid'";
                  >>>>>>
                  >>>>>include_on ce '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']);
                  >>>$cleanNote s = htmlspecialchar s($_POST['notes']);
                  >>>$notes = trim($cleanNote s);
                  >>>$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_st ring. The same data INSERTS
                  >properly.
                  >>
                  >
                  Could it be something simple like the mysql_autocommi t() 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

                  Comment

                  • william.clarke

                    #10
                    Re: UPDATE query appears to complete but nothing changes in data

                    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.

                    Comment

                    Working...