SitePoint Sponsor

User Tag List

Results 1 to 13 of 13
  1. #1
    SitePoint Addict einSTein's Avatar
    Join Date
    Aug 2006
    Posts
    276
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    another SQL syntax error

    Code MySQL:
    $kk=$session['user'];
    mysql_query("UPDATE user2 SET obj='$_POST[obj]' , SET Expr='$Exp', SET pos='$_POST[phel]', SET dob='$dob22', SET comp='$_POST[cnam]', SET cnt='$_POST[con]', SET cert='$_POST[cer]', SET Major='$_POST[Maj]', SET Grade='$_POST[Gd]', SET stPeri='$_POST[stp]', SET cont2='$_POST[ctry]', SET skills='$_POST[skills]', SET eng='$_POST[Eng]', SET fr='$_POST[FR]', SET ge='$_POST[Ger]', SET span='$_POST[Spsh]', SET other='$_POST[other]', SET jobT='$_POST[Job]', SET empT='$_POST[type]' WHERE user='$kk'");
     
    if (!mysql_query($sql,$con))
    	{
    	die('Error: ' . mysql_error());
    	}
    	echo "<br>";
    	echo "<br>Thanks for applying ";
    the error message
    Error: Query was empty

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,262
    Mentioned
    60 Post(s)
    Tagged
    3 Thread(s)
    you can have only one SET

    and what's with you php guys always coding your queries on onle long humungous line? you enjoy scrolling left and right? here, let me show you how real men code SQL --
    Code:
    UPDATE user2 
       SET obj='$_POST[obj]' 
         , Expr = '$Exp'
         , pos = '$_POST[phel]'
         , dob = '$dob22'
         , comp = '$_POST[cnam]'
         , cnt = '$_POST[con]'
         , cert = '$_POST[cer]'
         , Major = '$_POST[Maj]'
         , Grade = '$_POST[Gd]'
         , stPeri = '$_POST[stp]'
         , cont2 = '$_POST[ctry]'
         , skills = '$_POST[skills]'
         , eng = '$_POST[Eng]'
         , fr = '$_POST[FR]'
         , ge = '$_POST[Ger]'
         , span = '$_POST[Spsh]'
         , other = '$_POST[other]'
         , jobT = '$_POST[Job]'
         , empT = '$_POST[type]' 
     WHERE user = '$kk'
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,806
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    You only need 1 SET
    PHP Code:
    UPDATE user2 SET obj='$_POST[obj]'Expr='$Exp'pos='$_POST[phel]',
    // etc 
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  4. #4
    SitePoint Addict einSTein's Avatar
    Join Date
    Aug 2006
    Posts
    276
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    so how can i set more than one u mysql guy

  5. #5
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,262
    Mentioned
    60 Post(s)
    Tagged
    3 Thread(s)
    more than one u?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  6. #6
    SitePoint Addict einSTein's Avatar
    Join Date
    Aug 2006
    Posts
    276
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i want to set one that one column in the database how can i do that

  7. #7
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,806
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    do you mean update more than one record? or more than one field?
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  8. #8
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,262
    Mentioned
    60 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by einSTein View Post
    i want to set one that one column
    please slow down

    i know it must be hard typing your posts with your thumbs on your new iphone, but you will have to speak english like the rest of us

    set one that one????
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  9. #9
    SitePoint Addict einSTein's Avatar
    Join Date
    Aug 2006
    Posts
    276
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    i need help in sql

    i need to know how to set more than one column in the mysql dababase

  10. #10
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Can you please be more specific?
    Saul

  11. #11
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,262
    Mentioned
    60 Post(s)
    Tagged
    3 Thread(s)
    please don't just keep starting new threads if it's really the same topic

    this thread merged with your other one
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  12. #12
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,262
    Mentioned
    60 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by einSTein View Post
    i need to know how to set more than one column in the mysql dababase
    see post #2
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  13. #13
    An average geek earl-grey's Avatar
    Join Date
    Mar 2005
    Location
    Ukraine
    Posts
    1,403
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Make sure to escape data that comes from user input.


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
  •