Dear:
I am making a web site which can mage discs. I use MS Access to make a data table, SQL and PHP so query. My code:
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE> RESULT PAGE </TITLE>
</HEAD>
<BODY>
<font align="center" face=VNI-Netbut color = #336699 > <H1> RESULT </H1> </font>
<table align="center" border = 1 bordercolor=#006699 cellpading = 1 cellspacing = 1 bgcolor=#66ccff fontcolor=#ffffff>
<tr> <th> ID </th> <th> TITLE </th> <th> GENRE </th> <th>QUANTITY</th> </tr>
<?php
ket noi vao co so du lieu
$c = odbc_connect("danhmucdia","","");
$fsqlstart = 1;
$newSQL = "select * from danhmucdia";
if($id != "")
{
$newSQL = "$newSQL where MS like '%$id%' ";
$fsqlstart = 0;
}
if($title != "")
{
if($fsqlstart == 1)
$newSQL = "$newSQL where TenDia like '%$title%' ";
else
$newSQL = "$newSQL and TenDia like '%$title%' ";
$fsqlstart = 0;
}
if($genre != "")
{
if($fsqlstart == 1)
$newSQL = "$newSQL where TheLoai like '%$genre%' ";
else
$newSQL = "$newSQL and TheLoai like '%$genre%' ";
$fsqlstart = 0;
}
if($quantity != "")
{
if($fsqlstart == 1)
$newSQL = "$newSQL where SoDia like '%$quantity%' ";
else
$newSQL = "$newSQL and SoDia like '%$quantity%' ";
$fsqlstart = 0;
}
$query = $newSQL;
$result = odbc_exec($c,$query);
while( odbc_fetch_row($result) )
{
$MS = odbc_result($result,1);
$TenDia = odbc_result($result,2);
$TheLoai = odbc_result($result,3);
$SoDia = odbc_result($result,4);
print("<tr> <td>$MS</td> <td>$TenDia</td> <td>$TheLoai</td> <td>$SoDia</td> </tr> \n");
}
tat ket noi vao co so du lieu
odbc_close($c);
?>
</table>
<p></p>
<a href = "quanlydia1.htm"> Main Page </a>
</BODY>
</HTML>
My errors:
Warning: Undefined variable: id in C:\Inetpub\wwwroot\QuanLyDia\find.php on line 20
Warning: Undefined variable: title in C:\Inetpub\wwwroot\QuanLyDia\find.php on line 26
Warning: Undefined variable: genre in C:\Inetpub\wwwroot\QuanLyDia\find.php on line 35
Warning: Undefined variable: quantity in C:\Inetpub\wwwroot\QuanLyDia\find.php on line 44
So, how can i solve this problem ???
please help me as soon as possible...
Thanks again
Dannis Yang