Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Server-side Scripting _ GMaps Script | Get Info From Database | PHP post / in javascript

Posted by: sanoj96 Sep 17 2017, 04:24 PM

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!

Posted by: Christian J Sep 17 2017, 06:12 PM

You might let an Ajax javascript communicate with the PHP script on the server.

Posted by: sanoj96 Sep 18 2017, 11:32 AM

Thanks! Got it working!


Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)