failed to open stream. helpp meeee:-<
hello..
i am a beginer in php..bought my text 2-3 days back actually..
i got this error when i tried executing a code from text...
it should create a database and define two tables user anad access_log!
Warning: include(./common_db.inc) [function.include]: failed to open stream: No such file or directory in C:\wamp\www\dbsample.php on line 2
Warning: include() [function.include]: Failed opening './common_db.inc' for inclusion (include_path='.;C:\php5\pear') in C:\wamp\www\dbsample.php on line 2
Fatal error: Call to undefined function db_connect() in C:\wamp\www\dbsample.php on line 23
please help em out!! i dunno what to do!! :-(
________________________________________
thsi is the code!
<?php
include "./common_db.inc";
$dbname = "sample_db";
$user_tablename = 'user';
$user_table_def = "usernumber MEDIUMINT(10) DEFAULT '0' NOT NULL AUTO_INCREMENT, ";
$user_table_def .= "userid VARCHAR(8) BINARY NOT NULL,";
$user_table_def .= "userpassword VARCHAR(20) BINARYNOT NULL,";
$user_table_def .= "username VARCHAR(30) NOT NULL,";
$user_table_def .= "userposition VARCHAR(50) NOT NULL,";
$user_table_def .= "useremail VARCHAR(50) NOT NULL,";
$user_table_def .= "userprofile TEXT NOT NULL,";
$user_table_def .= "UNIQUE usernumber (usernumber)";
$access_log_tablename = "access_log";
$access_log_table_def = "page VARCHAR(250) NOT NULL,";
$access_log_table_def .= "userid VARCHAR(8) BINARY NOT NULL,";
$access_log_table_def .= "visitcount MEDIUMINT(5) DEFAULT '0' NOT NULL,";
$access_log_table_def .= "accessdate TIMESTAMP(14) ,KEY page (page),";
$access_log_table_def .= "PRIMARY KEY (userid,page)";
$link_id = db_connect();
if(!$link_db) die(sql_error());
if(!mysql_query("CREATE DATABASE $dbname"
) die(sql_error());
echo "succesfully created the $dbname database.<br>";
if(!mysql_select_db($dbname)) die(sql_error());
if(!mysql_select_db("CREATE TABLE $user_tablename ($user_table_def)"
) die(sql_error());
if(!mysql_query("CREATE TABLE$access_log_tablename ($access_log_table_def)"
)
die(sql_error());
echo "successfully created the $user_tablename and$access_log_tablename tables.";
?>