Running this code with PHP5 Mysql4 and IIS:
<?php require ('connect.php');
$query = 'select * from product';
$result = $db->query($query);
$num_results = $result->num_rows;
echo '<p> Number of Products found : ' .$num_results. '</p>' ;
for ($i=0; $i <$num_results; $i++)
{
$row = $result->fetch_assoc();
echo'<p>' . ($i+1) . ' .Name: ';
echo htmlspecialchars(stripslashes($row[ ' Name ' ]));
echo '</strong><br />Description : ';
echo stripslashes ($row[ ' Description ' ]);
echo '</strong><br />Provider ID : ';
echo stripslashes ($row[ ' ProviderID ' ]);
echo '</strong><br />Category ID : ';
echo stripslashes ($row[ ' CategoryID ' ]);
echo '</strong><br />Class ID : ';
echo stripslashes ($row[ ' ClassID ' ]);
echo '</strong><br />Entry Date : ';
echo stripslashes ($row[ ' EntryDate ' ]);
}
$result->free();
$db->close();
?>
Outcome is as follows:
Number of Products found : 1
1 .Name:
Notice: Undefined index: $Name in c:\Inetpub\ on line 19
Description :
Notice: Undefined index: Description in c:\Inetpub\ on line 21
Provider ID :
Notice: Undefined index: ProviderID in c:\Inetpub\ on line 23
Category ID :
Notice: Undefined index: CategoryID in c:\Inetpub\ on line 25
Class ID :
Notice: Undefined index: ClassID in c:\Inetpub\ on line 27
Entry Date :
Notice: Undefined index: EntryDate in c:\Inetpub\ on line 29
Can anyone advise me on what is going wrong here?
Any help would be greatfull
<?php require ('connect.php');
$query = 'select * from product';
$result = $db->query($query);
$num_results = $result->num_rows;
echo '<p> Number of Products found : ' .$num_results. '</p>' ;
for ($i=0; $i <$num_results; $i++)
{
$row = $result->fetch_assoc();
echo'<p>' . ($i+1) . ' .Name: ';
echo htmlspecialchars(stripslashes($row[ ' Name ' ]));
echo '</strong><br />Description : ';
echo stripslashes ($row[ ' Description ' ]);
echo '</strong><br />Provider ID : ';
echo stripslashes ($row[ ' ProviderID ' ]);
echo '</strong><br />Category ID : ';
echo stripslashes ($row[ ' CategoryID ' ]);
echo '</strong><br />Class ID : ';
echo stripslashes ($row[ ' ClassID ' ]);
echo '</strong><br />Entry Date : ';
echo stripslashes ($row[ ' EntryDate ' ]);
}
$result->free();
$db->close();
?>
Outcome is as follows:
Number of Products found : 1
1 .Name:
Notice: Undefined index: $Name in c:\Inetpub\ on line 19
Description :
Notice: Undefined index: Description in c:\Inetpub\ on line 21
Provider ID :
Notice: Undefined index: ProviderID in c:\Inetpub\ on line 23
Category ID :
Notice: Undefined index: CategoryID in c:\Inetpub\ on line 25
Class ID :
Notice: Undefined index: ClassID in c:\Inetpub\ on line 27
Entry Date :
Notice: Undefined index: EntryDate in c:\Inetpub\ on line 29
Can anyone advise me on what is going wrong here?
Any help would be greatfull