Jump to content

Getting data


mh1ok

Recommended Posts

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?

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...