connecting MySQL and PHP

Hi there! new to this newsgroup and need help!
i've installed php5 and mysql 5 on IIS 5(W XP prof),
i got php working fine and by using command line i can
create databases and tables fine!

Now trouble is i can't get my php files to fetch
information from databases/mysql server, i have uncommented
the php_mysql.dll in the php ext folder and also copied libmysql.dll in
window system
still nothing is howing up!

Where am i doing wrong!

Thanks
Landrik [ Di, 16 Mai 2006 11:34 ] [ ID #1317033 ]

Re: connecting MySQL and PHP

landrik [at] gmail.com wrote:
>
> i've installed php5 and mysql 5 on IIS 5(W XP prof),
> i got php working fine and by using command line i can
> create databases and tables fine!
>
> Now trouble is i can't get my php files to fetch
> information from databases/mysql server, i have uncommented
> the php_mysql.dll in the php ext folder and also copied libmysql.dll in
> window system
> still nothing is howing up!
>
> Where am i doing wrong!

Did you get any error messages? What does mysql_error() return if you
call it?

Cheers,
NC
nc [ Di, 16 Mai 2006 19:25 ] [ ID #1317036 ]

Re: connecting MySQL and PHP

landrik [at] gmail.com wrote:
>
> i've installed php5 and mysql 5 on IIS 5(W XP prof),
> i got php working fine and by using command line i can
> create databases and tables fine!
>
> Now trouble is i can't get my php files to fetch
> information from databases/mysql server, i have uncommented
> the php_mysql.dll in the php ext folder and also copied libmysql.dll in
> window system
> still nothing is howing up!
>
> Where am i doing wrong!

Did you get any error messages? What does mysql_error() return if you
call it?

Cheers,
NC
nc [ Di, 16 Mai 2006 19:28 ] [ ID #1317037 ]

Re: connecting MySQL and PHP

<landrik [at] gmail.com> ha scritto nel messaggio
news:1147772042.416082.278280 [at] i40g2000cwc.googlegroups.com.. .
> Hi there! new to this newsgroup and need help!
> i've installed php5 and mysql 5 on IIS 5(W XP prof),
> i got php working fine and by using command line i can
> create databases and tables fine!
>
> Now trouble is i can't get my php files to fetch
> information from databases/mysql server, i have uncommented
> the php_mysql.dll in the php ext folder and also copied libmysql.dll in
> window system
> still nothing is howing up!
>

please post
<?
phpinfo();
?>


> Where am i doing wrong!
>
> Thanks
>
Gufo Rosso [ Di, 16 Mai 2006 20:55 ] [ ID #1317038 ]

Re: connecting MySQL and PHP

I'm having the same problem, only on Apache 2.

PHPMyAdmin works fine, so I know the three are communicating, but my
scripts seem to do nothing, or at least output nothing.

My test script:

<html>
<head>

</head>
<body>

<?
$mysql = mysql_connect("localhost","cwrinn","password") or die('Unable
to Authenticate to ODBC'.mysql_error());
mysql_select_db(snapon_dev, $mysql) or die('Error Selecting
Database'.mysql_error());
$result = mysql_query("select * from branch limit 0,30", $mysql) or
die('Error querying database'.mysql_error());

while ($row = mysql_fetch_row($result))
{
for ($i=0; $i<mysql_num_fields($result); $i++)
echo $row[$i] . " ";

echo "\n";
}
mysql_close($connection);
?>
</body>
</html>


I get no error message from my die() functions, no errors in my php
error_log. display_errors = On. Is there something I am missing?
c.wrinn [ Mi, 17 Mai 2006 23:03 ] [ ID #1318617 ]

Re: connecting MySQL and PHP

c.wrinn [at] gmail.com wrote:
>
> PHPMyAdmin works fine, so I know the three are communicating, but my
> scripts seem to do nothing, or at least output nothing.
>
> My test script:
>
> <html>
> <head>
>
> </head>
> <body>
>
> <?
> $mysql = mysql_connect("localhost","cwrinn","password") or die('Unable
> to Authenticate to ODBC'.mysql_error());
> mysql_select_db(snapon_dev, $mysql) or die('Error Selecting
> Database'.mysql_error());
> $result = mysql_query("select * from branch limit 0,30", $mysql) or
> die('Error querying database'.mysql_error());
>
> while ($row = mysql_fetch_row($result))
> {
> for ($i=0; $i<mysql_num_fields($result); $i++)
> echo $row[$i] . " ";
>
> echo "\n";
> }
> mysql_close($connection);
> ?>
> </body>
> </html>
>
>
> I get no error message from my die() functions, no errors in my php
> error_log. display_errors = On. Is there something I am missing?

Does your script file have a .php extension?
What happens if you replace "<?" with "<?php"?

Cheers,
NC
nc [ Do, 18 Mai 2006 18:27 ] [ ID #1320206 ]

Re: connecting MySQL and PHP

Am 17 May 2006 14:03:56 -0700 schrieb c.wrinn [at] gmail.com:

> I'm having the same problem, only on Apache 2.
>
> PHPMyAdmin works fine, so I know the three are communicating, but my
> scripts seem to do nothing, or at least output nothing.
>
> My test script:
>
> <html>
> <head>
>
> </head>
> <body>
>
> <?
> $mysql = mysql_connect("localhost","cwrinn","password") or die('Unable
> to Authenticate to ODBC'.mysql_error());
> mysql_select_db(snapon_dev, $mysql) or die('Error Selecting
> Database'.mysql_error());
> $result = mysql_query("select * from branch limit 0,30", $mysql) or
> die('Error querying database'.mysql_error());
>
> while ($row = mysql_fetch_row($result))
> {
> for ($i=0; $i<mysql_num_fields($result); $i++)
> echo $row[$i] . " ";
>
> echo "\n";
> }
> mysql_close($connection);
> ?>
> </body>
> </html>
>
>
> I get no error message from my die() functions, no errors in my php
> error_log. display_errors = On. Is there something I am missing?


Try
mysql_select_db("snapon_dev", $mysql)
instead of mysql_select_db("snapon_dev", $mysql)
(regrad the quotes)

or what is snapon_dev doing? A function?
- [ Do, 18 Mai 2006 19:59 ] [ ID #1320207 ]

Re: connecting MySQL and PHP

Am Thu, 18 May 2006 19:59:13 +0200 schrieb - [at] -.--:

> From: - [at] -.--
> Subject: Re: connecting MySQL and PHP
> Newsgroups: alt.php.sql
> User-Agent: 40tude_Dialog/2.0.15.1de
> MIME-Version: 1.0
> Content-Type: text/plain; charset="us-ascii"
> Content-Transfer-Encoding: 7bit
> References: <1147772042.416082.278280 [at] i40g2000cwc.googlegroups.com> <Yepag.375$cX1.3305 [at] twister2.libero.it> <1147899836.554322.306210 [at] g10g2000cwb.googlegroups.com>
> Date: Thu, 18 May 2006 19:59:13 +0200
> Message-ID: <pmj494llqnvl$.1e5kdmuetitry$.dlg [at] 40tude.net>
> NNTP-Posting-Host: 83.228.131.194
> X-Trace: news.tiscalinet.ch 1147975154 83.228.131.194 (18 May 2006 19:59:14 +0200)
> Organization: Customers of VTX Datacomm AG - http://www.datacomm.ch/
> Lines: 50
> Path: news.tiscalinet.ch!not-for-mail
> Xref: news.tiscalinet.ch alt.php.sql:24729
>
> Am 17 May 2006 14:03:56 -0700 schrieb c.wrinn [at] gmail.com:
>
>> I'm having the same problem, only on Apache 2.
>>
>> PHPMyAdmin works fine, so I know the three are communicating, but my
>> scripts seem to do nothing, or at least output nothing.
>>
>> My test script:
>>
>> <html>
>> <head>
>>
>> </head>
>> <body>
>>
>> <?
>> $mysql = mysql_connect("localhost","cwrinn","password") or die('Unable
>> to Authenticate to ODBC'.mysql_error());
>> mysql_select_db(snapon_dev, $mysql) or die('Error Selecting
>> Database'.mysql_error());
>> $result = mysql_query("select * from branch limit 0,30", $mysql) or
>> die('Error querying database'.mysql_error());
>>
>> while ($row = mysql_fetch_row($result))
>> {
>> for ($i=0; $i<mysql_num_fields($result); $i++)
>> echo $row[$i] . " ";
>>
>> echo "\n";
>> }
>> mysql_close($connection);
>> ?>
>> </body>
>> </html>
>>
>>
>> I get no error message from my die() functions, no errors in my php
>> error_log. display_errors = On. Is there something I am missing?
>
>
> Try
> mysql_select_db("snapon_dev", $mysql)
> instead of mysql_select_db("snapon_dev", $mysql)
> (regrad the quotes)
>
> or what is snapon_dev doing? A function?

Uuups
Sorry mistakes
I meant
.... instead of mysql_select_db(snapon_dev, $mysql)
- [ Do, 18 Mai 2006 20:01 ] [ ID #1320208 ]

Re: connecting MySQL and PHP

I don't know if it was the " " around the database name or the <?php,
but I applied both and it worked. Thanks, guys!
c.wrinn [ Do, 18 Mai 2006 22:21 ] [ ID #1320209 ]
PHP » alt.php.sql » connecting MySQL and PHP

Vorheriges Thema: UpGrading MySQL & PHPmyAdmin
Nächstes Thema: simple database modelling problem