1
carl2k
php errors
  • 2005/8/16 2:51

  • carl2k

  • Just popping in

  • Posts: 3

  • Since: 2005/8/13


hey guys i'm back with another problem. I think I have installed PHP, Apache and mySQL correctly coz I can get that php info table from localhost and I was able to create a table and insert values in mySQL. But when I program in php to access mySQL I get several errors.

The code I put in is pretty simple just a user login verification where username and password was supplied through a form in the previous page:

$username = $_POST['username'];
$password = $_POST['password'];

// Database Variables
$DBhost = "localhost";
$DBuser = "";
$DBpass = "password";
$DBname = "testDB";
$tableName = "user";


// Connect to database and select database $DBname.
mysql_connect($DBhost,$DBuser,$DBpass)
or die("Unable to connect to database");
mysql_select_db("$DBname")
or die("Unable to select database $DBname");

echo("connected to $DBname");
?>


The errorS I get is

Notice: Undefined index: username in C:\server\Apache2\htdocs\Website\validate.php on line 52

Fatal error: Call to undefined function mysql_connect() in C:\server\Apache2\htdocs\Website\validate.php on line 65



This is a standard connection to databases but it doesn't seem to work for me. WHY?????

2
Grizzlydk
Re: php errors
  • 2005/8/30 8:01

  • Grizzlydk

  • Just popping in

  • Posts: 68

  • Since: 2005/2/24


Can't quite help you if don't supply the following information:

1. What server do u use
2. What version of Apache are u using
3. What version of Php are u using
4. What version of MySQL are u using

Hint allways check apache logs..
Danish is viery iasy to spoke

3
Mithrandir
Re: php errors

Also check with a
phpinfo();
?>

whether MySQL is loaded.
"When you can flatten entire cities at a whim, a tendency towards quiet reflection and seeing-things-from-the-other-fellow's-point-of-view is seldom necessary."

Cusix Software

Login

Who's Online

385 user(s) are online (341 user(s) are browsing Support Forums)


Members: 0


Guests: 385


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits