|
Hi there,
I am currently making a widget through javascript.
The basic aim is when a user types in a particular web domain, (which i have preloaded in my database called - 'domain') and load the domain matching into the title bar of my widget. Then I have sorting buttons underneath, name, visits, and it basically just displays the number of times that site has been visited. So quite basic, but i am pretty new to all this and in desperate need of help from anyone.
Many thanks in advance!
the php will query the database to check for matching names of domains to what the user has typed in.
This is my php scirpt page called getDomainInfo.php -
<?php
ini_set("error_reporting", E_ALL);
ini_set("log_errors", "1");
ini_set("error_log", "./php_errors.txt");
require_once("db.php");
$userDomain = $_GET['domain'];
/* Construct a PHP array object containg the data for each section in the domain */
$info = array();
/* Add code here to query the DB for information about the given domain*/
$query = ("SELECT domain FROM sites WHERE domain LIKE '%$userDomain%'");
$select = mysql_query($query);
while ($row = mysql_fetch_array($select))
{
$info[] = $row[0];
}
/* Return a JSON encoded version of the array to the browser */
echo json_encode($info);
/* Close connection */
mysql_close();
?>
It uses another connections page which I have called db.php.
What im basically trying to query is . . . look for domain names that look like whatever the user has typed in . . . . from the main screen.
Last edited by wizniks; 04-17-2012 at 10:51 PM..
|