Izzit posibble to make simple search on mysql database

lazyyan 10 Jan, 2009
hi admin and chatter,

Izzit posibble to make simple search on mysql database, if u have the script , can u share it

thank you
GreyHead 10 Jan, 2009
Hi lazyyan,

Errrrr . . . what database, what search??

Bob
lazyyan 10 Jan, 2009
hi GreyHead,

search by passport num and show it , if their alrealdy register or not

example my field name for passport is tmykad

<?
$hostname = "127.0.0.1"; // Usually localhost.
$username = "username_for_mysql"; // If you have no username, leave this space empty.
$password = "your_password"; // The same applies here.
$usertable = "table_name"; // This is the table you made.
$dbName = "database_name"; // This is the main database you connect to.
MYSQL_CONNECT($hostname, $username, $password) OR DIE("Unable to connect to database");
@mysql_select_db( "$dbName") or die( "Unable to select database");
?>
<?
//error message (not found message)
$XX = "No Record Found";
$query = mysql_query("SELECT * FROM $usertable WHERE $metode LIKE '%$search%' LIMIT 0, 30 ");
while ($row = mysql_fetch_array($query))
{
$variable1=$row["tmykad"];

print ("this is for $variable1, and this print the variable2 end so on...");
}

//below this is the function for no record!!
if (!$variable1)
{
print ("$XX");
}
//end
?>
GreyHead 10 Jan, 2009
Hi lazyyan,

If the table is in the Joomla database (or you could copy it there) then you can use ChronoConenctivity to do this very simply assuming that you just want to display the results.

It's a bit more complicated if the table isn't in the Joomla database; or if you want to include the data in an editable form.

Bob
This topic is locked and no more replies can be posted.