How to connect PHPmyadmin to Flash CS4 using localhost

I am using wampserver, to run phpMyadmin. Phpmyadmin is working fine, and i have created the website without any problem. But i have run into a problem. Im basically following the tutorial below:

http://library.creativecow.net/articles/brimelow_lee/php_mysql/video-tutorial.php

My aim is to create a PHP file that will link with Flash CS4. But when testing the PHP file in a browser, which is an instruction of the tutorial, the database does not dispaly.

Two reasons why I think it may not work, I am a bit new to this, so am unsure if this is correct;

I am running it of local host  to connect the php file to a flash file using localhost is not possible???

The PHP coding is incorrect? although I have followed exactly what the tutorial said. NOTE: I have not used a password on the database on phpmyadmin, I tried to set it up a few times by going to privileges but this does not seem to work.

The code has been provided.

Kindly advise.
<?PHP

$link = mysql_connect("localhost","root");
mysql_select_db("qof_codes");

$query = 'SELECT * FROM disease_type';
$results = mysql_query($query);

echo "<?xml version=\"1.0\"?>\n";
echo "<disease_type>\n";

while($line = mysql_fetch_assoc($results)) {
        echo "<item>" . $line["product"] . "</item>\n";
        }
        
echo "</products>\n";
        
mysql_close($link);

?>

Open in new window

SherryRzvAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

psimationCommented:
1. $link = mysql_connect("localhost","root", "??password??");

2. echo "<disease_type>\n"; <<<<< <disease_type>

while($line = mysql_fetch_assoc($results)) {
        echo "<item>" . $line["product"] . "</item>\n";
        }
       
echo "</products>\n";  <<<<<< </disease_type> ??
0
SherryRzvAuthor Commented:
Thanks for your reply, so basically, I have to replace the above, into the the code? sorry for the q.
0
SherryRzvAuthor Commented:
Hi there, I followed the code you suggested.

This is what I got:

Not Found
The requested URL /Untitled-1.php was not found on this server.

Below is the reviewed code as I interpreted. Also inlcuded a screenshot of the PHP runnning in Dreamweaver. Kindly adivse

<?PHP

$link = mysql_connect("localhost","root", "??password??");
mysql_select_db("qof_codes");

$query = 'SELECT * FROM disease_type';
$results = mysql_query($query);

echo "<?xml version=\"1.0\"?>\n";
echo "<disease_type>\n"; <<<<< <disease_type>

while($line = mysql_fetch_assoc($results)) {
        echo "<item>" . $line["product"] . "</item>\n";
        }
       
echo "</products>\n";  <<<<<< </disease_type> ??
	
mysql_close($link);

?>

Open in new window

PHP.doc
0
psimationCommented:
HI

I think you miss-understood.

The first line :

$link = mysql_connect("localhost","root", "??password??");
 
What I'm syaing is - you usually need a password as well to connect to MySQL ( any DB for that matter in any language)

So, substitute ??password?? with whatever the "root" password is for your mysql.

Then, the two lines I indicated with <<<<<<< This was to point out potential other problems that may pop-up.

You are trying to output your results as XML, for that you need matching opening and closing nested nodes.

On line 10 you open the root node as <disease_type>, but on line 16 you close it as </products>, I think line 16 should also be </disease_types> ?

Also, try to change line1 as follow ( AFTER you put in your mysql root password"

$link = mysql_connect("localhost","root", "your_root_password_here") or die ("Cannot connect");

If you see "Cannot connect" when you try to load your page, then there is something wrong with your mysql connection or the credentials you are using.


0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.