RussellReal
Members-
Posts
1,773 -
Joined
-
Last visited
Everything posted by RussellReal
-
[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
-
show me your actual array please
-
[SOLVED] did the user fill out the entire form?
RussellReal replied to sjmiller's topic in PHP Coding Help
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 ?> -
[SOLVED] did the user fill out the entire form?
RussellReal replied to sjmiller's topic in PHP Coding Help
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> -
RussellonMSN [AT] hotmail.com
-
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"; }
-
ini_set('max_execution_time', $whatIsTheLimit);
RussellReal replied to johnsmith153's topic in PHP Coding Help
u shud be sorry but sorry my solution didn't help u -
ini_set('max_execution_time', $whatIsTheLimit);
RussellReal replied to johnsmith153's topic in PHP Coding Help
set_time_limit and sorry, I'm not exactly sure what the max is.. but I know 0 would be like.. forever -
Is 1995 a bad thing? I was 5 then actually and I'd love to be 5 again lol!
-
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
-
preg_replace preg match would just match it lol but you shouldn't do whatever.*** match: www.whatever.*** or (http://[^ ]+)
-
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
-
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>
-
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(); } }
-
oh haha
-
get_class_name ?
-
add me to msn RussellonMSN [AT] hotmail.com
-
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..
-
[SOLVED] PHP MySQL update script not working
RussellReal replied to bschultz's topic in PHP Coding Help
Free post? Since when did posting cost you anything? damn you're good +1 for me too! -
[SOLVED] Question regarding couting results in a query?
RussellReal replied to Solarpitch's topic in PHP Coding Help
"SELECT COUNT(ticketnumber) as total, SUM(price) FROM sales WHERE date = '.$date.' GROUP BY `ticketnumber` -
[SOLVED] Question regarding couting results in a query?
RussellReal replied to Solarpitch's topic in PHP Coding Help
GROUP BY "ticketnumber" IS WRONG below is correct GROUP BY `ticketnumber` -
[SOLVED] Question regarding couting results in a query?
RussellReal replied to Solarpitch's topic in PHP Coding Help
SELECT COUNT(`receipt_number`) FROM `POS_system` GROUP BY `receipt_number` -
[SOLVED] links <a href="steam: and teamspeak:
RussellReal replied to Birdmansplace's topic in PHP Coding Help
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. -
$_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"));