#1
  1. *Programmer In Training*
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2005
    Location
    SE London
    Posts
    371
    Rep Power
    17

    Data inserted successfully but error still shows.


    Hi guys,

    I have a problem.

    Basically I have a form, which when submitted sends the data to a table. Now, this wroks perfectly, the data gets sent, and the row populates, however, I still get the common error:
    Code:
    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource
    Now this is the query:
    Code:
    $inputthread = mysql_query("INSERT INTO threads SET th_title = '$th_title', th_startdate = CURDATE(), m_name = '$login_name', mf_id = '$mf_id'");    
    $fetchinputthread = mysql_fetch_array($inputthread);
    Whats going on?
  2. #2
  3. No Profile Picture
    I AM A GOLDEN GOD
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Apr 2003
    Location
    Camarillo, California
    Posts
    5,929
    Rep Power
    1170
    An INSERT statement does not return a resultset. Therefore you cannot use the value in $inputthread as a Result Resource and attempt to do anything with it (it actually contains a boolean value, so you could do something with it, just not retrieve records). You must perform a second SELECT query statement if you expect to get any data.

    PHP Manual : [phpnet=mysql_query]mysql_query()[/phpnet]

    Comments on this post

    • Skudd agrees
    "Seriously, we're not a search engine, we're actual people." ~ ManiacDan

    BookMooch.com : Give books away. Get books you want.

IMN logo majestic logo threadwatch logo seochat tools logo