#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    2
    Rep Power
    0
    Well hiya ppl I am studying to interact with MySQL bases using PHP 4. The problem is as follows: I need to use Update after editing a particular record. But I also need to supply a parameter to WHERE which would specify which record to update. So the question is is there any function in MySQL which handles the number of row(record)? so that I could use mysql_query("UPDATE mytable SET field1=var1, field2=var2 WHERE RECNO()=var3") but instead of RECNO was the function I'm asking about HUGE thanks in advance
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    81
    Rep Power
    15
    As far as I know, no, MySQL doesn't maintain a row id to allow you to specify which record you wish to change. Anyway, that's a bad way to do it as there's no promise in a relational DB that there is any order to the data returned -- the third row returned could be 479th row entered (it probably won't be, but it _could_ be).

    What you want to do is specify which row you want to update using some candidate (unique) key (probably the primary key, though only unique key would work). If you want to record the order you insert rows, add an auto_increment column to the table.

Similar Threads

  1. Uploading Files
    By vivekjain in forum ASP Programming
    Replies: 0
    Last Post: February 16th, 2004, 11:21 PM
  2. Replies: 5
    Last Post: February 11th, 2004, 02:18 AM
  3. Replies: 0
    Last Post: February 10th, 2004, 11:44 PM
  4. Mysql and C
    By damalo in forum C Programming
    Replies: 4
    Last Post: February 5th, 2004, 11:23 AM
  5. newbie Q - is there an undo function in mysql?
    By cubanallstar83 in forum MySQL Help
    Replies: 2
    Last Post: February 5th, 2004, 07:32 AM

IMN logo majestic logo threadwatch logo seochat tools logo