Jump to content

JakeTheSnake3.0

Members
  • Posts

    137
  • Joined

  • Last visited

Profile Information

  • Gender
    Male

JakeTheSnake3.0's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I actually am extending the product class through wineproduct, it's just that the product class includes 'productaward' and 'productreview'. Sample code for class.Product.php include('class.ProductReview.php'); class Product { public $reviews; public function AddReview($info) { $this->reviews[] = new ProductReview($info); } } Sample code for class.ProductReview.php class ProductReview { public $info; public function SaveToDB() { // This is where I generate the SQL query. Seeing as how the Product class contains the barcode # I need for it, // I figured I'd use parent::barcode to get it. It doesn't work. // So in my main code, I'd use $wine->reviews[0]->SaveToDB // With the structure I have now, I'd have to pass the barcode as an argument to the SaveToDB function. If there's a way of avoiding having to do that, I'd prefer it. } }
  2. For ease of use, filters are a no-brainer! Regex would be used for complex verification. Filters are just a way of saying "I only want numbers...or I want to verify that the email address is properly formed".
  3. $tmp = explode('-', $string); $string1 = $tmp[0] . '-' . $tmp[1]; $string2 = $tmp[2]; unset($tmp);
  4. I've made several classes which pertain to product information. They are as such: 1) class.Product.php 2) class.WineProduct.php 3) class.ProductReview.php 4) class.ProductAward.php Currently class.WineProduct.php extends class.Product.php; ProductReview and ProductAward are just included in the Product class - this I know is wrong because when I try to run a function from within that class I get the error: Here's a sample of the offending code: $wine = new WineProduct(); $wine->AddAward('Gold'); // This is the bad line: foreach($wine->awards as $awd) $awd->SaveToDB(); The SaveToDB function uses parent::barcode in an SQL query. The barcode is a property of the Product class. I know this has something to do with the include() statements...but what SHOULD I have done?
  5. Looking at the replies on the PHP manual page it might have something to do with your config. I just tested a simple script on my server and it didn't work either.
  6. One thing I noticed...your while (($file = readdir($dir)) !== false) is missing its open and close braces { }
  7. Flush? http://php.net/manual/en/function.flush.php
  8. Perhaps the password you used to originally register is different from what you're using now? On your register.php form echo the $password variable just before you md5 it to verify what's being put into the md5 function.
  9. You NEED to ECHO what you're retrieving from the database! Otherwise how are you supposed to know what's going wrong?
  10. echo your $password and $dbpassword to see what you're getting from both the form input and the database. If they're different, you know something's up.
  11. Try and use another SELECT query wrapped outside of that one which uses DISTINCT on just the id of the product.
  12. Your login.php script isn't md5'ing the password when you compare the values retrieved from the database. You're comparing the actual password with the md5 password stored in the database. In any case, a better way of retrieving a result from the database would be to include the md5'ed password in the query and only return a single result. If no results are returned, the user/pass combo didn't work.
  13. Open the attachment to see what I see. I only see one product (and product image) per line. I still don't know what you mean when you say you want two images before the break. The code I gave you should have been enough to do what you intend (insert a <br /> element every X times). All you needed to do was use a counter variable. [attachment deleted by admin]
  14. Even if you store the timestamps in the database in a different way, you can use PHP's strtotime() function to convert the timestamp into a UNIX timestamp (which is just an integer). The best way to test out things like this is to make a dedicated "test page". For example: My domain is "youbetcha.net". I have a password-protected test directory right beneath it which holds a single .php file called 'index.php'. So to do simple testing, I'd go to "http://youbetcha.net/test/". In the index.php file, I'd just have a vanilla HTML layout with a simple PHP script testing whatever it is I wanted to test. So in this case, you'd put the following in your test file: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" style="width:100%"> <head> <title>File Content-Type Test</title> </head> <body> <?php $datein = 'September 5, 2010'; $dateout = 'September 6, 2010'; $di = strtotime($datein); $do = strtotime($dateout); // Seeing as how UNIX timestamps are just integers, use simple subtraction. // Keeping in mind that they are still integers, $diff will also be an integer. // Seeing as how UNIX timestamps are measured in seconds since Unix Epoch // We need to do some basic math to convert it into hours. Rounding is up // to you. See PHP's documentation on time() @ php.net/time $diff = $do - $di; echo 'Date In: ' . $datein . ' > Unix Timestamp: ' . $di . '<br />'; echo 'Date Out: ' . $dateout . ' > Unix Timestamp: ' . $do . '<br />'; echo 'Time Difference (Hours): ' . ($diff/60)/60; ?> </body> </html>
  15. To be honest, looking at the site I still don't know what you're trying to do. I only see one image (of a car) per item, even after selecting some of the dropdowns. In any case, whenever you are in a loop and you want to do something at every X (where X is a digit), use the modulo. if ($myVar % 2 == 0) // run every other time if ($myVar % 3 == 0) // run every 3rd time $myVar in those instances would be a counter variable
×
×
  • 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.