Jump to content

premiso

Members
  • Posts

    6,951
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by premiso

  1. Take a look at this tutorial: http://www.phpfreaks.com/tutorial/simple-sql-search
  2. In your config.php it seems you may have a syntax error: <php should be <?php Not sure if this is it, but that would be my first look. (Unless it is a typo).
  3. ...you mean if you weren't pretending to be heterosexual.
  4. I think my logic is pretty sexy.
  5. Crab people Crab people...Talk like Crabs Walk like people.... You gotz teh CrabZ!
  6. As long as you keep the golden toilet seat warm...welcome.
  7. Correct. And as I said, the difference is so small that it will not be noticeable, but the bottom line is that double quotes are slower.
  8. The worst kind!
  9. Concat will be more efficient. But the difference is so small will not be noticeable. The reason being is that single quotes do not have to worry about parsing data so it is one less look up needed.
  10. ORDER BY column_name ASC ORDER BY column_name DESC ASC = Ascending Order; DESC = Descending Order
  11. That is a bit more difficult and advanced I believe it is called "weighted probability": http://20bits.com/articles/random-weighted-elements-in-php/ http://www.gidforums.com/t-6365.html http://stackoverflow.com/questions/1105143/php-weight-algorithm All are decent resources to read about it.
  12. Yep, my mistake forgot we were using the key as the id
  13. *premiso dies a little inside. Because I am feeling extremely nice, here is an updated version of your code. $ballTypes = array(30978 => "Blue", 30983 => "Green", 30985 => "Orange", 30986 => "Purple", 30990 => "Yellow", 30981 => 'Cola', 30979 => 'Chocolate', 30984 => 'Ice', 30987 => 'Rock', 30988 => 'Strawberry', 30980 => 'Dark Chocolate', 30977 => 'Black', 30982 => 'Digital', 30989 => 'Silver', 30991 => 'Burnt'); $random_ball = array_rand($ballTypes); mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','" . $ballTypes[$random_ball] . "','1','1')"); $gummy = "You won a <b>" . $ballTypes[$random_ball] . " Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_' . str_replace("dark chocolate", "chocolate2", strtolower($ballTypes[$random_ball])) . '.gif" width="80" height="80" border="0">'; Think of how much easier this will be to maintain! Just try and keep the image titles similar to the ball name, as you can see with the str_replace, had to do a little hack for dark chocolate. If you named the image gum_dark-chocolate that would be much easier to handle. Either or, should help you out a bit.
  14. VARCHAR2 should probably be VARCHAR. Unless I am mistaken, I do not think VARCHAR2 is a valid TYPE in MySQL.
  15. The error you have shown does not coincide with the SQL you have shown. There is no NOT NULL before varchar2. The issue is the NOT NULL should be after the TYPE declaration.
  16. Please use the tags to surround code
  17. if (function($params) === false) // check if the return value is EXACTLY false, so the type is required to be boolean. if (function($params) == false) // Just requires the data to be null, 0, '' or false. if (!function($params)) // Just requires the data to be null, 0, '' or false.
  18. I prefer to ignore him. Damn bum cannot even help himself so he has to beg. It is just like my dog, I do not feed him either if he begs. However, if he does a nice trick to earn a treat, I may decide to give him something.
  19. Off topic (and does not solve the issue). You will want to add an array on the PHP side of all the carriers and then validate the $to against that (via in_array). If you do not, this could easily be turned into a spamming email system. I would also validate that the $phone value is all numbers as well. Simple steps to help prevent spam!
  20. Addressing the readfile question, aside from jayarsee's information on the output buffering, another option is a custom user function: here http://us.php.net/manual/en/function.readfile.php#88549 Which is: function readfile_chunked ($filename,$type='array') { $chunk_array=array(); $chunksize = 1*(1024*1024); // how many bytes per chunk $buffer = ''; $handle = fopen($filename, 'rb'); if ($handle === false) { return false; } while (!feof($handle)) { switch($type) { case'array': // Returns Lines Array like file() $lines[] = fgets($handle, $chunksize); break; case'string': // Returns Lines String like file_get_contents() $lines = fread($handle, $chunksize); break; } } fclose($handle); return $lines; } I have used this and it has worked for me. It may be able to be optimized a bit, but yea.
  21. You cannot control how the browsers asks the users what they want to do. You cannot tell if the user "truly" downloaded the file either. So yea, you are stuck between a hardspot and a rock. Sorry mate. EDIT: However, using a Java or Flash application, this may be possible, but I am not 100% on that (or at least a bandwidth monitor for the current connections should be possible). I would suggest looking into that route.
  22. Is there any error information etc? What is the problem exactly?
  23. mysqli is great. But PDO would be my preference to use over mysqli, I just love the PDO setup, nice and easy (well once you get the hang of it)!
×
×
  • 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.