-
Posts
24,566 -
Joined
-
Last visited
-
Days Won
822
Everything posted by Barand
-
Plotting dynamic markers from MySQL DB in Google Maps
Barand replied to Texan78's topic in Javascript Help
The attached php files in reply #5 do exactly what you said you want to do - retrieve from db and add map markers via json data. -
In your original code you had How did you know what the variables were?
-
Make HTTP GET request with cURL from Wowza Rest API
Barand replied to Texan78's topic in PHP Coding Help
At what point is $obj->isConnected converted to a string? -
I guess you need to give it over 2 seconds of actual work to do
-
Make HTTP GET request with cURL from Wowza Rest API
Barand replied to Texan78's topic in PHP Coding Help
json_decode -
Plotting dynamic markers from MySQL DB in Google Maps
Barand replied to Texan78's topic in Javascript Help
You didn't look at the code samples in that thread then? -
->setCellValue('F'.$i,$row['prod_sell_override']>0 ? $row['prod_sell_override'] : number_format($row['prod_trade']*100/70), 2) ?
-
Setting field to unique per user and not column
Barand replied to learningprobs's topic in MySQL Help
You would lessen the load by putting an index on the user_id column. -
Have you tried number_format()?
-
or $data = file('hansford.txt',FILE_IGNORE_NEW_LINES); natsort($data); foreach ($data as $line) { echo "$line<br>"; } gives #1A - Kessenich #1B - Adams #8 - Johnson #50 - Smith #100 - Sanders
-
Plotting dynamic markers from MySQL DB in Google Maps
Barand replied to Texan78's topic in Javascript Help
see https://developers.google.com/maps/documentation/javascript/markers and also this topic https://forums.phpfreaks.com/topic/302364-need-help-to-clear-concept-of-google-maps-integration-in-php/?do=findComment&comment=1538471 -
Your code has quotes missing. Notice the color of the text in the code box above?
-
Use code tags.
-
Need help to clear Concept of Google Maps integration in PHP
Barand replied to AMITKUMAR's topic in Application Design
Does it work if you link to a local jquery.js file instead of the google one? -
You might use PHP to get the lat/long data via AJAX but communication with maps api would use javascript. https://developers.google.com/maps/documentation/javascript/examples/polyline-simple
-
Need help to clear Concept of Google Maps integration in PHP
Barand replied to AMITKUMAR's topic in Application Design
Are any of the jQuery calls functioning? -
Extracting only specific array elements
Barand replied to NotionCommotion's topic in PHP Coding Help
Possibly, it is a neat solution for those who understand the function. Another option may be to organize your query so you can use array_slice(). -
Extracting only specific array elements
Barand replied to NotionCommotion's topic in PHP Coding Help
or simply $clients[] = [ 'name' => $source['name'], 'guid' = $source['guid'] ]; [EDIT] Requinix's turn to beat me to the post -
Need help to clear Concept of Google Maps integration in PHP
Barand replied to AMITKUMAR's topic in Application Design
Check the browser console to see if the AJAX calls are behaving -
Need help to clear Concept of Google Maps integration in PHP
Barand replied to AMITKUMAR's topic in Application Design
That would be because the query failed // get the google maps key $sql = "SELECT gm_key , ROUND(home_lat,2) , ROUND(home_long,2) FROM mydb.google_map_key"; $res = $db->query($sql); list($gmkey, $home_lat, $home_lng) = $res->fetch_row(); As the comment says, that query fetches my personal Google API key from a database (plus the starting map coordinates for the application. I suggest you provide those three values as hard-coded values for now to get it working. Remove the above code and replace with $home_lat = 27.60; $home_lng = 77.06; $gmkey = "<your api key goes here>"; I did some more testing today. "route_2" works only if the places on the route are on a straight route IE for A - B - C - D If you go off the line as in A - B D | | \ | C then it give the time for AD as less than the time AC. So the code needs changing so, instead of calculating AB, AC, AD as it does now, it calculates AB, BC, CD and accumulates the times. Revised route2 attached. routes_2.php -
Need help to clear Concept of Google Maps integration in PHP
Barand replied to AMITKUMAR's topic in Application Design
I haven't used the Google Distance Matrix API before so this was a learning exercise for me. Here's a small application: route_1.pgp - main page with map display route_2.php - responds to AJAX calls to retrieve data route.sql.txt - SQL script file to create database (Note mins and distances are set to zero in the route_definition table) When you load route_1, the routes are listed. Clicking on a route fetches the route definition from the database, submits a request to the google api to get the times and distances and updates the route records in the table. The distances and times are then listed on the screen and the stops are displayed on the map. I hope this helps to get you going. routes.sql.txt routes_1.php routes_2.php -
Consult the manual http://php.net/manual/en/migration70.new-features.php
-
Need help to clear Concept of Google Maps integration in PHP
Barand replied to AMITKUMAR's topic in Application Design
https://developers.google.com/maps/documentation/distance-matrix/start -
Need help to clear Concept of Google Maps integration in PHP
Barand replied to AMITKUMAR's topic in Application Design
It looks like you have a lot of duplication of data. Every time you add a bus, you add the stops also. A better approach would be to define the route first. Route definition Stop +-----------+-----------+-----------+--------+ +----------+-----------------------+----------+-----------+ | route_id | sequence | stop_id | mins | | stop_id | stop name | Lat | Long | +-----------+-----------+-----------+--------+ +----------+-----------------------+----------+-----------+ | DA | 1 | 102 | 0 | | 101 | Agra | 27.16945 | 78.01194 | | DA | 2 | 103 | 10 | | 102 | Dehli | 28.60357 | 77.26217 | | DA | 3 | 104 | 190 | | 103 | Noida | etc | | DA | 4 | 101 | 250 | | 104 | Vrindavan | etc | +-----------+-----------+-----------+--------+ +----------+-----------------------+----------+-----------+ Now you can add the timetabled journeys to run on each route Timetabled journey +----------+-------------+----------+ | jny_id | route_id | depart | +----------+-------------+----------+ | 450 | DA | 7:50 | | 451 | DA | 9:50 | Intermediate stop times are then calculated from the route definition. You can take it further if you have a table to allocate the "bus working" defining the sets of journeys scheduled for a bus. This enables you to produce service timetable as well as vehicle timetables. To show on a map first create a map object. For each stop, create a LatLng object using the stop's latitude and longitude values add marker object to map object using the LatLng object [EDIT] Note that the above would be done in Javascript. You would use PHP to retrieve the data required and pass it to the client via an AJAX request. -
The input password will not match that in the user table, so your selection criteria should just be where the username matches. Then verify the retrieved password hash.