SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: SQL problem

Hybrid View

  1. #1
    Non-Member bronze trophy geniusgoalie's Avatar
    Join Date
    Sep 2004
    Location
    Buffalo, USA
    Posts
    979
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    SQL problem

    I've been having a lot of trouble getting this query to work:
    PHP Code:
    $sql "INSERT INTO multihoster (id, username, password, email, spaceused) SELECT unapproved.id, unapproved.username, unapproved.password, unapproved.email, unapproved.spaceused FROM unapproved WHERE username='$value'";
    mysql_query($sql); 
    All that I am trying to do is insert into table multihoster the values from table unapproved where row username = $value. I can't seem to figure this out. Can someone help?

  2. #2
    Tranceoholic lilleman's Avatar
    Join Date
    Feb 2004
    Location
    Írebro, Sweden
    Posts
    2,716
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Well, the syntax seem to be fine. Does this give you an error message?

    PHP Code:
    mysql_query($sql) or die("$sql<hr>Error: "mysql_error()); 
    ERIK RIKLUND :: Yes, I've been gone quite a while.

  3. #3
    Non-Member bronze trophy geniusgoalie's Avatar
    Join Date
    Sep 2004
    Location
    Buffalo, USA
    Posts
    979
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by lilleman
    Hi,

    Well, the syntax seem to be fine. Does this give you an error message?

    PHP Code:
    mysql_query($sql) or die("$sql<hr>Error: "mysql_error()); 
    No, none at all. Maybe it is another part of the script, but I don't understand how...
    Thanks for your help, anyway.

  4. #4
    Tranceoholic lilleman's Avatar
    Join Date
    Feb 2004
    Location
    Írebro, Sweden
    Posts
    2,716
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Quote Originally Posted by geniusgoalie
    Maybe it is another part of the script, but I don't understand how...
    Are you sure that $value holds the correct value?
    ERIK RIKLUND :: Yes, I've been gone quite a while.

  5. #5
    SitePoint Wizard Dylan B's Avatar
    Join Date
    Jul 2004
    Location
    NYC
    Posts
    1,150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try out the query in phpMyAdmin with an example value for $value, just to see if it's the query itself.

  6. #6
    Non-Member bronze trophy geniusgoalie's Avatar
    Join Date
    Sep 2004
    Location
    Buffalo, USA
    Posts
    979
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I just realized my problem. I was afraid that it wasn't copying right, when the real problem was I was using the PASSWORD encryption method, instead of md5, like I thought. Thanks (and rep) to all who helped, it's unbelievable how stupid my errors are sometimes...


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
  •