Jump to content

*very* dumb question: PHP errors on simple shopping cart demo


kreen

Recommended Posts

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);

?>

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

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??

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... :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.