Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Sep 2011
    Posts
    274
    Thanks
    38
    Thanked 0 Times in 0 Posts

    Queries arn't working. Why?

    I was wondering if someone could tell me why on Earth this isn't working?

    PHP Code:
    <?php
        $link 
    mysql_connect('localhost''testusr''testpw');
        
    mysql_select_db('testdb'$link);
        
    $queryam "UPDATE `deliveryservices` set `zonea` = $_POST[amzonea],`zoneb` = $_POST[amzoneb],`zonec` = $_POST[amzonec],`zoned` = $_POST[amzoned],`maxweight` = $_POST[ammaxweight] where `service` = 'am'";
        
    $queryecim "UPDATE `deliveryservices` set `zonea` = $_POST[ecimzonea],`zoneb` = $_POST[ecimzoneb],`zonec` = $_POST[ecimzonec],`zoned` = $_POST[ecimzoned],`maxweight` = $_POST[ecimmaxweight] where `service` = 'ecim'";
        
    $queryrp "UPDATE `deliveryservices` set `domestic` = $_POST[rpdomestic],`maxweight` = $_POST[rpmaxweight] where `service` = 'rp'";
        
    mysql_query ($queryam,$queryecim,$queryrp);
        
    mysql_close($link);
    ?>

  • #2
    Regular Coder
    Join Date
    Sep 2011
    Posts
    274
    Thanks
    38
    Thanked 0 Times in 0 Posts
    I get:
    PHP Warning: mysql_query() expects at most 2 parameters, 3 given
    Does this mean MySQL can only handle two $things at a time?

  • #3
    Senior Coder djm0219's Avatar
    Join Date
    Aug 2003
    Location
    Wake Forest, North Carolina
    Posts
    1,314
    Thanks
    4
    Thanked 207 Times in 204 Posts
    mysql_query expects 2 things, the query to be executed and the database resource. You can't execute multiple queries with a single call to mysql_query as you are trying to do.

    PHP Code:
    $mydb mysql_select_db('testdb'$link);
        
    $queryam "UPDATE `deliveryservices` set `zonea` = $_POST[amzonea],`zoneb` = $_POST[amzoneb],`zonec` = $_POST[amzonec],`zoned` = $_POST[amzoned],`maxweight` = $_POST[ammaxweight] where `service` = 'am'";
        
    $queryecim "UPDATE `deliveryservices` set `zonea` = $_POST[ecimzonea],`zoneb` = $_POST[ecimzoneb],`zonec` = $_POST[ecimzonec],`zoned` = $_POST[ecimzoned],`maxweight` = $_POST[ecimmaxweight] where `service` = 'ecim'";
        
    $queryrp "UPDATE `deliveryservices` set `domestic` = $_POST[rpdomestic],`maxweight` = $_POST[rpmaxweight] where `service` = 'rp'";
        
    mysql_query($queryam,$mydb);
        
    mysql_query($queryecim,$mydb);
        
    mysql_query($queryrp,$mydb); 
    Dave .... HostMonster for all of your hosting needs

  • Users who have thanked djm0219 for this post:

    FlashDance (10-23-2011)

  • #4
    Regular Coder
    Join Date
    Sep 2011
    Posts
    274
    Thanks
    38
    Thanked 0 Times in 0 Posts
    Ahuh! I see.

    Thanks Dave. I hope you enjoy your day!


  •  

    Posting Permissions

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