#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Posts
    61
    Rep Power
    14
    From past posts I 'think' this would work but it doesn't. Please help.

    I am updating the column ourpage in any row of the database busdir2 where cat = farming. It reads only rows where cat = farming correctly, but isn't getting the new ourpage value into the table.

    ****************
    $result = mysql_query("SELECT * FROM busdir2 WHERE cat='FARMING' ORDER by state, city, who ASC",$db);
    if ($myrow = mysql_fetch_array($result))
    {
    do {
    printf("%s , %s , %s<BR><BR><BR>n", $myrow["cat"], $myrow["ourpage"], $myrow["id"]);

    {
    "UPDATE busdir2 SET ourpage = 'newvalue' WHERE id=$id";

    }


    } while ($myrow = mysql_fetch_array($result));
    }
    else
    {
    echo "Sorry, no records were found!";
    }

    *************************

    Help, I'm starting to grasp at straws,

    stujohnson
  2. #2
  3. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    6
    Rep Power
    0
    erm...

    "UPDATE busdir2 SET ourpage = 'newvalue' WHERE id=$id";

    ??. that is just define of a string, not even to a variable

    shouldn't it be:
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
    mysql_query("UPDATE busdir2 SET ourpage = 'newvalue' WHERE id=".$id,$db);
    [/code]

    watch the: id=".$id, u did id=$id", so $id is in the string, and not the
    id value which is supposed to be in the string

    ------------------
    Greetings lewi
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    58
    Rep Power
    15
    Lewi,
    the code is fine.

    echo "$****"; == echo $****;



    ------------------

    peterbe.com
  6. #4
  7. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    6
    Rep Power
    0
    ok, nothing said then

    ------------------
    Greetings lewi

Similar Threads

  1. Replies: 18
    Last Post: May 6th, 2004, 01:23 PM
  2. Limiting factor of update/insert performance
    By bcyde in forum PostgreSQL Help
    Replies: 12
    Last Post: February 26th, 2004, 02:14 PM
  3. insert and update 2 tables
    By welly in forum PHP Development
    Replies: 14
    Last Post: February 23rd, 2004, 07:41 AM
  4. sql update inserts '0' and not var
    By SeenGee in forum PHP Development
    Replies: 2
    Last Post: February 16th, 2004, 09:18 PM
  5. update data in database
    By Phuspha in forum MySQL Help
    Replies: 2
    Last Post: November 7th, 2003, 01:09 AM

IMN logo majestic logo threadwatch logo seochat tools logo