justravis
-
Posts
115 -
Joined
-
Last visited
Posts posted by justravis
-
-
thanks for reading my thread.
isnt ^ common regex notation?
keep getting this error:
Parse error: syntax error, unexpected '^'
$goalsheet.=preg_replace("/^[0-9]+ Year Career Goal #[0-9]+: *$\", "/^<span class=hd2>[0-9]+ Year Career Goal #[0-9]+: *</span><br>$/", $goallist);
aside from the error, i think the regex is off, but i hav had a hard time understanding how I can ignore text in the middle.
Here are some examples of what i'm trying to do:
"1 Year Goal #1: Web Developer" -> "<span>1 Year Goal #1: Web Developer</span><br>"
"10 Year Goal #2: IT Consultant" -> "<span>10 Year Goal #2: IT Consultant</span><br>"
suggestions?
-
effigy,
u hav helped me before...thank you for responding...
lemme ask this...ihow do most people store times in a db? not in a time type column?
THANKS!
-
According to the mysql manual, "If you pass an out-of-range date to UNIX_TIMESTAMP(), it returns 0."
How does a 08:40:00 time qualify as out of range?
-
Azu & Darren,
Thank you for your time.
Yes, the code executed out of eval().
I changed these lines:
$addcode.="global \$STATES;"; $addcode.='arr_selectbox(\'state\', $STATES,\'State\');';
Now it works!!!!
-
This works:
$gradecode="echo '<fieldset><legend>Grade: </legend>';"; $gradecode.="db_selectbox('grade', 'SELECT id, name FROM grade WHERE inactive=0 ORDER by id', 0, 1,0,'Choose Your Grade');"; $gradecode .= "echo \"</fieldset><br /> \n\";"; eval($gradecode);
This tells me theres a Parse error: syntax error, unexpected ')', expecting '(' @ arr_selectbox
$addcode="echo '<label>Address: <input name=address id=address type=text></label><br />';"; $addcode.="echo '<label>City: <input name=city id=city type=text></label><br />';"; $addcode.="arr_selectbox('state', $STATES);"; $addcode.="echo '<label>Zip: <input name=zip id=zip type=text></label><br />';"; eval($addcode);
Any suggestions?
Thanks for your time.
-
I have a few columns with a Time column type. When I use UNIX_TIMESTAMP, it returns 0.
Any sugestions?
Thanks for yr time!!!
-
Jeni,
I've been experimenting all day, but checking the value instead of the key FINALLY hit me shortly after posting. I wanted to go back to the drawer board before declaring this topic SOLVED.
Thanks again! You have been very helpful on a variety of topics now.
-
I am trying to write a function that will recheck a checkbox if it was checked when submitted. The problem is the checkbox array only includes checkboxes with a value, so the order of the checkbox array changes. For example, if I only check 1 random checkbox, it will only check the first checkbox.
Any ideas on a workaround?
How would you handle such a situation?
Thanks!!!
-
Typically it outputs the contents of the array. What typically causes it to output "Array()"?
Thank you for your time.
-
since the function cant even tell the name of the var being passed to it, how would a for loop inside the function make a difference?
THANK YOU.
-
In this simple example, I would like the function to output, the name of the var, the letter 'x'
<?php function out($var) { echo "$var<br />"; #echo $$var; #echo func_get_args($var); #$varlist=get_defined_vars(); #echo $varlist[0]; } $x=3; out($x); ?>
Any ideas?
Thanks for yr time!
-
forgot to put the word, "function"
-
now the same error occurs on line 170...return for chkEach()
//TP 3function chkboxRange(chkboxarray, min, minerror, max, maxerror) 4{ 5 /* 6 Creates Array 7 - var arrName = new Array() 8 arrName[0]="item1" 9 arrName[1]="item2" 10 arrName[2]="item3" 11 - var arrName=new Array("item1","item2","item3") 12 - var arrName = ["item1","item2","item3"] 13 */ 14 var arrSelect =[]; 15 16 //Cycle thru checkbox array 17 //since first index=0, length is always 1 more than last index. 18 for(var i=0;i<chkboxarray.length;i++) 19 { 20 if(chkboxarray[i].checked) 21 { 22 //if checked, push id into Select array. 23 arrSelect.push(chkboxarray[i].id); 24 } 25 } 26 27 var arrError = new Array(); 28 29 //if min exists & length is less than min, add minerror to arrError array. 30 if(min && arrSelect.length<min) 31 { 32 arrError.push(minerror); 33 } 34 35 //if max exists & length is less than max, add maxerror to arrError array. 36 if(max && arrSelect.length<max) 37 { 38 arrError.push(maxerror); 39 } 40 41 return arrError; 42} 43 44/* 45This function checks whether the passed parameter is null or blank. 46In this we pass the value of the fields as a parameter. 47If the str is blank or null, it will return true and otherwise false. 48*/ 49function isEmpty(feild) 50{ 51 //var str1=trim(str); 52 53 var str= feild.value; 54 55 /* 56 http://www.webreference.com/js/column5/index.html 57 Regular Expression Key: 58 / - pattern must begin and end with / in Javascript 59 Modifiers Before or after 60 g Do global pattern matching. 61 i Do case-insensitive pattern matching. 62 m* Treat the string as multiple lines. 63 s* Treat the string as a single line. 64 x* Ignore whitespace within a pattern. 65 * Modifiers that are not supported by Navigator 4.0x and Internet Explorer 4.0. 66 Examples 67 /JavaScript/i matches both "javascript" and "JavaScript" 68 Rule 2: | Seperates alternatives 69 Rule 4: Assertions 70 ^ Matches at the beginning of the string. 71 $ Matches at the end of the string. 72 \b Matches a word boundary (between \w and \W), when not inside []. 73 \B Matches a non-word boundary. 74 Rule 5: Quantifiers 75 {m,n} Must occur at least m times, but not more than n times. 76 {n,} Must occur at least n times. 77 {n} Must occur exactly n times. 78 * Must occur 0 or more times (same as {0,}). 79 + Must occur 1 or more times (same as {1,}). 80 ? Must occur 0 or 1 time (same as {0,1}). 81 Rule 6: Special Characters 82 \n Linefeed 83 \r Carriage return 84 \t Tab 85 \v Vertical tab 86 \f Form-feed 87 \d A digit (same as [0-9]) 88 \D A non-digit (same as [^0-9]) 89 \w A word (alphanumeric) character (same as [a-zA-Z_0-9]) 90 \W A non-word character (same as [^a-zA-Z_0-9]) 91 \s A whitespace character (same as [ \t\v\n\r\f]) 92 \S A non-whitespace character (same as [^ \t\v\n\r\f]) 93 /abc/gi 94 */ 95 96 //Replace str value with value after run thru regex. 97 //regex deletes whitespace before the first & after the last alphanumeric character 98 var trim = str.replace(/^\s+|\s+$/g,""); 99 100 if(trim == null || trim.length==0) 101 { 102 var error='<a href=#'+feild+'>'+feild+'is a required feild.</a>'; 103 return error; 104 } 105 else 106 { 107 return true; 108 } 109} 110 111//this Keyword - http://www.quirksmode.org/js/this.html 112 113/* 114This Function is to find out that whther the value of the field is numeric or not. 115Parameter: any value(In this case its a value contained in any field.) 116Returns: false if user has not entered the number, true otherwise. 117*/ 118function onlyNbr(feild) 119{ 120 var str=feild.value; 121 122 var pat = /(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/; 123 124 if(!str.match(pat)) 125 { 126 var error='<a href=#'+feild+'>'+feild+'should consist of numbers only.</a>'; 127 return error; 128 } 129 else 130 { 131 return true; 132 } 133} 134 135/* 136Function to find out whether the passed id is valid or not. 137Paramter: Email Id. In this case vfalue of a field in which email is entered. 138Return: It returns true is the mail is not valid and false in opposite situation. 139*/ 140function isValidEmail(feild) 141{ 142 var str=feild.value; 143 144 var pat = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/; 145 146 if(!str.match(pat)) 147 { 148 var error='<a href=#'+feild+'>'+feild+'is not a valid email address containing a \'@\' and extension (.com, .org, etc).</a>'; 149 return error; 150 } 151 else 152 { 153 return true; 154 } 155} 156 157//TP 158chkEach(FeildIDs,funct) 159{ 160 var arrFeilds = new Array(); 161 arrFeilds=document.getElementById(FeildIDs); 162 163 var arrErr= new Array(); 164 165 for(var i=0; i<arrFeilds.length; i++) 166 { 167 arrErr.push(funct(arrFeilds[i])); 168 } 169 170 return arrErr; 171} 172 173//TP 174chkUsual() 175{ 176 var arrErr= new Array(); 177 178 //Concatenate arrays - http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_concat 179 180 arrErr=arrErr.concat(chkEach(reqTypeTxt,isEmpty); 181 //arrErr=arrErr.concat(chkEach(onlyLtr,); 182 arrErr=arrErr.concat(chkEach(onlyNbr,onlyNbr); 183 arrErr=arrErr.concat(chkEach(validEmail,isValidEmail); 184 185 return arrErr; 186} 187 188//TP 189chkForm() 190{ 191 var arrErr= new Array(); 192 arrErr=arrErr.concat(chkUsual()); 193 194 if(arrErr) 195 { 196 for(var i=0;i<arrErr.length;i++) 197 { 198 document.getElementById('faults').innerHTML+=arrErr[i]; 199 } 200 201 return false; 202 } 203}
-
ok..i will delete commented code, but isn't the last */ coorespond to the /* at the top?
or does something in the code contradict that logic?
Thanks again for yr time!
-
I'm getting a "return not in function" error on this code I think I have commented out:
Tried searching thru forum for solution to this seemingly common problem, but came up with nothing.
/* VJ This function is to trim a string value. This is used to remove white spaces from the string. This returns the string which is trimmed form of paramter. function trim(str) { /* http://www.webreference.com/js/column5/index.html Regular Expression Key: / - pattern must begin and end with / in Javascript Modifiers Before or after g Do global pattern matching. i Do case-insensitive pattern matching. m* Treat the string as multiple lines. s* Treat the string as a single line. x* Ignore whitespace within a pattern. * Modifiers that are not supported by Navigator 4.0x and Internet Explorer 4.0. Examples /JavaScript/i matches both "javascript" and "JavaScript" Rule 2: | Seperates alternatives Rule 4: Assertions ^ Matches at the beginning of the string. $ Matches at the end of the string. \b Matches a word boundary (between \w and \W), when not inside []. \B Matches a non-word boundary. Rule 5: Quantifiers {m,n} Must occur at least m times, but not more than n times. {n,} Must occur at least n times. {n} Must occur exactly n times. * Must occur 0 or more times (same as {0,}). + Must occur 1 or more times (same as {1,}). ? Must occur 0 or 1 time (same as {0,1}). Rule 6: Special Characters \n Linefeed \r Carriage return \t Tab \v Vertical tab \f Form-feed \d A digit (same as [0-9]) \D A non-digit (same as [^0-9]) \w A word (alphanumeric) character (same as [a-zA-Z_0-9]) \W A non-word character (same as [^a-zA-Z_0-9]) \s A whitespace character (same as [ \t\v\n\r\f]) \S A non-whitespace character (same as [^ \t\v\n\r\f]) /abc/gi */ //Replace str value with value after run thru regex. //regex deletes whitespace before the first & after the last alphanumeric character return str.replace(/^\s+|\s+$/g,""); } */
any ideas?
Thank you for your time.
-
exactly, i want errors emailed to me.
i added the errorto header, but i hav not received any bounce emails.
thanks for yr time,
travis
-
I SINCERELY apologize...dont kno wut i was thinking
<?php $perday=4; $inc=24/$perday; $timeadjusted=mktime(date('H')-2); #Midnight outputs as 0, but for the purpose of the if statement, it seems to be valued at 24 if(!(date('H', $timeadjusted)%$inc) || $_GET[skiptime]) { $emails=array('noemail@poweron.com','support@poweron.com', 'travis@poweron.com', 'travis@jt.com', 'travis@rtb.cc', 'travis@sdsoccer.org'); #$emails=array('support@powerontechnologies.com', 'travis.perreira@powerontechnologies.com', 'travis@justravis.com', 'travis@raise-the-bar.cc', 'trav is@sdwcsoccer.org'); echo "<u>Email Addresses Tested:</u><br />\n"; $subject='Email Test - ' . date('H:i \o\n l, F d, Y', $timeadjusted); $body='Test from ' . gethostbyaddr($REMOTE_ADDR); $from='From: emailtest@powerontechnologies.com'; foreach($emails AS $to) { echo "$to - "; if(mail($to, $subject, $body, $from)) { echo "test email sent<br />\n"; } else { echo "error occured<br />\n"; } } } else { echo date('H', $timeadjusted) . "%$inc=" . date('H', $timeadjusted)%$inc; } ?>
Any Ideas?
Thanks!
-
I wrote an email testing script. The from address is one of my email addresses. I hoped that if the email address did not exist, I would receive a bounced message, but that is not happening. Ideas?
thanks.
-
well when i first read the above links, I thot mysql's timezone was server dependent, but if i can expect mysql's timezone to be the same regardless of hosting provider, i can always retrieve the timestamp in my desired timezone.
-
does everybody insert php formatted timestamps manually instead of using mysql timestamps?
THANKS!
-
i am trying to pass the value of the req feild to reqfeilds
req writes OK, but reqfeilds does not.
thoughts?
THANKS!
<html> <head> <script type="text/javascript"> function getValue() { document.write(document.getElementById('req').value + '<br>'); var reqfeilds = document.getElementById('req').value; document.write(reqfeilds + '<br>'); } </script> </head> <body> <input type=hidden id=req value='name,email'> <input type=button id=split value=split onclick="getValue()"> </body> </html>
-
Is there someplace in phpmyadmin or somewhere else I can change mysql's timezone?
Server version: 4.1.22-standard
THANKS!!!
-
in this situation, i didnt even know the best keywords to use...how many search results you think returned when i used, "variable" & "function"?
You helped IMMENSELY. eval() was just what I needed!!
Indeed, you do have to keep escaping chars in mind. After about 20 min of confusion, I realized I didnt escape a $!
Thanks again!
-
Is there a way to do something like this?
function name($name) { echo '<b>$name</b>'; } function abc($code) {javascript:void(0); Insert Code execute $code; } $code = "echo 'Name:'; name($name);"; abc($code);
[SOLVED] Selecting records that are referenced in 2nd table, but not the exact reference.
in MySQL Help
Posted
The solution is probably related to these posts, but my problem is slightly different:
http://www.phpfreaks.com/forums/index.php/topic,113742.0.html
http://www.phpfreaks.com/forums/index.php/topic,214586.0.html
QUESTION
id name
1 Who is...
2. What is...
QUEST-FORM
id form_id quest_id
1 1 1
2 2 2
How do I find the question NOT linked to form 1, which is question 2?
Here are the queries I have tried without success?
SELECT question.id, question.name FROM question, `quest-form` WHERE `quest-form`.form_id=1 AND question.id!=`quest-form`.quest_id
SELECT question.id, question.name FROM question LEFT JOIN `quest-form` ON question.id=`quest-form`.quest_id WHERE `quest-form`.quest_id IS NULL AND `quest-form`.form_id=1
select question.id, question.name from question left join `quest-form` using (`quest-form`.quest_id) where `quest-form`.form_id=1 AND `quest-form`.quest_id IS NULL
MySQL client version: 4.1.22
THANK YOU!