Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. use: while ($row = mysql_fetch_assoc($newsquery)) { print_r($row); }
  2. Here's an updated version: http://pastebin.com/f12cbc64c Edit: I tested it and I can confirm it works. If you want I can submit you the used code. P.S. This is the correct format: http://<domain>/<page>.php[/<module>]/<controller>[/<action>[/<param1>/<value1>]]
  3. 'Y-m-d' => '2009-07-16' should be: 'Y-m-d' => '/[0-9]{4}-[0-9]{2}-[0-9]{2}/' Do this for all supported formats. function is_date($format, $date) { global $date_formats; if (!array_key_exists($format, $date_formats)) return false; // not a valid format return preg_match($date_formats[$format], $date); }
  4. $year = date('Y') + 1; // get the number of days within a specific month $number_of_days = date('t', mktime(0, 0, 0, 5, 1, $year)); // go over each day starting from the last and.. do { $weekday = date('N', mktime(0, 0, 0, 5, $number_of_days, $year)); $number_of_days--; // ..stop on the first occurence of Monday } while ($weekday != 1); $day = $number_of_days + 1; print 'Memorial day 05/' . $day . '/' . $year;
  5. To create a test case you must make sure that what you test is in both cases the same. $mt = microtime(true); ..test internal.. $rt = microtime(true) - $mt;//time the test needed to run $mt = microtime(true); ..test yours.. $rt = microtime(true) - $mt; Is not so good if you only need a few.
  6. I always tought that when you pressed the stop button on your browser it also stopped the request/response cycle on the server. However this may be different for sockets and streams I am not entirely sure although php performs a garbage collection after the script is executed. I find this very interesting someone who can shed some more light on the subject? Thank you!
  7. $randomvar = "mysql_query(SELECT * FROM quiz_correct_response WHERE question_answered = $r_pick ORDER BY rand() LIMIT 1)"; should be: $randomvar = mysql_query("SELECT * FROM quiz_correct_response WHERE question_answered = $r_pick ORDER BY rand() LIMIT 1");
  8. This is the maximum filesize which is roughly translated: ~2 MB (25000 lines of each 80 characters long)
  9. http://be2.php.net/file_get_contents
  10. Please post your script. My best bet would be you forgot the From: header
  11. Use this: http://pastebin.com/fc5fee28 This allows you to use url's in the format: http://<domain>/<page>.php[/<module>]/<controller>/<action>/<param1>/<value1> examples: // module = admin // controller = users // action = edit // id = 1 http://localhost/index.php/admin/users/edit/id/1 // module = default // controller = register // action = index http://localhost/index.php/register // module = default // controller = login // action = index http://localhost/index.php/login
  12. SELECT * FROM page, categ WHERE page.id = categ.cronique
  13. If you use header() you lose anything that was posted or that was part of the query part of the url. The only way is to include the previous page in the processing page or vice versa. You are probably referring to a form and a processing page and you want to send them back if an error occured but the fields have to be left filled in. Just include the processing page on the form page. This way you keep the php minimal amongst the html. It's a struggle we all fought and the best approach are view helpers. These little bastards are allowed to spit out html (as they are designed for this specific purpose) and allows us to work with models in a clean php fashion (with no html mess). These models then use these view helpers to properly render their contents in the view.
  14. $temp = array(); $links = explode('<br>', $links); $number = 1; foreach ($links as $link) { $link = trim($link); // tabs, newlines, .. as noted on: http://us2.php.net/manual/en/function.trim.php $temp[] = $link . nl2br("\n") . $number++; } $links = implode('', $temp);
  15. ignace

    drop down

    Their is alot missing from this code: ..something here.. ..something here.. ..something here.. while (list($id, $coName) = mysql_fetch_array($result, MYSQL_NUM)) { echo("<option value=\"$id\">$coName</option>"); } echo('</select>'); } } else if (!empty($_POST['category'] && !empty($_POST['coName'])) { $cat = $_POST['category']; $subcat = $_POST['coName']; ..process.. } }
  16. Please post some code, table data, .. So we can take a look at it
  17. SELECT callback_name, callback_parameters FROM callbacks ORDER BY callback_order $result = mysql_query($query, $db); while (list($callback, $parameters) = mysql_fetch_array($result, MYSQL_NUM)) { call_user_func_array($callback, explode(',', $parameters)); }
  18. So you want to post data to both koos.co.za as to domain.co.za?
  19. Post your code so we can examine the problem.
  20. Do you need a post office to send land mail?
  21. You need to go up higher in the chain and render the topics yourself using a join to add the last_poster data to your topics data SELECT * FROM topics, users WHERE topics.last_poster = users.id
  22. A php script and a cron job (linux) or scheduled task (windows)
  23. setcookie('PASSWORD',$_POST['password'],time()+60*60*24*30); Do you know that a cookie stores it's data in plain text? Meaning that your password and username is left unprotected on the computer of your user? Plus, this question has been answered many times before: use session_set_cookie_params() to extend the lifetime of your cookie.
  24. SELECT * FROM category WHERE catID=$parentID must be SELECT * FROM category WHERE parentID=$parentID
×
×
  • 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.