Jump to content

hitman6003

Members
  • Posts

    1,807
  • Joined

  • Last visited

Everything posted by hitman6003

  1. SELECT * FROM tablename ORDER BY game_name ASC If they are begin with both lower and upper case letters, use the cast function on MySQL to get results similar to php's natsort. http://dev.mysql.com/doc/refman/5.0/en/cast-functions.html
  2. mktime is designed for such an occurrence. Should that happen, it will go to the previous year's December... http://us.php.net/mktime#id3107703
  3. echo date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - 7, date("Y")));
  4. Are you trying to get the previous month? If so, just use mktime's ability to subtract... echo "Today: " . date("Y/m/d") . "<br />"; echo "Last month: " . date("Y/m/d", mktime(0, 0, 0, date("m") - 1, date("d"), date("Y")));
  5. echo "<select name='databaseselect'>"; $dblist = mysql_query('SHOW DATABASES'); while ($row = mysql_fetch_row($dblist)) { if ($row[0] != "information_schema" && $row[0] != "mysql") { echo "<option value='$row2[0]'>$row2[0]</option>"; } } echo "</select>";
  6. Use these functions... http://us2.php.net/manual/en/ref.dir.php#61285 with a little modification to the printTree function it will do what you want.
  7. Creating and destroying cookies is done through headers...so, yes, it does have to do with headers. Make sure that you are not outputting any data to the browser before you are making any kind of "setcookie" call.
  8. Barand has created a php class that does what you want as well... http://members.aol.com/barryaandrew/baaselect/baaselectguide.html
  9. http://www.google.com/search?hl=en&q=php+dynamic+select&btnG=Google+Search Nearly any of those tutorials will probably get you where you want to be.
  10. http://us2.php.net/setcookie#id5522640
  11. You will have to use the imagecreatefromstring function to create the "gd" reference to the image from your database field. Then use imagecopyresized to resize the image.
  12. while(natsort($row) = mysql_result($sql, 'MODEL')){ Will only sort the values in that one particular result row...which doesn't help in this case. Why not use an "ORDER BY" clause on your SQL query and cast the sorted column? http://dev.mysql.com/doc/refman/5.0/en/cast-functions.html Otherwise use genericnumber1's code from post 2
  13. This is the wrong forum for javascript problems... Anyway, you have your javascript call all messed up... echo '<a href="javascript: window.opener.location.href = ' . str_replace(" ", "+", $row['search']) . '; self.close();">test</a>';
  14. I think this may be what you are looking for. Except if it's 0600 it will display 0%. It will also probably display 100% prematurely because of the rounding. Just force it to round down using the floor function, then it won't display 100% from 0545 until 0559, but will display 99% instead. //hour: int from 0 - 23 $control_hour = 6; //minute: int from 0 - 59 $control_minute = 0; $current_hour = date("G"); $current_minute = date("i"); $minutes_in_day = 24 * 60; $expired = (($current_hour * 60) + $current_minute) - (($control_hour * 60) + $control_minute); $expired = ($expired < 0) ? $expired + $minutes_in_day : $expired; echo round(($expired / $minutes_in_day) * 100) . "%";
  15. echo round(((date("i") % 15) / 15) * 100) . "%";
  16. The css ":hover" pseudo class will not work in IE except on anchor tags.
  17. I guessing, but maybe you don't have any of those model cars in? You can get rid of the error by checking to see if the array exists... if (is_array($car_model) && count($car_model) > 0) { $imploded_model = implode("::", $car_model); } Possibly...ensure that you are using the correct connection information for all of your files that connect to the database. If you are sure that it is correct, double check the code to see if it is using the correct connection strings. Also, check with your host to see if they have done any upgrades to you recently...maybe they moved you to php5, or mysql5, and didn't think it was necessary to let you know.
  18. If you could, it would be a function of the operating system, not php. You can use php to enforce a max size rule on a directory by reading the size of all the files in the dir, adding them up, then taking appropriate action. http://www.php.net/dir
  19. These two lines kind of sum it up: It can't connect to the mysql server...despite the fact that "it's using the same script on other pages" there is an error somewhere..... The first three errors: are because an array is not being passed as the second argument to the implode function on the lines referenced in the error.
  20. Or reduce the error reporting level by putting this line at the very top of your page: error_reporting(E_ALL ^ E_NOTICE);
  21. You are using the pow function incorrectly.... http://www.php.net/pow $N = $_POST['N']; $d = $_POST['d']; $r = $_POST['r']; $y = $_POST['y']; $A = (N * ((100 - $d) / 100) * $r * pow((1 + ($r / 1200)), (12 * $y))) / (1200 * ( pow((1 + ($r / 1200)), (12 * $y)) - 1 ));
  22. The error you are seeing isn't really an error...it's php notifying you that at some point in the code it is addressing an index in an array that doesn't exist. It's not affecting anything. You can fix it two ways...look through your code for the index that it's saying doesn't exist and make sure that it exists before it calls it: //will give undefined index notice: echo $some_array['name']; //will not give notice: $some_array = array(); $some_array['name'] = "bob"; echo $some_array['name']; Or reduce the error reporting level by putting this line at the very top of your page: error_reporting(E_ALL ^ E_NOTICE);
  23. You have to escape the single quotes in your html when you are echoing them in a php statement enclosed in single quotes.... echo '<td onMouseover="this.bgColor=\'lightgrey\'" onMouseout="this.bgColor=\'#FFFFFF\'">' . $results['driver_status'] . '</td>
  24. If I had to guess, and I am guessing, you may be exceeding the time limit for execution of a php script. The "readFileChunked" function has a sleep for 1 second in it after every 1 MB of data it outputs. Usually the default max execution time of a php script is around 30 seconds...
  25. You should be able to change the name of your items to be an array... <input type="text" name="quantity[$item_id]"> This will result in an array that you can loop through in the post element... foreach ($_POST['quantity'] as $item_id => $quantity) { //do your updating }
×
×
  • 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.