mh1ok Posted December 29, 2011 Report Share Posted December 29, 2011 Hi, I am trying to get a data from one of the columns in the database. Installed PHPVMS, everything went fine. I added another column to the phpvms_pilots called "Passed" for exams. It is set at 0 or 1. How can i get that data from the database? I have tried the following (pilotid=2 is just example I set it to Auth::$userinfo->pilotid which should get any pilot but same problem): $result = "SELECT phpvms_pilots.Passed FROM phpvms_pilots WHERE pilotid=2"; $info = DB::get_results($result); Shouldn't $info now hold 0 or 1? Or am I doing something wrong? Quote Link to comment Share on other sites More sharing options...
Tom Posted December 29, 2011 Report Share Posted December 29, 2011 $result = "SELECT Passed FROM phpvms_pilots WHERE pilotid=2"; $info = DB::get_row($result); echo $info->Passed; Should work... Quote Link to comment Share on other sites More sharing options...
mh1ok Posted December 29, 2011 Author Report Share Posted December 29, 2011 Nevermind, I found my solution and fixed it. After fumbling around a little bit more I had to just run a foreach loop. Here is what I did if anyone else runs into the same: $pilotid = Auth::$userinfo->pilotid; $result2 = "SELECT phpvms_pilots.passed FROM phpvms_pilots WHERE pilotid=$pilotid"; foreach(DB::get_results($result2) as $tests) { $info = $tests->passed; } $info now holds 0 or 1. Problem SOLVED Quote Link to comment Share on other sites More sharing options...
mh1ok Posted December 29, 2011 Author Report Share Posted December 29, 2011 $result = "SELECT Passed FROM phpvms_pilots WHERE pilotid=2"; $info = DB::get_row($result); echo $info->Passed; Should work... Hey, Tom, thanks for your suggestion. That works too. I'll use your since its shorter than mines hehe 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.