Moderators joeri Posted March 10, 2013 Moderators Report Share Posted March 10, 2013 hello all quick question as i am somewhat stuck as my sql coding sucks i need to update a table where the value is currently 3 and must change in to 1 for the whole table how would i write it in sql thanks in advance joeri Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted March 10, 2013 Moderators Report Share Posted March 10, 2013 You would write in your Data.class.php like: public function update($id) { $sql = "UPDATE table_name SET table_column = '$id' "; DB::query($sql); } Now to pass the value to the function you would write: YourData::update(value); Hope this will help Quote Link to comment Share on other sites More sharing options...
Moderators joeri Posted March 10, 2013 Author Moderators Report Share Posted March 10, 2013 hello thanks for the help but i was actually referring to doing it directly in phpmyadmin so it would go faster its only a 1 time thing i need to do but i will give it a try like you stated Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted March 10, 2013 Moderators Report Share Posted March 10, 2013 Okay. For phpMyadmin the command is the same you just need to enter it correctly in "SQL" tab in there. Update:: I just check my DB, if you hit the SQL tab there is button that says "update" click that and the command comes up then modify it to your need and click go. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.