testing mysql
am 28.04.2006 21:12:13 von Gonzosez
i have apache 2.0.55, mysql 5.0.2 and php 5.1.2 I have gone through all the
steps, renaming phpinidist to php.ini and amending httpconf in the apache
folder with localhost, 127.0.0.1 admin email, however on running this sample
php script to determine if mysql is working fine:
// connect to the server:
$cn = mysql_connect("127.0.0.1","root","pass");
// run a simple query
$sql = "SELECT 'done' as my_field LIMIT 1";
$result = mysql_query($sql,$cn);
if($result)
{
// if it worked, print the result to screen
echo mysql_result($result,"my_field");
} else {
// otherwise, either the server isn't running
// or the username/password are wrong
echo mysql_error()."
You should see an error message above you?";
}
?>
on running it with http://localhost/mysql.php
I receive Fatal error: Call to undefined function mysql_connect() in
C:\webroot\mysql.php on line 3
I am a little stuck as to where to go from now
Re: testing mysql
am 28.04.2006 21:51:31 von Rik
Nospam wrote:
> I receive Fatal error: Call to undefined function mysql_connect() in
> C:\webroot\mysql.php on line 3
>
> I am a little stuck as to where to go from now
http://nl2.php.net/manual/en/ref.mysql.php:
Installation on Linux Systems
PHP 5+
MySQL is not enabled by default, nor is the MySQL library bundled with PHP.
Read this FAQ for details on why. Use the --with-mysql[=DIR] configure
option to include MySQL support. You can download headers and libraries from
MySQL.
Installation on Windows Systems
PHP 5+
MySQL is no longer enabled by default, so the php_mysql.dll DLL must be
enabled inside of php.ini. Also, PHP needs access to the MySQL client
library. A file named libmysql.dll is included in the Windows PHP
distribution and in order for PHP to talk to MySQL this file needs to be
available to the Windows systems PATH. See the FAQ titled "How do I add my
PHP directory to the PATH on Windows" for information on how to do this.
Although copying libmysql.dll to the Windows system directory also works
(because the system directory is by default in the system's PATH), it's not
recommended.
If you've done all that, what does phpinfo() say about your MySql support?
Grtz,
--
Rik Wasmus
Re: testing mysql
am 07.05.2006 14:30:32 von plato
"Nospam" wrote in message
news:hOt4g.40429$tc.11969@fe2.news.blueyonder.co.uk...
> i have apache 2.0.55, mysql 5.0.2 and php 5.1.2 I have gone through all
the
> steps, renaming phpinidist to php.ini and amending httpconf in the apache
> folder with localhost, 127.0.0.1 admin email, however on running this
sample
> php script to determine if mysql is working fine:
>
> // connect to the server:
> $cn = mysql_connect("127.0.0.1","root","pass");
>
> // run a simple query
> $sql = "SELECT 'done' as my_field LIMIT 1";
> $result = mysql_query($sql,$cn);
>
> if($result)
> {
> // if it worked, print the result to screen
> echo mysql_result($result,"my_field");
> } else {
> // otherwise, either the server isn't running
> // or the username/password are wrong
> echo mysql_error()."
You should see an error message above you?";
> }
> ?>
>
> on running it with http://localhost/mysql.php
>
> I receive Fatal error: Call to undefined function mysql_connect() in
> C:\webroot\mysql.php on line 3
>
> I am a little stuck as to where to go from now
>
Save yourself a headache...don't waste your time download WAMP and it will
install the whole 3 for you with a minimum of fuss....
Go here: www.en.wampserver.com
cheers
Re: testing mysql
am 15.05.2006 22:51:03 von Jim Moore
I was having the same problem, took the advise to install WAMP and had no
success. I searched on Google and the link
http://www.faqts.com/knowledge_base/view.phtml/aid/23162/fid /1150 reports
that PHP 5 does not add support for MySQL automatically. To use it, you
have to edit php.ini and move the dll identified.
Jim Moore
"plato" wrote in message
news:445de81e$1@news.rivernet.com.au...
>
> "Nospam" wrote in message
> news:hOt4g.40429$tc.11969@fe2.news.blueyonder.co.uk...
>> i have apache 2.0.55, mysql 5.0.2 and php 5.1.2 I have gone through all
> the
>> steps, renaming phpinidist to php.ini and amending httpconf in the apache
>> folder with localhost, 127.0.0.1 admin email, however on running this
> sample
>> php script to determine if mysql is working fine:
>>
>> // connect to the server:
>> $cn = mysql_connect("127.0.0.1","root","pass");
>>
>> // run a simple query
>> $sql = "SELECT 'done' as my_field LIMIT 1";
>> $result = mysql_query($sql,$cn);
>>
>> if($result)
>> {
>> // if it worked, print the result to screen
>> echo mysql_result($result,"my_field");
>> } else {
>> // otherwise, either the server isn't running
>> // or the username/password are wrong
>> echo mysql_error()."
You should see an error message above you?";
>> }
>> ?>
>>
>> on running it with http://localhost/mysql.php
>>
>> I receive Fatal error: Call to undefined function mysql_connect() in
>> C:\webroot\mysql.php on line 3
>>
>> I am a little stuck as to where to go from now
>>
> Save yourself a headache...don't waste your time download WAMP and it will
> install the whole 3 for you with a minimum of fuss....
>
> Go here: www.en.wampserver.com
>
> cheers
>
>