I looked at the official documentation,but I still can't seem to access the independent variables for example "city". After a sql query, I use $results[0] to get this. How can I access "city"?
$results = DB::table('users')->get();
birthdate = "0000-00-00 00:00:00";
city = "Laguna Hills";
country = "<null>";
"created_at" = "2014-07-21 07:11:06";
email = "sammy0@gmail.com";
id = 1;
"is_verified" = "<null>";
"location_lat" = "<null>";
"location_lon" = "<null>";
password = RightNow25;
"updated_at" = "0000-00-00 00:00:00";
username = sammy0;
zip = "<null>";
Try printing the full output to the page using 'print_r' (see the below code). It is very useful since you can see all elements within the array along with they keys and values.
//(using print_r between '<pre>' and '</pre>' formats the data to a human readable format)
print '<pre>';
print_r($results);
print '</pre>';
This should help to identify if your data is being returns as intended.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.