Hi,
I am facing some problem in my database seach.The search giving exact result when i seach without else statement I mean if i search keyword field only ,the pagination is working fine. But if i seach more than one filed like keyword,name and discription using the if else statement, first page showing the exact result but the next page is showing the only the sql part included in else statement.
if ($searchtype == 'N') {
$sql = "select distinct id from article where name like '%$search%'";
}else if ($searchtype == 'd') {
$sql = "select distinct id from article where description like '%$search%'";
} else {
$sql = "select distinct id from article where keywords like '%$search%'";
}
result = mysql_query($sql ,$db);
$numrows = @mysql_numrows($result);
if ($searchtype == 'N') {
$sql = "select distinct id from article where name like '%$search%' LIMIT $limit,10";
}else if ($searchtype == 'd') {
$sql = "select distinct id from article where description like '%$search%' LIMIT $limit,10";
} else {
$sql = "select distinct id from article where keywords like '%$search%' LIMIT $limit,10";
}
Can anyone know is there any problem in the above code..?Please help me.
I have one more question.
Is there anyway we can display the same database field result in 2/3 rows..I mean if the field Name has the follwoing values
Name
a1
a2
a3
a4
a5
a6
Is there any way we can disply the names in
a1 a2 a3
a4 a5 a6
Thanks in advance.
Jene.