First record in a search

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,
 
I have the following code and I am searching records from a table. I am getting all the results, but when I "un"comment the  lines I do not get the first record from the search result. I want to have those comment lines executing when no records are found, I want to display a message. 
 
I am searching from seven fields: native, from1, to1, from2, to2, from3 and to3, these fields have language names. Any help would be appreciated.
 
================
$sql = "SELECT
user_id, fname, mi, lname, native, from1, to1, from2, to2, from3, to3 
from memberinfo 
WHERE native='$_POST[language]' OR from1='$_POST[language]' OR to1='$_POST[language]'
OR from2='$_POST[language]' OR to2='$_POST[language]' OR from3='$_POST[language]'  OR from3='$_POST[language]'
ORDER BY lname"  ;

$result = @mysql_query($sql, $connection) or die(mysql_error());
 
/*
if (($row = mysql_fetch_array($result)) == 0)
{
 $member_list = "Sorry, we do not have any translators for $_POST[language]";
}
*/
 

$member_list = "<ul>";
while ($row = mysql_fetch_array($result))
{
$user_id = $row['user_id'];
$fname = $row['fname'];
$lname = $row['lname'];
$native = $row['native'];
$from1 = $row['from1'];
$to1 = $row['to1'];
$from2 = $row['from2'];
$to2 = $row['to2'];
$from3 = $row['from3'];
$to3 = $row['to3'];

$member_list .= "<li><a href=\"show_details.php?lname=$lname\">$lname, $fname</a>";
}
$member_list .= "</ul>";
 

?>


		
---------------------------------
Do you Yahoo!?
 The all-new My Yahoo! ? What will yours do?

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux