It looks like an array error, but I can't see it.
Myerror message is
- selecttable is Title
sname is gift
Notice: Use of undefined constant ItemID - assumed 'ItemID' in c:\appserv\www\uptodatalinksnew\backendpages\excsearch.php on line 44
Notice: Use of undefined constant CategoryID - assumed 'CategoryID' in c:\appserv\www\uptodatalinksnew\backendpages\excsearch.php on line 45
Notice: Use of undefined constant Title - assumed 'Title' in c:\appserv\www\uptodatalinksnew\backendpages\excsearch.php on line 46
Notice: Use of undefined constant WebSite - assumed 'WebSite' in c:\appserv\www\uptodatalinksnew\backendpages\excsearch.php on line 47
Notice: Use of undefined constant Precis - assumed 'Precis' in c:\appserv\www\uptodatalinksnew\backendpages\excsearch.php on line 48
Notice: Use of undefined constant Description - assumed 'Description' in c:\appserv\www\uptodatalinksnew\backendpages\excsearch.php on line 49
The input form is
Code: Select all
<form method="POST" action="excsearch.php">
<p align="center">
<font size="2">EDITOR <input style="font-size: 11pt; " name="sname" size="20"></font>
<select style="font-size: 11pt; " name="selecttable">
<OPTION selected value="Title">Title</OPTION>
<OPTION value="WebSite">WebSite</OPTION>
<OPTION value="Priority">Priority</OPTION>
</select>
<input type="submit" value="Search">
</p>
</form>Code: Select all
<?
$host="localhost";
$user="root";
$passwd="";
$dbname="uptodatalinks";
$tbname="items";
$tbnamec="categories";
$selecttable=$_POST['selecttable'];
$sname=$_POST['sname'];
echo "selecttable is ".$selecttable;
echo "</br>";
echo "sname is ".$sname;
echo "</br>";
mysql_connect($host,$user,$passwd) or die("can not connect");
mysql_select_db($dbname) or die("can not select");
// search //
$sql="select * from $tbname where $selecttable like '%$sname%'";
$dbquery=mysql_db_query($dbname,$sql);
$num_rows=mysql_numrows($dbquery);
echo "<br><br>";
echo "<body bgcolor=\"#EFEFEF\">";
echo "<blockquote><table border=2 cellspacing=1 width=800>";
echo "<tr bgcolor=\"#ccddee\">";
echo "<td><font size=2>CategoryID</font></td>
<td><font size=2>Title</font></td>
<td><font size=2>WebSite</font></td>
<td><font size=2>Precis</font></td>
<td><font size=2>Description</font></td>
<td><font size=2>PictureName</font></td>
<td><font size=2>Priority</font></td>
<td><font size=2>Edit</font></td></tr>";
$i=0;
while ($i <$num_rows)
{
$result=mysql_fetch_array($dbquery);
$spid=$result[ItemID];
$CategoryID=$result[CategoryID];
$Title=$result[Title];
$WebSite=$result[WebSite];
$Precis=$result[Precis];
$Description=$result[Description];
$PictureName=$result[PictureName];
$Priority=$result[Priority];