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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.