Hi all
i am using the following php page to auto connect me when i need to use mysql:
<?
define('Host','localhost');
define('User','voco');
define('Password','voconet');
define('DBName','AscentHair');
?>
This is one of the create pages it help me connect to:
<?php
include ("connect.php");
$TableName = "Stock";
$Link = mysql_connect ($Host, $User, $Password);
$Query = "CREATE table $TableName (id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, Prod_Name VARCHAR(40),
Prod_Picture VARCHAR(60), Prod_Des VARCHAR(60), Prod_Price DECIMAL(10,2), Stock_Lvl TINYINT(3))";
if ( mysql_db_query ($DBName, $Query, $Link))
{
print ("success");
}
else
{
print ("failed");
}
mysql_close($Link);
?>
it wont work though i keep gettiong the following errors:
Notice: Undefined variable: Host in C:\Program Files\Apache Group\Apache2\htdocs\adam\assignment\createtable.php on line 11
Notice: Undefined variable: User in C:\Program Files\Apache Group\Apache2\htdocs\adam\assignment\createtable.php on line 11
Notice: Undefined variable: Password in C:\Program Files\Apache Group\Apache2\htdocs\adam\assignment\createtable.php on line 11
Notice: Undefined variable: DBName in C:\Program Files\Apache Group\Apache2\htdocs\adam\assignment\createtable.php on line 20
failed
if i type out the following every time i need to connect it works fine but it means i have to type out all this every time i want to connect to the mysql:
$Host = "localhost";
$User = "voco";
$Password = "voconet";
$DBName = "AscentHair";
please help TIA