Ive finally found out how to do it, its actually a UNION query and not a Join, since join requires a fields with the exact same data, wich a union query will fuse the data together even tho theres no data resemblance in none of youre tables.
this is the link where i found my info:
-
http://www.w3schools.com/Sql/sql_union.asp
here my code for people who would be looking how to do this too.
-so this code will search my mysql database for a document name and the link for that document.
-and will make a search box where you only need to input a single letter and it will give you a list of all entries from the database where the letter youve inputed in found.
-then it will make a list where you see the name of the documents, ad if you click on the name it will open the document.
<?php <br mode="hold" /?> //Get the q parameter from URL
$q=$_GET["q"];
$hint="";
$link = mysql_connect('pcmu-seb99', 'Support5000', 'bob');
if (!$link)
{
die('Could not connect: '.mysql_error());
}
mysql_select_db("support5000");
$query='SELECT Nom, Lien_Nom FROM procedures WHERE Nom LIKE "%'.$q.'%"
UNION ALL
SELECT Nom, Lien_Nom FROM applications WHERE Nom LIKE "%'.$q.'%"
UNION ALL
SELECT Nom, Lien_Nom FROM faqs WHERE Nom LIKE "%'.$q.'%"
UNION ALL
SELECT Nom, Lien_Nom FROM reg WHERE Nom LIKE "%'.$q.'%"';
$result = mysql_query($query);
$row_count=mysql_num_rows($result);
while ($row = mysql_fetch_array($result))
{
$appName = $row['Nom'];
$appLink = $row['Lien_Nom'];
if ($hint=="")
{
$hint="<a href="".$appLink."" target="_blank">".$appName."</a>";
}
else
{
$hint=$hint."<br /><a href="".$appLink."" target="_blank">".$appName."</a>";
}
}
// Set output to "no suggestion" if no hint were found
// or to the correct values
if ($hint=="")
{
$response="no suggestions...";
}
else
{
$response=$hint;
}
//output the response
echo $response;
?>