pheroMona13
pheroMona13

Reputation: 472

I can't access my database in localhost using xampp

i use Xampp and its not work on port 80 so i've changed it to 8080 and now apache and mysql works fine. my problem is that when im try to access to a database that i already created on phpmyadmin it wont work!

i use this code:

<?php
$requesturi = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$pos = strpos($requesturi, "uni");

$hostname_excal = "localhost:8080";
$database_excal = "my_database";
$username_excal = "root";
$password_excal = "123456";

$excal = mysql_pconnect($hostname_excal, $username_excal, $password_excal) or trigger_error(mysql_error(),E_USER_ERROR); 
?>

i try localhost for hostname and it doesnt work either.

i test this in my online host and its works fine. but i need this to work on localhost so i can present this in a meeting.

help me please.

Upvotes: 0

Views: 7371

Answers (2)

Tomazi
Tomazi

Reputation: 847

It looks like you have miss spelled the php function it should be:

mysql_connect

you have

mysql_pconnect

also I strongly recooment you do not use mysql at all, it is varnible to injections, try learing mysli or pdo

Upvotes: 0

rafaelbpa
rafaelbpa

Reputation: 512

Did you changed the standart password? Xampp uses "" as initial password.

Try this:

$hostname_excal = "localhost";
$database_excal = "my_database";
$username_excal = "root";
$password_excal = "";

Upvotes: 1

Related Questions