UPDATE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am trying to insert information into the database, have it automatically
place an ID Number, then update that particular record and replace the word
"delete" with the link.

The "mysql_insert_id()" does seem to be working. It does put in an id number
of "0" However, the code in general gives me an error everytime. It says
that it is near 'delete = <a href...'

Can anyone help me with this?

Thanks!

--
Steve

<?php    

    // log into our local server using the MySQL root user.
   $dbh = mysql_connect( "localhost", "username", "password" );

   // select the database.
   mysql_select_db( "imagesdb" ) or die ( mysql_error() . "\n" );

?>

<-- snip -->

<?php

    //This is for the text description of the gallery and the link
    $insert_data2 = "INSERT into images_upload_description (delete, name,
description)
    VALUES ('delete', '<a
href=\"http://www.domain.org/gallery/bomb/bottom_images.php?gallery_name=$ga
llery_name\" target=\"bottom\">$name</a>', '$description');";
    $response = mysql_query( $insert_data2, $dbh );

    $id_num = mysql_insert_id();

    $update_data = "UPDATE images_upload_description SET delete = <a
href=\"http://www.domain.org/gallery/admin/delete.php?gallery_name=$gallery_
name&id_num=$id_num\" target=\"bottom\">Delete</a> WHERE id_num =
\"$id_num\"";
        
        $response = mysql_query( $update_data, $dbh );
    if(mysql_error()) die ('database error'. mysql_error());
    
    ?>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux