Bad Credit Mortgages - Loans - Loans - Credit Counseling - Bean Bag Toss Game

PDA

View Full Version : Php Solutions chapter 13 issues


needPhphelp
Apr 27th 2008, 4:24 pm
I'm working out of David Powers' book Php Solutions and really stuck on chapter 13 about creating a content management system. I keep getting the following when I try to view the journal entries page in my browser.

Warning: include(../includes/conn_mysql.inc.php) [function.include]: failed to open stream: No such file or directory in /Applications/MAMP/htdocs/ch13/journal_list_mysql.php on line 2

Warning: include() [function.include]: Failed opening '../includes/conn_mysql.inc.php' for inclusion (include_path='.:/Applications/MAMP/bin/php5/lib/php') in /Applications/MAMP/htdocs/ch13/journal_list_mysql.php on line 2

Fatal error: Call to undefined function dbconnect() in /Applications/MAMP/htdocs/ch13/journal_list_mysql.php on line 4


I have uploaded all of the relevant files and I just can't figure out what's wrong with line 2 and or 4 or anything before them.

1 <?php
2 include('../includes/conn_mysql.inc.php');
3 // create database connection
4 $conn = dbConnect('query');
5 $sql = 'SELECT * FROM journal ORDER BY created DESC';
6 $result = mysql_query($sql) or die(mysql_error());
7 ?>


Here is con_mysql.inc.php Am I suppose to change all of this stuff somehow?

<?php
function dbConnect($type) {
if ($type == 'query') {
$user = 'psquery';
$pwd = 'fuji';
}
elseif ($type == 'admin') {
$user = 'psadmin';
$pwd = 'kyoto';
}
else {
exit('Unrecognized connection type');
}
$conn = mysql_connect('localhost', $user, $pwd) or die ('Cannot connect to server');
mysql_select_db('phpsolutions') or die ('Cannot open database');
return $conn;
}
?>

Please help.

CPURules
Apr 27th 2008, 5:28 pm
change line 2 to this:

include("/Applications/MAMP/htdocs/includes/conn_mysql.inc.php");