Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 7 of 7

Thread: PHP SQL Help

  1. #1
    JR
    JR is offline
    Senior Member JR's Avatar
    Join Date
    Nov 2002
    Location
    UK
    Posts
    4,354
    Member #
    257
    what is wrong with this? I get my die message 'Query Failed' when i try to execute it.
    PHP Code:
    $query 
    "INSERT INTO `clients` 
    (`clientid`, `name`, `username`, `password`, `company`, `telephone`, `email`, `project`, `status`, `tempsite`)
    VALUES ('', 
    $getname$getusername$password$getcompany$gettelephone$getemail$getproject, NULL, $gettempsite)"
    thanks
    JR

  2.  

  3. #2
    Senior Member nsr81's Avatar
    Join Date
    Oct 2002
    Posts
    1,132
    Member #
    250
    Liked
    15 times
    all string values should be enclosed in quotes.

    Try this:
    PHP Code:
    $query 
    "INSERT INTO `clients` 
    (`clientid`, `name`, `username`, `password`, `company`, `telephone`, `email`, `project`, `status`, `tempsite`)
    VALUES ('', '
    $getname', '$getusername', '$password', '$getcompany', '$gettelephone', '$getemail', '$getproject', NULL, '$gettempsite')"
    There and Back Again :Ogre:

  4. #3
    JR
    JR is offline
    Senior Member JR's Avatar
    Join Date
    Nov 2002
    Location
    UK
    Posts
    4,354
    Member #
    257
    thanks
    JR

  5. #4
    Junior Member
    Join Date
    Feb 2003
    Location
    Washington DC
    Posts
    17
    Member #
    773
    or try this
    PHP Code:
    $query 
    "INSERT INTO clients 
    (`clientid`, `name`, `username`, `password`, `company`, `telephone`, `email`, `project`, `status`, `tempsite`)
    VALUES ('', '
    $getname', '$getusername', '$password', '$getcompany', '$gettelephone', '$getemail', '$getproject', NULL, '$gettempsite')"
    without quotes in the table name
    Elmer S.

  6. #5
    Senior Member nsr81's Avatar
    Join Date
    Oct 2002
    Posts
    1,132
    Member #
    250
    Liked
    15 times
    those are back quotes, which will never hurt
    There and Back Again :Ogre:

  7. #6
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    Try this one:
    PHP Code:
    $query "INSERT INTO clients (
        clientid, 
        name, 
        username, 
        password, 
        company, 
        telephone, 
        email, 
        project, 
        status, 
        tempsite)
    VALUES (
        '', 
        '
    $getname', 
        '
    $getusername', 
        '
    $password', 
        '
    $getcompany', 
        '
    $gettelephone', 
        '
    $getemail', 
        '
    $getproject', 
        NULL, 
        '
    $gettempsite')"
    ANSI SQL doesn't like you to put tics around your column names

  8. #7
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    Remember to addslashes every value.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 10:27 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com