kreen Posted September 9, 2008 Share Posted September 9, 2008 Okay, this is my first time ever working with databases so I'm very sorry for my stupidity! I'm trying to use this demo: http://www.thewatchmakerproject.com/journal/276/building-a-simple-php-shopping-cart and get it running here: http://www.mindbodyandchild.com/boutique/ but getting these errors: Notice: Could not connect to server in /home/mindbody/public_html/boutique/inc/mysql.class.php on line 76 Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/mindbody/public_html/boutique/inc/mysql.class.php:76) in /home/mindbody/public_html/boutique/index.php on line 9 I downloaded the zip of all the files given at the end of the article, but does it not include the database? There are no txt files and I'm unsure where to specify the database if I create one, though I assume it's in the global.inc.php file here: <?php $host = 'localhost'; $user = 'root'; $pass = ''; $name = ''; $db = &new MySQL($host,$user,$pass,$name); ?> Link to comment https://forums.phpfreaks.com/topic/123516-very-dumb-question-php-errors-on-simple-shopping-cart-demo/ Share on other sites More sharing options...
BlueSkyIS Posted September 9, 2008 Share Posted September 9, 2008 yes, it assumes you have a MySQL database running on localhost. you'd need to add your MySQL user name and password to that config file to connect. Link to comment https://forums.phpfreaks.com/topic/123516-very-dumb-question-php-errors-on-simple-shopping-cart-demo/#findComment-637886 Share on other sites More sharing options...
kreen Posted September 9, 2008 Author Share Posted September 9, 2008 yes, it assumes you have a MySQL database running on localhost. you'd need to add your MySQL user name and password to that config file to connect. Thank you! I'm going to try adding that part right now... Link to comment https://forums.phpfreaks.com/topic/123516-very-dumb-question-php-errors-on-simple-shopping-cart-demo/#findComment-637898 Share on other sites More sharing options...
BlueSkyIS Posted September 9, 2008 Share Posted September 9, 2008 hm, i think user is your MySQL user name and pass is your MySQL password. that should make name the name of the database.... Link to comment https://forums.phpfreaks.com/topic/123516-very-dumb-question-php-errors-on-simple-shopping-cart-demo/#findComment-637901 Share on other sites More sharing options...
kreen Posted September 9, 2008 Author Share Posted September 9, 2008 hm, i think user is your MySQL user name and pass is your MySQL password. that should make name the name of the database.... I just created a user and password through the MySQL Database section in cPanel....now i have to figure out what the name of the database is supposed to be in his example: http://www.thewatchmakerproject.com/journal/276/building-a-simple-php-shopping-cart Link to comment https://forums.phpfreaks.com/topic/123516-very-dumb-question-php-errors-on-simple-shopping-cart-demo/#findComment-637907 Share on other sites More sharing options...
BlueSkyIS Posted September 9, 2008 Share Posted September 9, 2008 i believe that the name of the database can be anything as long as you set the configuration to the same value. Link to comment https://forums.phpfreaks.com/topic/123516-very-dumb-question-php-errors-on-simple-shopping-cart-demo/#findComment-637911 Share on other sites More sharing options...
kreen Posted September 9, 2008 Author Share Posted September 9, 2008 i believe that the name of the database can be anything as long as you set the configuration to the same value. Wow thanks for such fast replies! I really have such dumb questions though... I know I should be starting from scratch to learn the "right" way but his tutorial seemed so easy at first! Especially since he had the zip with all the files, but i guess that was all the files except the database. So can I ask, in his explanation: http://www.thewatchmakerproject.com/journal/276/building-a-simple-php-shopping-cart which part is the database supposed to include?? Link to comment https://forums.phpfreaks.com/topic/123516-very-dumb-question-php-errors-on-simple-shopping-cart-demo/#findComment-637921 Share on other sites More sharing options...
kreen Posted September 9, 2008 Author Share Posted September 9, 2008 Okay I think I got rid of one level of my stupidity! Now I only have these errors: http://www.mindbodyandchild.com/boutique/ Notice: Query failed: Table 'mindbody_phpcart.books' doesn't exist SQL: SELECT * FROM books ORDER BY id in /home/mindbody/public_html/boutique/inc/mysql.class.php on line 109 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/mindbody/public_html/boutique/inc/mysql.class.php on line 151 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/mindbody/public_html/boutique/inc/mysql.class.php on line 167 So I'm making progress! And possibly even learning... Link to comment https://forums.phpfreaks.com/topic/123516-very-dumb-question-php-errors-on-simple-shopping-cart-demo/#findComment-637946 Share on other sites More sharing options...
kreen Posted September 9, 2008 Author Share Posted September 9, 2008 I got it working! Thanks again for answering my newb questions. Now I just have to make this: http://www.mindbodyandchild.com/boutique/index.php Look like this: http://www.mindbodyandchild.com/boutique.php Link to comment https://forums.phpfreaks.com/topic/123516-very-dumb-question-php-errors-on-simple-shopping-cart-demo/#findComment-637958 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.