Jump to content

RussellReal

Members
  • Posts

    1,773
  • Joined

  • Last visited

Everything posted by RussellReal

  1. [tex]never noticed this tag whats this do?[/tex] ^^ a personal test lol.. but besides that let me write up something but you have to study some regex its very neat /((?:www\.|https?:\/\/)[.a-z0-9;&?\/-]+?)/i thats really really simple but should do your job (havn't tested it) -------------- wowie that tex thing is sweet lol
  2. show me your actual array please
  3. sorry I hit submit too fast! and if I modify that 1 you won't read the php solution; <?php foreach ($_POST as $k => $v) { // $k will be the field name, $v will be the value of the field if ($v == '') die("error"); } // if script reaches here without die() than assume good values ?>
  4. If you're going to validate a form do it right. you could do a javascript validation before hand but you should always check incoming data.. // javascript form validator function validate(TheForm) { for (i in TheForm.childNodes) { if (TheForm.childNodes[i].value == '' || (''+TheForm.childNodes[i].value+'') == 'undefined') { alert("ERROR!!"); return false; } } // if script reaches here without returning false than its obviously true.. return true; } and then <form action="whatever.php" method="POST" onsubmit="validate(this)"> <input... ... ... </form>
  5. RussellonMSN [AT] hotmail.com
  6. noticing the extra ( ) around the outside of the other print_r's you probably have a multidimensional array.. so you'd do like // loop through indexes of $mainArray and fill KEY to $k and VALUE to $v foreach ($mainArray as $k => $v) { // output the KEY echo $k; // loop through the value of $v, which would be an array in your example. // $va will now hold the content of each element. foreach ($v as $va) { // echo out $va with a prepended space to keep them from attaching to // eachother. echo ' '.$va; } // echo new line after the values loop, and try to find the next index of our array echo "\n"; } but note there is simpler ways of achieving this foreach ($mainArray as $k => $v) { echo $k.implode(" ",$v)."\n"; }
  7. u shud be sorry but sorry my solution didn't help u
  8. set_time_limit and sorry, I'm not exactly sure what the max is.. but I know 0 would be like.. forever
  9. Is 1995 a bad thing? I was 5 then actually and I'd love to be 5 again lol!
  10. for starters use mysql_fetch_assoc secondly it returns something similar to: Array ( [ NAME ] => Whatever [ AUTHOR ] => Whatever, JR (lol) [ DATE ] => Whenever ) mysql_fetch_array gets Array ( [ 0 ] => Name Whatever [ NAME ] => Name Whatever ) however you can use an optional arguement to mysql_fetch_array mysql_fetch_array($resultResource,MYSQL_NUM); for just 0 1 2 3 mysql_fetch_array($resultResource,MYSQL_ASSOC); for just NAME AUTHOR DATE but for the second one its less typing to just do mysql_fetch_assoc and with assoc you can still foreach through the array so it makes not much difference lol
  11. preg_replace preg match would just match it lol but you shouldn't do whatever.*** match: www.whatever.*** or (http://[^ ]+)
  12. usually with include you usually include the things you need, rather than EVERYTHING when sum1 clicks an inbound link to your website.. the page refreshs and php restarts for that user, meaning all data beforehand was destroyed so.. include the files you need from the systems folder.. into the current php script.. than include the ones you need in the next one aswell
  13. put the list of jobs into a php array, or database but when the db info is infact in the array it should look like this: Array ( [0] => Array ( [0] => Job Name 1 [1] => Job Number 1 ) [1] => Array ( [0] => Job Name 2 [1] => Job Number 2 ) ) then when publishing the job selections do foreach ($jobs as $job) { list($name,$number) = $job; sprintf('<a href=\'javascript:doSubmit("%s","%s");\'>%1$s</a>',addslashes($name),addslashes($number)); } then in your actual html have like <script type="text/javascript"> function doSubmit(name,num) { document.getElementsById("jobname").value = name; document.getElementsById("jobnum").value = num; document.getElementsById("jobform").submit(); } </script> <form id="jobform" method="POST" action="apply.php"> <input type="hidden" name="jobname" id="jobname" /> <input type="hidden" name="jobnum" id="jobnum" /> </form>
  14. classes arn't meant to be dynamic.. they're meant to be called and do a specific task.. and I really doubt that you can extend classes dynamically.. the best way is to just like pass the class into the class and handle it with your constructor class A { function __construct($toInstantiate) { $this->B = $toHandle; } } $a = new A(new B); oh, forgot to mention you could also in the class do B::FunctionInB(); class A { function __construct() { $this->B = B::handleBthings(); } }
  15. get_class_name ?
  16. add me to msn RussellonMSN [AT] hotmail.com
  17. because to accurately subtract time or work with time you should convert it to seconds strtotime() will convert 8:30:05 into whatever seconds it was TODAY instead of a WEEK AGO when that was actually recorded.. so to keep it straight forward with php you'd include the date aswell..
  18. Free post? Since when did posting cost you anything? damn you're good +1 for me too!
  19. "SELECT COUNT(ticketnumber) as total, SUM(price) FROM sales WHERE date = '.$date.' GROUP BY `ticketnumber`
  20. GROUP BY "ticketnumber" IS WRONG below is correct GROUP BY `ticketnumber`
  21. SELECT COUNT(`receipt_number`) FROM `POS_system` GROUP BY `receipt_number`
  22. I do not think javascript is allowed to close a user opened window.. however, if you have opened the window within javascript from another page, then the page is a "parent" to the "child" window than has the power to close it.. but as a security feature of javascript, you can't really do much to the original window.
  23. $_GET['date'] equals 02/31/1994 $previous = date("d/m/Y",strtotime("$month 1st, $year -1 month")); $next = date("d/m/Y",strtotime("$month 1st, $year +1 month"));
×
×
  • 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.