Possible Duplicate:
PHP: “Notice: Undefined variable” and “Notice: Undefined index”
if(isset($_POST['bul']))
{
$marka1=$_POST['marka'];
$model1=$_POST['model'];
$que="SELECT * from otomobil_tablosu WHERE markasi='$marka1' AND modeli='$model1'";
$res=mysql_query($que);
while($row = mysql_fetch_row($res)){
echo "<tr>";
echo "<td>" . $row['otomobilID'] . "</td>";
echo "</tr>";
}
when I want to print the row of table there is undefined index warning… I could not find the problem
The specific problem is that
mysql_fetch_row()returns an indexed array and not an associative. You wantmysql_fetch_assoc().The more general problem is that you’re using
mysql_*()functions, and are highly vulnerable to SQL injection. Please, don’t usemysql_*functions in new code. They are no longer maintained and are officially deprecated. See the red box? Learn about prepared statements instead, and use PDO or MySQLi – this article will help you decide which. If you choose PDO, here is a good tutorial.