The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> GMaps Script | Get Info From Database | PHP post / in javascript, GMaps Script | Get Info From Database | PHP post / in javascript
sanoj96
post Sep 17 2017, 04:24 PM
Post #1


Member
***

Group: Members
Posts: 98
Joined: 18-September 12
Member No.: 17,803



Hello!

I have taken on a small project for my dads company, and he wants a website that displays all the houses, offices they have / have built.

The maps script is now working, but now that i would need to inplement PHP and a "admin user interface" so they can add houses and addresses them self i have a few problems.

It is a long time sins i took on a few projectes and i have kind of forgoten some stuff.


The quesstions is, how can i inplement the following into a javascript file:


CODE

if (mysqli_num_rows($result) > 0) {
    // output data of each row
    while($row = mysqli_fetch_assoc($result)) {
        echo "id: " . $row["id"]. " lat: " . $row["lat"]. ", lng: " . $row["lng"]. ", info: <div class='info_content'><h3> " . $row["address"]."</h3><p><img src='" .$row["info"]. "'></img></p></div><hr>";
    }


into this:

CODE

var locations = [{
  lat: x.xxxxxx,
  lng: x.xxxxxx,
  info: '<div class="info_content"><h3>Address</h3><p><img src="info"></img></br></p></div>'
}, {


it must be a while function ether in php or javascript sins its over 1000 houses on the list.

Might be hard to understand my quesstions, but feel free to ask me quesstions and i will do my best to answare them.


(not sure if i should post this in client side script or server side can move if it is in the wrong topic)

Thanks!

This post has been edited by sanoj96: Sep 17 2017, 04:25 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Sep 17 2017, 06:12 PM
Post #2


.
********

Group: WDG Moderators
Posts: 7,702
Joined: 10-August 06
Member No.: 7



You might let an Ajax javascript communicate with the PHP script on the server.
User is online!PM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
sanoj96
post Sep 18 2017, 11:32 AM
Post #3


Member
***

Group: Members
Posts: 98
Joined: 18-September 12
Member No.: 17,803



Thanks! Got it working!

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 20th October 2017 - 12:54 PM