954,132 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

configure PHP to work with Mysql

Help Categories

<?

echo "";
echo "\n";
echo "";
echo "#";
foreach($data[0] as $key=>$val) {
echo "";
echo $key;
echo "";
}
echo "\n";
$row_cnt = 0;
foreach($data as $row) {
$row_cnt++;
echo "";
echo "".$row_cnt."";
foreach($row as $val) {
echo "";
echo $val;
echo "";
}
echo"\n";
}
echo "\n";

?>

Viji
Newbie Poster
12 posts since Mar 2006
Reputation Points: 10
Solved Threads: 0
 

Hey VG,

Upon first glance, I would suggest you try a lot less code for your initial run. A simple echo of "blah, blah" would suffice after you open the connection to the database.

I'm not real familiar with this specific error, but it sounds like it can't find the db. Here are some questions I have:Is the database name really mysql? [If so, you might want to consider renaming it]
Is the db on this same machine or on the net? [If on another machine, your connection needs the address]
Also, I remember having to load the PHP and MySQL application files in the root of the machine. [i.e. - not in a subdirectory] So, maybe you want to check that out too.

Best of luck - you're doing good so far!

VioletSite
Newbie Poster
7 posts since May 2006
Reputation Points: 10
Solved Threads: 0
 

hummmm, may be incompetibility between versions

try to google and install "XAMPP" and run the same query on it........

if it is incompetibility between php and mysql these are latest versions preconfigured and you will solve the problem

G L

Jxxxx
Newbie Poster
4 posts since May 2006
Reputation Points: 10
Solved Threads: 0
 

i am having problems getting mysql to work with php and apache. i have got apache running and php as well. all tested and working fine. i configured my php.ini file to recognize mysql but when i restarted the server and loaded the test page, i got a bland page instead. will be pleased if someone could help

saidus9
Newbie Poster
1 post since Dec 2009
Reputation Points: 10
Solved Threads: 0
 

Try making your own thread saidus9, don't hijack another person's.

Update to PHP5, unless you have very specific reasons for using PHP4.
The following link will explain the issue:
http://dev.mysql.com/doc/refman/5.0/en/old-client.html

@VioletSite,
The error can't be related to his DB name or location because this is an authentication error. He has to be authenticated before it would attempt a connection with any database.

Phaelax
Practically a Posting Shark
858 posts since Mar 2004
Reputation Points: 92
Solved Threads: 51
 

if the apache is working fine with the php create a php file and insert the following code in it;

<? echo phpinfo() ?>

if scroll through the generated page, if you should not see the mysql among then, try looking at your apache/config/httpd.conf.

kwesiaryee
Newbie Poster
11 posts since Jun 2008
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You