hello ,
i am looking for some to help me with this basic php function to connect with MySQL.
as i am new to php programming , i had tried to connect my php page with MySQL with mysql_connect function.but the browser says like this" HTTP 500 Internal server Error".I am using IIS on XP os. can any one explain me about this?
---->mysql_connect("host","username","passoword")
--->what is host??
--->what is the username??
--->what is the password??
when i have installed MySQL(5.0) it only asked me for password.it doesn't ask me about any user name.
Basic Help for mysql_connect
Moderator: General Moderators
-
thawfeekyahya
- Forum Newbie
- Posts: 2
- Joined: Wed Jan 13, 2010 6:05 am
Re: Basic Help for mysql_connect
Host is the ip address or host name.
Username and password is sql's username and password
Username and password is sql's username and password
Re: Basic Help for mysql_connect
you should be able to connect with:
mysql_connect("localhost","root","")
mysql_connect("localhost","root","")
If its anything like the latest WAMP - you dont add a password just hit enter. Always best to try that first anyway - if you havent set up any username or password its a good chance there isnt one.thawfeekyahya wrote:when i have installed MySQL(5.0) it only asked me for password
-
thawfeekyahya
- Forum Newbie
- Posts: 2
- Joined: Wed Jan 13, 2010 6:05 am
Re: Basic Help for mysql_connect
I am trying to configure MySQL, IIS, and PHP to work together.
I have the following code:
<?php
$con = mysql_connect("localhost","peter","abc123");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
// some code
?>
When I run it through IIS I get "HTTP 500 Internal Server Error".
When I run several other PHP scripts(that don't include mysql commands) through IIS they work fine.
Any ideas what could possibly be wrong?
I have the following code:
<?php
$con = mysql_connect("localhost","peter","abc123");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
// some code
?>
When I run it through IIS I get "HTTP 500 Internal Server Error".
When I run several other PHP scripts(that don't include mysql commands) through IIS they work fine.
Any ideas what could possibly be wrong?
Re: Basic Help for mysql_connect
(After some googling...)
If you are using Internet Explorer to view your code try going to Internet Options then Advanced and DESELECT 'Show friendly HTTP errors' then run the code again.
This should then show the full error from your server, hope this helps.
If you are using Internet Explorer to view your code try going to Internet Options then Advanced and DESELECT 'Show friendly HTTP errors' then run the code again.
This should then show the full error from your server, hope this helps.
Last edited by aravona on Wed Jan 13, 2010 7:26 am, edited 1 time in total.
Re: Basic Help for mysql_connect
Also enable show errors in the php.ini file