Jump to content

Barand

Moderators
  • Content Count

    20,284
  • Joined

  • Last visited

  • Days Won

    447

Barand last won the day on January 26

Barand had the most liked content!

Community Reputation

1,429 Excellent

7 Followers

About Barand

  • Rank
    Sen . ( ile || sei )

Profile Information

Recent Profile Visitors

60,424 profile views
  1. If you currently have that data in a string variable only, then file_put_contents()
  2. When you process the query and store in an array, make the array index the product name $list['Plesk'] = [ product data ] Since array keys must be unique you will end up with only one.
  3. There is only one auto_inc column. It's just that myisam will allow it to be placed as the second part of a multi-column key and thus give multiple auto-incremented ranges. Thus, in this case, assuring unique values of 1 to N for each raffle.
  4. Oh Joy! I love it when someone tells us what they want and you give up your time to tell them how, only to have them then tell us that it wasn't really what they want so the exercise was a waste of time. However, if you use a MyIsam table you can still do it. Just make the PRIMARY KEY (raffle_number, ticket_number) CREATE TABLE `raffle` ( `name` varchar(50) DEFAULT NULL, `raffle_number` int(11) NOT NULL, `ticket_number` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`raffle_number`,`ticket_number`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; INSERT INTO raffle (name, raffle_number) VALUES ('Curly', 1), ('Curly', 1), ('Curly', 1), ('Larry', 2), ('Larry', 2), ('Larry', 2), ('Larry', 2), ('Larry', 2), ('Mo', 1), ('Mo', 1), ('Mo', 1), ('Mo', 2), ('Mo', 2), ('Mo', 2); SELECT name , raffle_number , ticket_number FROM raffle ORDER BY raffle_number, ticket_number; +-------+---------------+---------------+ | name | raffle_number | ticket_number | +-------+---------------+---------------+ | Curly | 1 | 1 | | Curly | 1 | 2 | | Curly | 1 | 3 | | Mo | 1 | 4 | | Mo | 1 | 5 | | Mo | 1 | 6 | | Larry | 2 | 1 | | Larry | 2 | 2 | | Larry | 2 | 3 | | Larry | 2 | 4 | | Larry | 2 | 5 | | Mo | 2 | 6 | | Mo | 2 | 7 | | Mo | 2 | 8 | +-------+---------------+---------------+
  5. Make ticket_number an auto_increment column CREATE TABLE raffle ( name VARCHAR(50) ticket_number INT NOT NULL auto_increment primary key ); INSERT INTO raffle (name) VALUES ('Curly'), ('Curly'), ('Curly'), ('Larry'), ('Larry'), ('Larry'), ('Larry'), ('Larry'), ('Mo'), ('Mo'), ('Mo'), ('Mo'), ('Mo'), ('Mo'); SELECT name, ticket_number FROM raffle; +-------+---------------+ | name | ticket_number | +-------+---------------+ | Curly | 1 | | Curly | 2 | | Curly | 3 | | Larry | 4 | | Larry | 5 | | Larry | 6 | | Larry | 7 | | Larry | 8 | | Mo | 9 | | Mo | 10 | | Mo | 11 | | Mo | 12 | | Mo | 13 | | Mo | 14 | +-------+---------------+
  6. It all depends on your requirements. Do you ever have a requirement for a reduced-size version that does not have a watermark? Do you want to store the original full-size image with or without the watermark? Note that as soon as you manipulate the uploaded image you lose any exif data (such as rotation). Do you require different sizes of images (thumbnail for product listings and medium when viewing individual product, say)?
  7. On second thoughts function getISP($str) { $a = explode('.', $str); return join('.', array_slice($a, -3)); }
  8. try function getISP($str) { $k = strlen($str); while (!ctype_digit($str[--$k])) ; $p = strpos($str, '.', $k); return substr($str, $p+1); } echo getISP('host86-197-dynamic.3-87-r.retail.telecomitalia.it'); //--> retail.telecomitalia.it
  9. If you define your array like this, to begin the indexing at 1 instead of 0, $names = array (1 => "Stan", "John", "Dean", "Sam", "Lee"); then your indexes will align with your $num values, 1 - 5; In other words $num = 5; echo $names[$num]; //--> Lee That will save you doing what ginerjm is about to tell you to do
  10. The obvious question is "What has changed between then and now?"
  11. Very true. The U.S. spent millions developing a ballpoint pen that would operate at any angle and in weightless conditions. The Russians gave their cosmonauts pencils instead.
  12. @Wal-Wal-2 This page from the php reference manual gives the information you want
  13. echo "<a href='{$row['link']}' target='_blank'>&diams;&nbsp;&nbsp; {$row['title']}</a><br>";
  14. The target attribute needs to be in each <a> tag and not just in a comment in the code EG <a href='http://www.google.co.uk' target='_blank'>Goooooogle</a>
×
×
  • 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.