Jump to content

$con=mysql_connect(" "," "," "); not workig in notepad++


tanvirzafar
 Share

Recommended Posts

hello friends i have a problem..i create a page in localhost db.php here is its code

<?php$con= mysql_connect("localhost:8080","root","");$db = mysql_select_db('gcuf',$con);?>

it is looking fine...but it doesnot work....when i see the page where i include this one it does not show me any error also not connect to database...dont know what's going on...my apache is running on port 8080

tell me its solution please??

Link to comment
Share on other sites

what are you expecting it to do though? You make a connection and select a database, that's it. You don't aren't sending any output.

 

However, 8080 is likely not the port you want to connect to. By default SQL server runs on port 3306. Just try "localhost"

Link to comment
Share on other sites

what are you expecting it to do though? You make a connection and select a database, that's it. You don't aren't sending any output.

 

However, 8080 is likely not the port you want to connect to. By default SQL server runs on port 3306. Just try "localhost"

i try localhost...but it doesnot connect...as the other keyword become dark blue color in notepad++ these mysql_connect and mysql)select_db not become like other....not work???

Link to comment
Share on other sites

Forget Notepad++, it has nothing to do with how PHP works.

 

Are you running this page on a server with PHP enabled?

 

You should check for errors as well.

<?php$con= mysql_connect("localhost:8080","root","");if(!$con) {    echo 'Connection error: ' . mysql_error();    exit;}$db = mysql_select_db('gcuf',$con);?>
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...