hi AIS4U i have solved the problem ... the code works well, now i have other two problems... if you can help me ...
FIRST
when i make e search withr the key field without words i have this message:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource
that is referred to this line:
while ($row = mysql_fetch_array ($dati)){
i'd like that in this case the user is redirect to an error page...
THIS IS THE CODE
<?php
include("data.php");
include("paging.func.php");
$link=mysql_connect("$sql_host","$sql_user","$sql_pass");
$tutto = "SELECT A.*, B.* FROM members AS A INNER JOIN profiles AS B ON A.mem_id = B.mem_id";
$query = mysql_db_query ($sql_db,$tutto)
or die ("Non riesco ad eseguire la richiesta $tutto");
$righe = mysql_num_rows ($query);
if ($settore == "10"){ $settorevar = ''; }
else{ $settorevar = "and B.industry = '$settore'"; }
if ($nazione == "all"){ $nazionevar = ''; }
else{ $nazionevar = "and A.country = '$nazione'"; }
?>
<?
if (isset($chiave)){
$parole= explode(" ",$chiave); // Explode the keywordstring, and create an array
$query = array(); // Define the querybase as an empty array
foreach($parole as $chiave) // for each value in the keywords array
{
if(!empty($chiave)) // check against empty values
{ // Now create an individual array value for each keyword
$query[] = "(fname LIKE '%$chiave%'
or lname LIKE '%$chiave%'
or interests LIKE '%$chiave%'
or books LIKE '%$chiave%'
or about LIKE '%$chiave%'
or skills LIKE '%$chiave%'
or p_positions LIKE '%$chiave%'
or schools LIKE '%$chiave%'
or hometown LIKE '%$chiave%'
or here_for LIKE '%$chiave%'
or specialities LIKE '%$chiave%'
or overview LIKE '%$chiave%'
or travel LIKE '%$chiave%'
)" ;
}
}
$query_str = implode(" and ", $query); // merge all array elements, use AND between individual sections
// Now finish the querystring with required sql commands
$query_string = "
SELECT A.*, B.*
FROM members AS A
INNER JOIN profiles AS B
ON A.mem_id = B.mem_id $nazionevar $settorevar
WHERE ".$query_str." GROUP BY A.mem_id";
$dati=mysql_db_query("$sql_db",$query_string);
while ($row = mysql_fetch_array ($dati)){
$verifica=$row["books"];
echo "
<table border='0' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#f9f9f9' width='100%' id='AutoNumber1' height='35'>
<tr>
<td width='12' background='images/giallosx.jpg'> </td>
<td background='images/giallocen.jpg'>
<p align='center' class='societa '>
Membro Corrispondente ad i criteri di ricerca </td>
<td width='12' background='images/giallodx.jpg'> </td>
</tr>
</table>";
echo" <TABLE width='100%' cellpadding='10' class='lined' > <tr> <td width='100%' colspan='2' class='societa'> ";
echo " <font class='orangeheader'><a href=\"index.php?mode=people_card&p_id=".$row["mem_id"]."\">".$row["lname"]." ".$row["fname"]."</a></font><br>";
echo "frase di presentazione: <font class='posizione'>".$row["here_for"]."</font><br>";
echo "</td></tr></table><br> ";
}
if (!$verifica){
print ("Nessuna corrispondenza
per la parola <font color=#000080>$chiave</font>");
}
}else{
echo "Elenco Corrispondenze";
}
mysql_close ($link);
?>
SECOND
I'd like to split the search reluts in several page if they are a lot... i have a page with an external function but i can't integrate it ... if i post you the function do you think you can help me?
Thanks ... bye