Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Basic Help (I think)

Status
Not open for further replies.

badley

Technical User
Dec 20, 2002
75
GB
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top