
April 16th, 2008, 09:26 AM
|
|
Registered User
|
|
Join Date: Apr 2008
Posts: 1
Time spent in forums: 1 m 11 sec
Reputation Power: 0
|
|
|
Help with php script
Hi
I am having problems retrieving data from my mysql database. I have the database called blc and a table called Companies.
within this table is 5 rows, of which I only want to request 4 (catagory, company, description, value).
I have the following code and because I want to use this with my all flash website I have added the XML coding (this is the part that is not working). Has anyone any ideas why my page is returing 0 results?
I am using the following code:
Code:
<?PHP
$link = mysql_connect("localhost","username","password");
mysql_select_db("blc");
$query = 'SELECT catagory, company, description, value FROM Companies';
$results = mysql_query($query);
echo "<?xml version=\"1.0\"?>\n";
echo "<company>\n";
while($line = mysql_fetch_assoc($results)) {
echo "<item>" . $line["catagory"] . "</item>\n"
echo "<item>" . $line["company"] . "</item>\n"
echo "<item>" . $line["description"] . "</item>\n"
echo "<item>" . $line["value"] . "</item>\n";
}
echo "</company>\n";
mysql_close($link);
?>
Thank you.
Steve
|