SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Mar 2003
    Location
    In a house in the USA
    Posts
    293
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Multiple update Commands

    I am writing a script that is rather large and has a part that deals with topics of products. I have a script that I use to update the main topic list, but I am getting lost when I try to also update products with that same topic. My code is as follows but it does not work. It updates the main list and errors out before it updates the other list.
    PHP Code:
    $sql "UPDATE `op_topic` SET `id` = '$id'";
    $sql .= ", `topic` = '$tproduct'";
    $sql .= ", `section` = 'product'";
    $sql .= " WHERE `id` = $id";
    mysql_query($sql) or die("Unable to process query: " mysql_error());

    $sql2 mysql_query("UPDATE 'op_product' WHERE 'topic' = '$tproduct' SET 'topic' = '$tproduct'
    );
    if(!
    $sql2) {
    echo 
    'Error';
    die;

    I have the following as the database for the op_product:
    Code:
     CREATE TABLE `op_product` 
    ( `id` int(11) NOT NULL auto_increment,
     `name` varchar(30) NOT NULL default '',
     `link` varchar(255) NOT NULL default '',
     `topic` varchar(30) NOT NULL default '',
     PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=14 ;
    Any suggestions?
    Daniel
    http://www.wlscripting.com - PHP Tutorials and code snippets
    Notepad++ Function List plugin tip - for PHP developers

  2. #2
    SitePoint Addict
    Join Date
    Mar 2003
    Location
    In a house in the USA
    Posts
    293
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Never mind. I finally figured it out.
    Daniel
    http://www.wlscripting.com - PHP Tutorials and code snippets
    Notepad++ Function List plugin tip - for PHP developers


Bookmarks

Posting Permissions

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