Jump to content

MySQL Update, gives no error or update

- - - - -

  • Please log in to reply
5 replies to this topic

#1
bbqroast

bbqroast

    Codecall Addict

  • Members
  • PipPipPipPipPipPipPip
  • 554 posts
  • Location:/etc/passwd
mysql_query("UPDATE `user_data` SET `ID` = $ID, `IGN` = $IGN, `joindate` = DEFAULT, `rank` = $rank, `username` = $username, `password` = $password, `email` = $email, `flag` = $flag WHERE `ID` = $userID") or die(mysql_error());
that rather long piece of code is *meant* to update my database with some new details.

Instead I just get redirected (which it only does if the query is ran), but then promptly sent back to my update page asking me to reenter the details.

You see when flag is 0 you get sent to the update page to enter new details, the details then get processed (I have checked all this) before getting updated into the DB.

Looks like this query is going unheeded??
Please, write clearly with proper structure. Double spacing makes the text feel un-jointed, Capitalizing Every Word Means People Stop Before Every Word Sub-Consciously Which Is A Pain In The Backside, and use code tags! (The right most styling box).

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
Without seeing the surrounding code, it's really hard to know what's going on. Have you verified what statement is being run and that it actually results in an update? I've found that running tests with a SQL tool before and after these types of statements helps a lot, as does outputing the SQL to run as a diagnostic.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
bbqroast

bbqroast

    Codecall Addict

  • Members
  • PipPipPipPipPipPipPip
  • 554 posts
  • Location:/etc/passwd
How do you recommend??
I do retrieve some data from the same table and that works fine.
I'll try to find the MySQL logs.
Please, write clearly with proper structure. Double spacing makes the text feel un-jointed, Capitalizing Every Word Means People Stop Before Every Word Sub-Consciously Which Is A Pain In The Backside, and use code tags! (The right most styling box).

#4
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
[COLOR=#000000][COLOR=#0000BB]echo [/COLOR][COLOR=#007700][/COLOR][COLOR=#DD0000]"UPDATE `user_data` SET `ID` = $ID, `IGN` = $IGN, `joindate` = DEFAULT, `rank` = $rank, `username` = $username, `password` = $password, `email` = $email, `flag` = $flag WHERE `ID` = $userID"[/COLOR][COLOR=#007700][/COLOR][COLOR=#0000BB][/COLOR][COLOR=#007700];  [/COLOR][/COLOR]

I'm fond of using SQuirreL SQL client, though PHPMyAdmin cna work, too. Just looking at the above, I note that you haven't delimited most of the values I would expect to be strings, for example.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#5
bbqroast

bbqroast

    Codecall Addict

  • Members
  • PipPipPipPipPipPipPip
  • 554 posts
  • Location:/etc/passwd
Deliminated?? Oh, you mean surround with `s or 's?
Please, write clearly with proper structure. Double spacing makes the text feel un-jointed, Capitalizing Every Word Means People Stop Before Every Word Sub-Consciously Which Is A Pain In The Backside, and use code tags! (The right most styling box).

#6
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
I would expect the following to be more likely:
[COLOR=#000000][COLOR=#0000BB]echo [/COLOR][COLOR=#DD0000]"UPDATE `user_data` SET `ID` = $ID, `IGN` = $IGN, `joindate` = DEFAULT, `rank` = $rank, `username` = '$username', `password` = '$password', `email` = '$email', `flag` = $flag WHERE `ID` = '$userID'"[/COLOR][COLOR=#007700]; [/COLOR][/COLOR]

Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users