Results 1 to 3 of 3

Thread: PHP MYSQL update query not updating fields

  1. #1
    pilot911 is offline Newbie
    Join Date
    Mar 2011
    Posts
    1

    Lightbulb PHP MYSQL update query not updating fields

    I have the following PHP script to update two time/date fields in the database.

    When i run this the fields are not updated.

    Can anyone see where i m going wrong.

    PHP Code:
    <?php
    $con 
    mysql_connect("localhost","dbname","dbpassword");
    if (!
    $con)
      {
      die(
    'Could not connect: ' mysql_error());
      }
      
    echo 
    'Connected successfully';

    mysql_select_db("my_db"$con);

    mysql_query("UPDATE msm_content SET created = '2011-01-02 00:00:00', modified = '2011-01-01 00:00:00'");

    echo 
    'Query Updated successfully';

    mysql_close($con);
    ?>
    Your guidance is much appreciated.

    Chris
    Last edited by Matt; 03-04-2011 at 05:32 PM.

  2. #2
    GlowAlex is offline Master Glow Jedi
    Join Date
    Sep 2007
    Posts
    188

    Default

    There may be many reasons for that.

    Try to insert the line below before the db closing function:

    echo mysql_errno($con) . ": " . mysql_error($con);


    and see what it shows.

  3. #3
    Dmitriy is offline Nearly a Master Glow Jedi
    Join Date
    Feb 2007
    Location
    Ukraine
    Posts
    124

    Default

    I'd start from modifying the query line, like that

    mysql_query("UPDATE msm_content SET created = '2011-01-02 00:00:00', modified = '2011-01-01 00:00:00'", $con);

Similar Threads

  1. PHP/MySQL Form Help for the Frustrated
    By rickpugh in forum Programming Talk
    Replies: 2
    Last Post: 12-04-2010, 10:28 PM
  2. MYSQL Query
    By jamison in forum Programming Talk
    Replies: 13
    Last Post: 02-15-2010, 11:50 AM
  3. PHP 5.1 and MySQL 4.1
    By Raven in forum WHM, Resellers, VPS and Dedicated Hosting Topics
    Replies: 11
    Last Post: 08-13-2006, 12:57 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14