icon Get the most out of Surmunity, read our tips here! Need an interesting blog to read? You've got to read the Surpass Blog! | Welcome! Please register to access all of our features.

» Surpass Web Hosting Forums » Discussions » PHP, MySQL » A little help...

PHP, MySQL General PHP questions. Or go to our PHPsuexec Forum >>

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread
Old August 31st, 2004, 8:49 AM   #10 (permalink)
Registered User
Seasoned Poster
 
NirTivAal's Avatar
 
Joined in Nov 2003
80 posts
Gave thanks: 0
Thanked 0 times
Sure, just give me a day or so. My PHP is a little rusty.
NirTivAal is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old August 31st, 2004, 8:55 AM   #11 (permalink)
the one who was
Super #1
 
patrickb's Avatar
 
Joined in Jul 2003
Lives in Memphis
1,967 posts
Gave thanks: 0
Thanked 3 times
Bigjohn, how much experience do you have with PHP? I know of a way to do this, but would like to know where to start off with it for you.
__________________
Patrick

Warnings: The program(s) might crash unexpectedly or behave otherwise strangely. (But of course, so do many commercial programs on Windows.) --www.gimp.org
patrickb is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old August 31st, 2004, 8:57 AM   #12 (permalink)
minor deity
Super #1
 
Bigjohn's Avatar
 
Joined in Apr 2004
Lives in Georgia
Hosted on XEON
7,395 posts
Gave thanks: 28
Thanked 94 times
Quote:
Originally Posted by patrickb
Bigjohn, how much experience do you have with PHP? I know of a way to do this, but would like to know where to start off with it for you.
I can do the basic stuff. The site in question - mcdonoughfineart.com - is PHP/Mysql. All the pages are 'built' using database query and PHP. I'm a pretty quick study.
__________________
Proud to be a Surmunity Mod!
XEON PASS60 PASS61
Make a fundamental difference!
My Sites:
Curious about Brewing Beer? Join the community!
>>>>> Some Change is GOOD! Keep your paycheck! Support the Fair Tax
Get into an Art museum
Victorian London
It's your brain -ON WEB - mybrainhost.com (under development)
What SHOULD Government do? Much Less than it Does!
Bigjohn is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old August 31st, 2004, 9:11 AM   #13 (permalink)
the one who was
Super #1
 
patrickb's Avatar
 
Joined in Jul 2003
Lives in Memphis
1,967 posts
Gave thanks: 0
Thanked 3 times
Ok, good... Then goto http://www.zend.com/zend/spotlight/c...lery-wade8.php and set that up. It's custom sessions that are stored in a database. Basics of it are simple, a cookie with the session ID is stored on the users computer, then the rest of the session is kept in a mysql database.

The basic premise of the idea that I have in mind is that you will store the cart items in an array via session variables. Something like $_SESSION['cart'][0] = item #1 etc...

Then when you want to add items into the array/cart the code would look something similar to:

Code:
$_SESSION['cart'][] = <new item variable here, however it is designed>
And finally when it comes time to review the cart a simple:

Code:
foreach ($_SESSION['cart'] as $count => $item) {
  echo "<html code outputting whatever format and the items description>";
}
It's a very simplistic design and should work well with some tweaking. Try reading up on that and thinking about it, then post your thoughts and questions back here.
__________________
Patrick

Warnings: The program(s) might crash unexpectedly or behave otherwise strangely. (But of course, so do many commercial programs on Windows.) --www.gimp.org
patrickb is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old August 31st, 2004, 9:18 AM   #14 (permalink)
minor deity
Super #1
 
Bigjohn's Avatar
 
Joined in Apr 2004
Lives in Georgia
Hosted on XEON
7,395 posts
Gave thanks: 28
Thanked 94 times
Excellent.

I'll have a look. Don't think I'll have a chance today...

Can you email me at bigjohns at gmail? I want to discuss the stats problems I've been having on Pass5
__________________
Proud to be a Surmunity Mod!
XEON PASS60 PASS61
Make a fundamental difference!
My Sites:
Curious about Brewing Beer? Join the community!
>>>>> Some Change is GOOD! Keep your paycheck! Support the Fair Tax
Get into an Art museum
Victorian London
It's your brain -ON WEB - mybrainhost.com (under development)
What SHOULD Government do? Much Less than it Does!
Bigjohn is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old August 31st, 2004, 9:19 AM   #15 (permalink)
Registered User
Seasoned Poster
 
NirTivAal's Avatar
 
Joined in Nov 2003
80 posts
Gave thanks: 0
Thanked 0 times
Here's basically what you need to do. Some of the code might be wrong, since I've spent the summer learning C++ instead of working on PHP.

This first file should be include()ed first thing, since it sets and modifies cookies.
Code:
/* I'm assuming that the way you refrence paintings is by a unique print number, since there's only one piece of data per print you only need one cookie.

I'm also assuming that the user clicked a link to add the print to their cart, and the info was passed in the URI (example: mcdonoughfineart.com/index.php?printnum=574) */

$print_num = addslashes($_GET['printnum']);
$order = addslashes($_COOKIE['order_data']);

/* Now that you have the two pieces of data used by the program you need to determine what to do with them */

if ($print_num) { // If there is a print number
   if  ($order) {   // If there is a cookie already
      $order += ";$print_num";      // Append new print num to the order
      /* The semicolon is placed in front of the $print_num so that numbers don't run together, this variable will be explode()ed later on */
   } else { // No cookie exists, set a new one
       setcookie('order_data,$print_num); /* Create a new cookie and include the oprder data */
} else {  // If there is no print number do nothing

}
NirTivAal is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old August 31st, 2004, 9:40 AM   #16 (permalink)
minor deity
Super #1
 
Bigjohn's Avatar
 
Joined in Apr 2004
Lives in Georgia
Hosted on XEON
7,395 posts
Gave thanks: 28
Thanked 94 times
Thanks Nir. I'll look at that too.

Patrick - i replied to your email and it bounced!
__________________
Proud to be a Surmunity Mod!
XEON PASS60 PASS61
Make a fundamental difference!
My Sites:
Curious about Brewing Beer? Join the community!
>>>>> Some Change is GOOD! Keep your paycheck! Support the Fair Tax
Get into an Art museum
Victorian London
It's your brain -ON WEB - mybrainhost.com (under development)
What SHOULD Government do? Much Less than it Does!
Bigjohn is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old August 31st, 2004, 9:44 AM   #17 (permalink)
L'Awesome Advocate
Super #1
 
Ancyru's Avatar
 
Joined in May 2004
Lives in .au
Hosted on Mango
2,423 posts
Gave thanks: 1
Thanked 5 times
It's a one-way email.
__________________
When I get sad, I stop being sad, and be AWESOME instead. True story.
Ancyru is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old August 31st, 2004, 10:16 AM   #18 (permalink)
the one who was
Super #1
 
patrickb's Avatar
 
Joined in Jul 2003
Lives in Memphis
1,967 posts
Gave thanks: 0
Thanked 3 times
Heheh, one-way email, the sure way to never receive spam again.

BJ, not quite sure why it bounced, but messages are coming through for me now again. Try it one more time and let me know.
__________________
Patrick

Warnings: The program(s) might crash unexpectedly or behave otherwise strangely. (But of course, so do many commercial programs on Windows.) --www.gimp.org
patrickb is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On