Hello, what city am I trying to find from my IP address, which is able to display the list of users Be my database in your area / near them
I have been seeing this API.
And I have registered and got an API key, but I'm not sure where to go from here. Here is the example code used to get the user code Is:
& lt ;? Php included ('ip2locationlite.class.php'); // Load the class $ ipLite = new ip2location_lite; $ IpLite- & gt; ('& Lt; api key & gt;') of the set; // Get Errors and Locations $ places = $ ipLite- & gt; GetCity ($ _ server ['REMOTE_ADDR']); $ Errors = $ ipLite- & gt; GetError (); // get results "& lt; p & gt; \ n"; Echo "& lt; strong & gt; first result & lt; / strong & gt; & lt; br / & gt; \ n"; If (! Empty ($ places) & amp; amp; is_array ($ location)) {foreach ($ fields as $ field = & gt; $ val) {echo $ field ':' $ Val "
" \ n "; }} Echo "& lt; / p & gt; \ n"; // Show echo errors "& lt; p & gt; \ n"; & Quot; Strong & gt; All Errors Dump & lt; / Strong> & Lt; Br / & gt; \ N "; if (empty! ($ Errors) and is_array ($ errors)) {foreach ($ error $ as error) {echo var_dump ($ error)" & lt; Br / & gt; & Lt; Br / & gt; \ N ";}} and {echo" No Errors "" & lt; Br / & gt; \ N ";} echo" & lt; / P & gt; \ N ";? & Gt; But how do I now query a mysql if the user is in London and users then display these to the user in the database listed in London Has been said that will be set?
I would really appreciate one push in the right direction here if someone can help. Thank you.
Here is an example (its database structure and non-test foreach ($ $ area = & quot;) without any knowing knowledge;); foreach in this insert ($ places as the area = Places => $ Val) Gt; places like; $ val) {$ field echo. ':'. $ Val "& lt; Br / & gt; \ N "; $ Mysqli = new mysqli (' Ready ('Select & lt; other_users & gt; , ... & lt; your table & gt; where & lt; USER_LOCATION & gt; by order & lt; whatever & gt; ')) {$ stmt_evt - & gt; Bind_prim (' s', $ val $ Stmt_evt -> executed (); $ Stmt_evt - & gt; Bind_stilt ($ , $ ...); while ($ stmt_evt-> fetch)} {echo ' Other users in your area Customer: '. $ & Lt; other_user & gt ;;}} Else {echo' error: unable to prepare event statement. ';}}} Click
No comments:
Post a Comment