Go4Expert

Go4Expert (http://www.go4expert.com/)
-   PHP (http://www.go4expert.com/forums/php/)
-   -   my search page is not work in server (http://www.go4expert.com/forums/search-page-server-t23897/)

abosirage 18Nov2010 13:06

my search page is not work in server
 
hi everybody
its me again help me if you can
my search page is not work in server please check my code below & find out what is wrong with it
Code:

<HTML>
<?php
include ('config.php');
if (isset($_POST['searchstring']))
{
 $sql="SELECT * FROM personnel WHERE $searchtype LIKE '%$searchstring%' ORDER BY firstname ASC";
 $result = mysql_query($sql);
 echo "<TABLE BORDER=0 align=center>";
 echo"<TR><td align=center width=190><B>الاجـــراء</B><td align=center width=190><B>الاسم واللقب</B><td align=center width=190><B>العنــوان</B></TR>";
while ($myrow = mysql_fetch_array($result))
 {
echo "<TR><td align=center><a href=\"view.php?id=".$myrow["id"]."\">عرض</a>";
 echo "<td align=center>".$myrow["firstname"]." ".$myrow["lastname"]."<td align=center>".$myrow["nick"];
 }
 echo "</TABLE>";
}
else
{
?>
<form method="POST" action="<?php $PHP_SELF ?>">
<table border="0" cellspacing="2" align=center>
<tr><td align=center width=190><b>مجال البحث</b></td>
<td align=center width=190><b>ادخل كلمة البحث</b></td></tr>
<tr>
<td align=center width=150>
<p dir="rtl"><select size="1" name="searchtype">
<option selected value="firstname">الاســـــم</option>
<option value="lastname">اللقــــب</option>
<option value="nick">العنوان</option>
<option value="email">البريد الالكتروني</option>
</select></td>
<td align=center width=150>
<p align="left" dir="rtl">
<input name="searchstring" size="22" style="float: right"></td>
</tr>
<tr><td colspan=3>
<p>&nbsp;&nbsp; <input type="submit" value="ابحث" name="B1" align=middle>&nbsp;&nbsp; <input type="reset" value="تراجع" name="B2">&nbsp; </p>
</td></tr>
</table>
<p align="center"><b><span lang="ar-sa"><a href="serch.php">بحث جديد</a>&nbsp;&nbsp;&nbsp;
<a href="viewdb.php">عودة للقائمة</a></span></b></p>
</form>
<?php
}
?>
</HTML>


shabbir 18Nov2010 14:57

Re: my search page is not work in server
 
You should learn how to post code by now. Read the link I have in the reason if you still don't know.

Second thing is you should be specific for what is not running. I see your code even with just opening and closing HTML tag can run on any server.

abosirage 18Nov2010 15:15

Re: my search page is not work in server
 
dear Shabbir
I am very sorry I didn't get you

shabbir 18Nov2010 16:09

Re: my search page is not work in server
 
Nor did I get your error.

abosirage 18Nov2010 16:18

Re: my search page is not work in server
 
dear Shabbir

when I run above code my result is this error:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in .../serch.php on line 10

shabbir 18Nov2010 16:26

Re: my search page is not work in server
 
Again I assume the issue is with the Query. Print your SQL Query. I think the variable searchtype is not initialized.


All times are GMT +5.5. The time now is 05:14.