Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. I see more and more Belgian users so that makes me wonder how many actually are on this forum. So tell us your real name, city, age and occupation if you live in or have lived in Belgium. We could be neighbors without knowing Ignace Knops, Landen, 23, Webdeveloper If there are enough users from a certain city we could setup regular meetings where we could discuss adventures or hold presentations about PHP specific topics.
  2. If you are looking for best practices then you may not be interested in CMS systems especially open-source as they usually contain anything but best practices. A few things I picked up from Google http://net.tutsplus.com/tutorials/php/30-php-best-practices-for-beginners/ (2009 http://www.odi.ch/prog/design/php/guide.php (2005) http://www.mikebernat.com/blog/My_PHP_Best_Practices (2008)
  3. ignace

    XML DTD Issues

    What do you exactly want to do?
  4. When I was younger, so much younger than today, I never needed anybody's help in any way.. Help me if you can, I'm feeling down and I do appreciate you being round. Help me, get my feet back on the ground, won't you please, please help me?
  5. PEAR::Mail is no different then mail() it only allows you to use something different then the native PHP mailer. It will not tell you if your recipient actually received the e-mail. There are a few other ways though you can use: 1. Use a 1x1 pixel image <img src="http://www.yourserver.com/mail-received.php?email=.." width="1" height="1> Ofcourse if their e-mail client blocks images you'll never know who read it. 2. Use the Return-Path header. This will send an e-mail back to you in the event a mail could not be received. You can use PHP to read incoming mail (http://www.evolt.org/article/Incoming_Mail_and_PHP/18/27914/index.html) Your best option is to use http://www.campaignmonitor.com/ this is a tool that provides you with all the needed statistics
  6. If you use the built-in DateTime & DateInterval classes you could just use: while ($row = mysql_fetch_assoc($result)) { $start = new DateTime($row['start']); $end = new DateTime($row['end']); $interval = $end->diff($start); // replaces time_compare() if ($interval->invert) { echo 'Item Sold'; continue; } // these 4 lines replace your entire time_format() function with equal functionality echo (!empty($interval->d) ? $interval->d . ' days ' : ''), (!empty($interval->h) ? $interval->h . ' hours ' : ''), (!empty($interval->i) ? $interval->i . ' minutes ' : ''), (!empty($interval->s) ? $interval->s . ' seconds ' : ''); } If you extend both the DateTime & DateInterval class it can be as simple as: while ($row = mysql_fetch_assoc($result)) { $start = new MyDateTime($row['start']); $end = new MyDateTime($row['end']); $interval = $end->diff($start); // replaces time_compare() if ($interval->isSold()) { echo 'Item Sold'; continue; } // these 4 lines replace your entire time_format() function with equal functionality echo $interval; }
  7. That's because Windows uses \ not / file:///c:\xampp\htdocs\images\xxx.jpg
  8. What is your current setup? One page for every song? If so then at the minimum you are going to have to write at every page: include('modules/comments/index.php'); Edit: nevermind read it wrong What do you actually want in the system? user registration/login, promote/demote, mark as spam?
  9. Your XML is wrong <item name="whatever"> <request by="someone" confirmed="true"/> </item> Then you can use: /item[name="whatever"] Now you have to query all by: /item/request/by | //by And go over each element, retrieve it's value and check if it equals
  10. You basically want to create a game-balancer? SELECT g.id, count(p.*) AS player_count FROM groups g LEFT JOIN players ON g.id = p.group_id ORDER BY player_count LIMIT 1 This should give you the ID of the group that has the lowest number of players
  11. LOL 0D0A is the equivalent of \n for which their is a function called nl2br
  12. Excel has an option to format XML: 1. remove the empty row #1 2. Create a dummy XML file with all elements/attributes and empty values 3. Go to Options for Excel > Popular > Show tab developers 4. Go to the new tab Developers, press Source a window on the right appears 5. Press XML assignments a new dialog box appears, press Add 6. Select your dummy XML and press Ok 7. In the window on the right your elements/attributes appear, drag & drop them on your heading 8. Return to the Developers tab and press Export This may be a quicker way to format your data as Excel is compatible with Access which in turn can use ODBC for which their is a MySQL driver
  13. You have this when you send it. Create the unsubscribe link in the newsletter you send out. If you are using outlook it may give you an option to add a parameter in your e-mail that will be changed when it sends it.
  14. That query is wrong as there is no table with the name prod as for your InnoDB it might give problems. Create a SELECT query that selects all the data that needs to be deleted then transform it in a DELETE query using my code as a base
  15. $result = mysql_query("SELECT * FROM cart WHERE session_id = $sid OR user_id = $uid"); $products = array(); while ($row = mysql_fetch_assoc($result)) { $products[$row['id']] = $row; echo '<input type="text" name="product[', $row['id'], ']" value="', $row['quantity'], '">'; } //.. if (isset($_POST['product']) && is_array($_POST['product'])) { foreach ($_POST['product'] as $id => $quantity) { $id = intval($id); $quantity = intval($quantity); if (isset($products[$id])) { if ($quantity <= 0) { mysql_query("DELETE FROM table WHERE user_id = $uid AND id = $id"); } else if ($quantity != $products[$id]['quantity']) { mysql_query("UPDATE table SET quantity = $quantity WHERE id = $id"); } } } }
  16. Do you want to store the error's? Or do you want to display them directly?
  17. ignace

    XML DTD Issues

    <!ELEMENT option (choose)><!-- you forgot > --> <!ELEMENT choose (one|two|three) >
  18. Move price & quantity out of your products table then add these tables: products_sizes (id, size_name); products_has_sizes (products_id, products_sizes_id, price, quantity); SELECT p.name, p.description, ps.size_name, phs.price, phs.quantity FROM products_has_sizes phs JOIN products p ON phs.product_id = p.id JOIN products_sizes ps ON phs.products_id = ps.id This will return: Vintage T-Shirt, .., S, 5.99, 15 Vintage T-Shirt, .., M, 8.99, 3 Vintage T-Shirt, .., L, 10.99, 7
  19. Your developing an application that is harder then you might think for example the restaurant may only have tables of four so that becomes a problem when someone reserves for 1 person or 3 persons where your application would indicate that there is a seat available but no table..
  20. DELETE c, p, pd, pq FROM company c JOIN product p ON c.compid = p.prodcompid JOIN productdetail pd ON p.id = pd.prodid JOIN productquality pq ON p.id = pq.prodid WHERE c.compid = '$compID'
  21. download-files.cmd ftp -vin -s:download-files.txt download-files.txt open www.domain.com user username password cd path/to/directory !cd path/to/local/directory binary mget *.jpg Modify this script to your needs and add a windows task to run this script every now and then PS i did not test this script
  22. select * from articles where month(now()) = month(article_date)
×
×
  • 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.