0

Pls help:

Warning: require(connect_to_mysql.php) [function.require]: failed to open stream: No such file or directory in C:\wamp\www\chibenda\root_directory\index.php on line 3

<?php  

$db_host = "localhost"; 
// Place the username for the MySQL database here 
$db_username = "root";  
// Place the password for the MySQL database here 
$db_pass = "";  
// Place the name for the MySQL database here 
$db_name = "chibenda"; 

// Run the connection here  
mysql_connect("$db_host","$db_username","$db_pass") or die ("could not connect to mysql"); 
mysql_select_db("$db_name") or die ("no database");              
?>

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

<?php
session_start();
require "connect_to_mysql.php";

// Build Main Navigation menu and gather page data here
$sqlCommand="SELECT id,linklabel FROM pages ORDER BY pageorder ASC";
$query=mysqli_query($myConnection,$sqlCommand)or die(mysqli_error());

$menuDisplay='';
while($row=mysqli_fetch_array($query)){
	$pid=$row["id"];
	$linklabel=$row["linklabel"];

	$menuDisplay='<a href="index.php?pid='  . $id . '">Home</a><br/>';

}
mysqli_free_result($query);
//mysqli_close_result($query);
?>
2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by drjohn
0

REQUIRE "connect_to_mysql.php";
means you must have a file of that name, which will then contain your connection details.

So, is the opening bit of PHP code you give saved in a file called connect_to_mysql.php and in the same folder as the other file that uses it?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.