Use profile script isn't working
Posted: Wed Oct 12, 2011 8:05 pm
Hi guys,
I just finshed the two parts, and the video shows that an array is getting displayed once the scripts of both parts are created, but instead of seeing an array, I see error.
These are the errors I get when I open the user_list.php:
Warning: include(D:\Program Files\xampp\htdocs\userprofile\core/inc/user.inc.php) [function.include]: failed to open stream: No such file or directory in D:\Program Files\xampp\htdocs\userprofile\core\init.inc.php on line 10
Warning: include() [function.include]: Failed opening 'D:\Program Files\xampp\htdocs\userprofile\core/inc/user.inc.php' for inclusion (include_path='.;D:\Program Files\xampp\php\PEAR') in D:\Program Files\xampp\htdocs\userprofile\core\init.inc.php on line 10
Fatal error: Call to undefined function fetch_users() in D:\Program Files\xampp\htdocs\userprofile\user_list.php on line 17
I've put all the files in the right folders (init.inc.php is also in the core folder in the userprofile tutorial folder). What's going wrong?
This is the code I have so far:
init.inc.php
I just finshed the two parts, and the video shows that an array is getting displayed once the scripts of both parts are created, but instead of seeing an array, I see error.
These are the errors I get when I open the user_list.php:
Warning: include(D:\Program Files\xampp\htdocs\userprofile\core/inc/user.inc.php) [function.include]: failed to open stream: No such file or directory in D:\Program Files\xampp\htdocs\userprofile\core\init.inc.php on line 10
Warning: include() [function.include]: Failed opening 'D:\Program Files\xampp\htdocs\userprofile\core/inc/user.inc.php' for inclusion (include_path='.;D:\Program Files\xampp\php\PEAR') in D:\Program Files\xampp\htdocs\userprofile\core\init.inc.php on line 10
Fatal error: Call to undefined function fetch_users() in D:\Program Files\xampp\htdocs\userprofile\user_list.php on line 17
I've put all the files in the right folders (init.inc.php is also in the core folder in the userprofile tutorial folder). What's going wrong?
This is the code I have so far:
init.inc.php
<?php session_start(); mysql_connect('localhost', 'root', 'erohak'); mysql_select_db('user_profile'); $path = dirname(__FILE__); include("{$path}/inc/user.inc.php"); $_SESSION['iud'] = 1; ?>user.inc.php
<?php //fetches all of the users from the table function fetch_users(){ $result = mysql_query('SELECT 'id' AS 'id', 'username' AS 'username' FROM 'users''); $users = array(); while (($row = mysql_fetch_assoc($result)) !==false){ $users[] = $row; } return $users; } ?>user_list.php
<?php include('core/init.inc.php'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>registered user</title> </head> <body> <div> <?php print_r(fetch_users()); ?> </div> </body> </html>Who can help me out?