Page 1 of 1

MySQL / PHP

Posted: Wed Aug 11, 2004 1:29 pm
by sama
I am running php and MySQL. If I run MySQL at cmd command prompt or through windows explorer, it works, I can create database, tables, insert data, etc. Here no problem, it works.

But when I am running the following code, just to make sure I am connected to the database, it does not work. When I run the following code, no error messages or not even 'success' message. Blank white
screen pops up. Even I refreshed id. Same.

Also, when I run phpInfo(), it works fine. Shows all the info.
Can anybody help me to fix this please.
I am running Windows 2000, IIS.


<?
$connection = @mysql_connect("d2rsyc11","myUN","myPW") or die(mysql_error());
if ($connection) {
$msg = "success!";
}
?>
<? echo "$msg"; ?>

Posted: Wed Aug 11, 2004 1:30 pm
by m3mn0n
Remove the @.

That supresses error messages.

Posted: Wed Aug 11, 2004 1:33 pm
by sama
Sami, I did what you said.
now this error message,
Fatal error: Call to undefined function mysql_connect() in c:\Inetpub\wwwroot\php5code\db_connect.php on line 4

line #4 = $connection = mysql_connect("d2rsyc11.","un","pw");

Posted: Wed Aug 11, 2004 1:38 pm
by m3mn0n
Run this:

Code: Select all

<?php
phpinfo();
?>
What does it say about MySQL?

Posted: Wed Aug 11, 2004 1:41 pm
by sama
Thank you for your time, the following is the result of
your latest code. Please help. Thank you again.

Array
(
[0] => bcmath
[1] => calendar
[2] => com_dotnet
[3] => ctype
[4] => ftp
[5] => iconv
[6] => libxml
[7] => odbc
[8] => pcre
[9] => session
[10] => SPL
[11] => SQLite
[12] => standard
[13] => tokenizer
[14] => zlib
[15] => dom
[16] => SimpleXML
[17] => wddx
[18] => xml
)

Posted: Wed Aug 11, 2004 1:42 pm
by m3mn0n
Sorry I changed the script. ;)

MySQL is built-in so it won't show up on the extension list.

Run phpinfo() and tell me what it says about MySQL.

Posted: Wed Aug 11, 2004 1:43 pm
by feyd
looks to me like he's running php5, in which case, mysql isn't built-in.

Posted: Wed Aug 11, 2004 1:44 pm
by m3mn0n
Yep. Just what I was thinking could be the problem...

Posted: Wed Aug 11, 2004 1:48 pm
by sama
This is the heading,

PHP Version 5.0.0

Posted: Wed Aug 11, 2004 1:59 pm
by m3mn0n
Have a read of this article: http://www.raditha.com/mysql/mysqli.php

If you use Windows, check out: http://forums.devshed.com/archive/t-160413