boboreo1222 Posted April 25, 2007 Author Share Posted April 25, 2007 Do I add that code to the top of Index.php? Quote Link to comment https://forums.phpfreaks.com/topic/48535-solved-newbie-database-help/page/2/#findComment-237607 Share on other sites More sharing options...
boboreo1222 Posted April 25, 2007 Author Share Posted April 25, 2007 When I added it to the top of Index.php, I got Warning: main(database/config.php): failed to open stream: No such file or directory in /home/bobbykig/public_html/index.php on line 3 Warning: main(database/config.php): failed to open stream: No such file or directory in /home/bobbykig/public_html/index.php on line 3 Warning: main(database/config.php): failed to open stream: No such file or directory in /home/bobbykig/public_html/index.php on line 3 Warning: main(): Failed opening 'database/config.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/bobbykig/public_html/index.php on line 3 Warning: main(database/login.php): failed to open stream: No such file or directory in /home/bobbykig/public_html/index.php on line 6 Warning: main(database/login.php): failed to open stream: No such file or directory in /home/bobbykig/public_html/index.php on line 6 Warning: main(database/login.php): failed to open stream: No such file or directory in /home/bobbykig/public_html/index.php on line 6 Warning: main(): Failed opening 'database/login.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/bobbykig/public_html/index.php on line 6 Quote Link to comment https://forums.phpfreaks.com/topic/48535-solved-newbie-database-help/page/2/#findComment-237610 Share on other sites More sharing options...
sanfly Posted April 25, 2007 Share Posted April 25, 2007 Are you sure you have the directory and paths correct http://www.bobbykingmagic.com/database/config.php gives me a page not found error..... Quote Link to comment https://forums.phpfreaks.com/topic/48535-solved-newbie-database-help/page/2/#findComment-237614 Share on other sites More sharing options...
boboreo1222 Posted April 25, 2007 Author Share Posted April 25, 2007 I have it located in my public_html foder and outside of my public_html folder. It still doesnt work Where do I have to put that? Public_ftp? Quote Link to comment https://forums.phpfreaks.com/topic/48535-solved-newbie-database-help/page/2/#findComment-237623 Share on other sites More sharing options...
sanfly Posted April 25, 2007 Share Posted April 25, 2007 Wait, I see the problem I guess that directory names are case sensitive because I can see a folder called "Database" SO this code <? ob_start(); include ("database/config.php"); ?> <? include("database/login.php"); ?> should really be this <? ob_start(); include ("Database/config.php"); ?> <? include("Database/login.php"); ?> does that work? Quote Link to comment https://forums.phpfreaks.com/topic/48535-solved-newbie-database-help/page/2/#findComment-237630 Share on other sites More sharing options...
boboreo1222 Posted April 25, 2007 Author Share Posted April 25, 2007 Nope All I have on my site now is Warning: mysql_connect(): Unknown MySQL server host 'database' (1) in /home/bobbykig/public_html/Database/config.php on line 3 Warning: mysql_select_db(): Access denied for user 'nobody'@'localhost' (using password: NO) in /home/bobbykig/public_html/Database/config.php on line 4 Warning: mysql_select_db(): A link to the server could not be established in /home/bobbykig/public_html/Database/config.php on line 4 Access denied for user 'nobody'@'localhost' (using password: NO) The rest of my site isnt there DO I ADD IT AT THE TOP OF MY PAGE? Quote Link to comment https://forums.phpfreaks.com/topic/48535-solved-newbie-database-help/page/2/#findComment-237632 Share on other sites More sharing options...
sanfly Posted April 25, 2007 Share Posted April 25, 2007 Great, we're one step closer! Okay, that means that your database connection info is all wrong Are you sure that you set up the mysql database correctly? What program does your webhost use? Cpanel? Can you please post the content of your config.php file? remember to remove the username and password before posting it Quote Link to comment https://forums.phpfreaks.com/topic/48535-solved-newbie-database-help/page/2/#findComment-237634 Share on other sites More sharing options...
boboreo1222 Posted April 25, 2007 Author Share Posted April 25, 2007 Yes. It uses cPanel <? ob_start(); // allows you to use cookies $conn = mysql_connect("NAME OF THE DATABAE","USERNAME TO CONNECT","PASSWORD TO CONNECT"); mysql_select_db(bobbykig_database) or die(mysql_error()); //fill in the above lines where there are capital letters. $logged = MYSQL_QUERY("SELECT * from users WHERE id='$_COOKIE[id]'"); $logged = mysql_fetch_array($logged); //the above lines get the user's information from the database. ?> Quote Link to comment https://forums.phpfreaks.com/topic/48535-solved-newbie-database-help/page/2/#findComment-237638 Share on other sites More sharing options...
boboreo1222 Posted April 25, 2007 Author Share Posted April 25, 2007 Where it LOGGED= MYSQL_QUERY Do I have to put a mySQL Query there Quote Link to comment https://forums.phpfreaks.com/topic/48535-solved-newbie-database-help/page/2/#findComment-237648 Share on other sites More sharing options...
sanfly Posted April 25, 2007 Share Posted April 25, 2007 Okay, go into cpanel, then click on "Manage MySql" On the next page, does it have your database listed under "Current Databases" if yes, have you spelt the database name correctly in your config.php file? Quote Link to comment https://forums.phpfreaks.com/topic/48535-solved-newbie-database-help/page/2/#findComment-237650 Share on other sites More sharing options...
sanfly Posted April 25, 2007 Share Posted April 25, 2007 Where it LOGGED= MYSQL_QUERY Do I have to put a mySQL Query there no, one thing at a time. We will come to that soon. Quote Link to comment https://forums.phpfreaks.com/topic/48535-solved-newbie-database-help/page/2/#findComment-237651 Share on other sites More sharing options...
boboreo1222 Posted April 25, 2007 Author Share Posted April 25, 2007 Do I have to include the bobbykig_??? Quote Link to comment https://forums.phpfreaks.com/topic/48535-solved-newbie-database-help/page/2/#findComment-237654 Share on other sites More sharing options...
sanfly Posted April 25, 2007 Share Posted April 25, 2007 Absolutely YES The same goes if that has been added to your user name Quote Link to comment https://forums.phpfreaks.com/topic/48535-solved-newbie-database-help/page/2/#findComment-237659 Share on other sites More sharing options...
boboreo1222 Posted April 25, 2007 Author Share Posted April 25, 2007 OK. I added that to my username and database name And it still appears with Warning: mysql_connect(): Unknown MySQL server host 'bobbykig_database' (1) in /home/bobbykig/public_html/Database/config.php on line 3 Warning: mysql_select_db(): Access denied for user 'nobody'@'localhost' (using password: NO) in /home/bobbykig/public_html/Database/config.php on line 4 Warning: mysql_select_db(): A link to the server could not be established in /home/bobbykig/public_html/Database/config.php on line 4 Access denied for user 'nobody'@'localhost' (using password: NO) Quote Link to comment https://forums.phpfreaks.com/topic/48535-solved-newbie-database-help/page/2/#findComment-237662 Share on other sites More sharing options...
per1os Posted April 25, 2007 Share Posted April 25, 2007 You were mis informed my friend <?php <? mysql_connect("hostname", "username", "password"); // ntoes hostname should be "localhost" mysql_select_db("dbname"); ?> www.php.net/mysql_connect www.php.net/mysql_select_db Quote Link to comment https://forums.phpfreaks.com/topic/48535-solved-newbie-database-help/page/2/#findComment-237669 Share on other sites More sharing options...
sanfly Posted April 25, 2007 Share Posted April 25, 2007 THis line here $conn = mysql_connect("NAME OF THE DATABAE","USERNAME TO CONNECT","PASSWORD TO CONNECT"); should be this $conn = mysql_connect("localhost","USERNAME TO CONNECT","PASSWORD TO CONNECT"); Quote Link to comment https://forums.phpfreaks.com/topic/48535-solved-newbie-database-help/page/2/#findComment-237671 Share on other sites More sharing options...
boboreo1222 Posted April 25, 2007 Author Share Posted April 25, 2007 Yes!!!!!!!!!!!!!! That worked! But I clicked on "Register Here" And it said "Page cannot be found" and is there still more of config.php we need to fix Quote Link to comment https://forums.phpfreaks.com/topic/48535-solved-newbie-database-help/page/2/#findComment-237672 Share on other sites More sharing options...
sanfly Posted April 25, 2007 Share Posted April 25, 2007 *Bangs head against wall* Thats because you have the wrong link! it should be http://www.bobbykingmagic.com/Database/register.php, but you have http://www.bobbykingmagic.com/register.php Thats it, I'm done! Quote Link to comment https://forums.phpfreaks.com/topic/48535-solved-newbie-database-help/page/2/#findComment-237678 Share on other sites More sharing options...
boboreo1222 Posted April 25, 2007 Author Share Posted April 25, 2007 I have fixed that problem Now, when I go to click login, I click it and nothing happens It isnt going anywhere. It is just a button. Quote Link to comment https://forums.phpfreaks.com/topic/48535-solved-newbie-database-help/page/2/#findComment-237682 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.