PHP - Moved: Using Php To Find Out 5 Top Customers In Mysql Database.
This topic has been moved to MySQL Help.
http://www.phpfreaks.com/forums/index.php?topic=343372.0 Similar TutorialsThis topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=312600.0 This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=321218.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=343257.0 This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=359217.0 This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=326703.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=308347.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=334042.0 I am working on a website which sells various content, including books/guides in an online format. A lot of people - including here - have stated that they wouldn't make a purchase on my site if I didn't also offer a PDF version of books/guides. (I guess more people read offline than I do personally?!) Right now, I am working on the ecommerce portion so people can browse a catalog, choose a book/guide, add it to their cart, and check out. (Just your textbook ecommerce metaphors.) After making a purchase, when someone logs in, then they can navigate to a gallery which contains thumbnails representing all of the books they have purchased. And by clicking on a given thumbnail, they will be taken to that particular online book which is a series of linked web pages protected from outsiders behind a paywall. I am comfortable with all of this, however I'm stuck on what to do with the PDFs... First off, when someone is in the Product Catalog picking out books and guides, should I give them the chance to specify if they want a PDF version, or should I just give everyone that buys a book/guide both access to the online book/guide PLUS the PDF version as well? Next, for customers who get a PDF, how should I deliver it to them? Do I make the PDF available when they navigate to their online book? Do I build a second gallery which only shows PDFs that have been purchased? Do I leave links to the PDFs up indefinitely, or should I just offer a one-time download? And if so, how would I go about that? In summary, something that seems so simple actually is very confusing the more I think about it. This is probably because I have never bought online books or PDFs before and so I don;t have any examples in my mind to go off of. Could definitely use some advice here, and am hoping this won't be as difficult as it currently seems?! Thanks.
I have a list of products in database and some have the same itemid but a different price depending on size What i want to do i if the itemid has more than one size, take the smallest price and then add the word "From" at the beginning. I've tried using the MIN() function but can't get it to do what i want. If there is only one size it works fine but if there is more than one it just says "From 0.00" Code: [Select] while ($row = $result->fetch()) { if(!isset($items[$row['itemid']])) { $items[$row['itemid']] = $row; } $items[$row['itemid']]['sizes'][$row['size']] = $row['price']; ### CHANGED ### } foreach($items AS $subitem) { list($prodid, $itemid, $item, $size, $description, $shortdesc, $image, $price) = $subitem; //Create field for item name based upon record count if(count($subitem['sizes']) > 1) { /*$item_name_field = "<ul>\n"; foreach($subitem['sizes'] as $size => $price) ### CHANGED ### {*/ //} //$item_name_field .= "<ul>\n"; $myprice = explode(".",number_format(min($subitem['price']),2)); $item_name_field .= "<li>From ".$myprice[0].".".$myprice[1]." {$size}</li>\n"; } else { $myprice = explode(".",number_format($subitem['price'],2)); $item_name_field .= "<li><span class=\"ucprice\">£".$myprice[0]."<?span><span class=\"lcprice\">.".$myprice[1]."</span></li>\n"; } This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=328966.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=306039.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=311598.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=350064.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=315388.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=306874.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=321386.0 This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=350034.0 Hi there I'm trying to work out how I'd go about searching my database for URLs that have been submitted by users that are duplicates. Now this isn't as simple as http://www.example.com/something.php and http://www.example.com/something.php oh no! People have entered links such as http://www.example.com//something.php or http://www.example.com///something.php The script (I didn't write it) currently see's these links as unique, but they're not. They function exactly the same way. Anyone have any advice on how to weed these out? I was thinking maybe a straight forward LIKE '%//%' in the mySQL syntax, but this will bring all URLs up due to the http:// aspect of the link Any feedback would be appreciated! At the moment I am creating a search function for my website. The approach I have in mind is a pseudo-PHP database. To give an example: A HTML form will submit the results to a PHP file. HTML FORM - Colour: Black PHP RESULT PAGE - if ($_POST['color'] == 'Black') {readfile("./products/black/*.html");} HTML FORM - Price: <$50 PHP RESULT PAGE - if ($_POST['Price'] == '<$50') {readfile("./products/less50/*.html");} The problem here is if there is an item that is black and costs less than $50, then its going to be listed twice. There is probably some code I can write to ommit the listing of duplicate entries, but it is probably going to be messy, so I am wondering if its better to use a centralized MySQL database, rather than a pseudo-PHP database? I've never used MySQL and don't know much about it and this is my first real attempt at using PHP. I have a payment button for PayPal which securely stores the amount, but when the payment is made how do i know if it was paid or not so i can get the page to store this in the mysql database? |