Type whatever to find the question. ex: (How to ... ?, چۆن ... ؟)
Type whatever to find the question. ex: (How to ... ?, چۆن ... ؟)
Menu
Questions Zhinma
What is Zhinma?
Zhnima is a standard group that works in technology. It develops the projects and supply them for project owners.
Reported
Questions
Help Center
Support Center

وەرگرتنی هەمو ناوەکان لە Json Array - php

168 1 Answer
دەمەوێت هەموو ناوەکانم نیشان بدات کاتێک داتا لە داتابایس وەردەگرم، بەڵام تەنها کۆتاییەکەم بۆ دەگەڕێتەوە! foreach بەکاردێنم بۆ وەرگرتنەوەی داتایەکان.
PHPJSON
Php
            
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
foreach($db->get("users",array('id', '!=', $id))->results() as $u){ $user = new user( $u->id ); $json = array( 'error_two' => FALSE, 'getusers' => $getusers, 'call_two' => [ array( 'user_id' => $user->data()->id, 'fname' => $user->data()->fname, 'lname' => $user->data()->lname, 'username' => $user->data()->username, 'gender' => $user->data()->gender, ), ] ); echo json_encode($json); }

Updated

جەیسۆن داتایەکە: {"error_two":false,"getusers":true,"call_two":[{"user_id":"1","fname":"Ned","lname":"Stark","username":"","gender":"Male"}]}

Answers

Darvan Shvan Answered 3 month ago
هیچ کێشەیەک نابینم لە کۆدەکەت، تەنها echo بهێنە دەرەوەی foreach.
Php
            
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
foreach($db->get("users",array('id', '!=', $id))->results() as $u){ $user = new user( $u->id ); $json = array( 'error_two' => FALSE, 'getusers' => $getusers, 'call_two' => [ array( 'user_id' => $user->data()->id, 'fname' => $user->data()->fname, 'lname' => $user->data()->lname, 'username' => $user->data()->username, 'gender' => $user->data()->gender, ), ] ); } echo json_encode($json);
Replies