Jump to content

Using PHP to search a MySQL database and return information


NickCB

Recommended Posts

I am building a directory site with a Joomla component that has a Google Map facility but not up to the high standard and functionality of another map component I am using.

 

So, to save on work I ask this:

 

Within the map an info block pops up when you click the marker icon. As with Google Maps. I need information in these blocks. I have the information already in the directory database so do not want to duplicate it. To display the same information in the directory within the map block can I use the following code where it allows me to insert code and add in the relevant information:

 

 

 

{source}<?php

$query = $db->getQuery(true);

$query->select($db->nameQuote('something'));

$query->from('#__mydatabasetable');

$query->where($db->nameQuote('this').' = '.$db->quote('that'));

$db->setQuery($query);

$result = $database->loadResult();

?>{/source}

 

 

Does this mean I can display information from another table within the same database?

 

If so, I would like to do display the following:

 

If the ID of this Marker icon matches the ID of e.g.databaseXYZ, then enter information from databaseabc, column123.

 

If I can, what is the relevant information and where does it go?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.