Jump to content

Push Eject

Members
  • Posts

    18
  • Joined

  • Last visited

    Never

Everything posted by Push Eject

  1. LOL - isn't that what I posted in my first reply?
  2. I'm sorry, your subject is how to the last record in a set of records... I should have read your post thoroughly.
  3. $sql = "SELECT * FROM X WHERE Y LIKE '%$search_query%' ORDER BY Z DESC";
  4. SELECT * FROM table ORDER BY yourchoice DESC LIMIT 1
  5. The reason for "!== false" instead of "!= false" is a statement can evaluate to 0 and still be true. e.g. $found = strpos( "Hello World!", "H")
  6. I just went through this. Perhaps this will help you: <?php $body = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)', '<a href="\\1">\\1</a>', $body); $body = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&//=]+)', '\\1<a href="http://\\2">\\2</a>', $body); ?>
  7. Does this help? <tr> <td width="%16"><font face="verdana" size="2"><?php echo $liste[0]; ?></font></td> <td width="%16"><font face="verdana" size="2"><?php echo $liste[1]; ?></font></td> <td width="%17"><font face="verdana" size="2"><?php echo $liste[2]; ?></font></td> <td width="%13"><font face="verdana" size="2"><?php echo $liste[3]; ?></font></td> <td width="%21"><font face="verdana" size="2"><?php echo $liste[4]; ?></font></td> <td width="%17"><font face="verdana" size="2"><?php echo $liste[5]; ?></font></td> </tr>
  8. It seems to me the problem is that the $Filter_Item array and the $I_EquipID array are not ordinally related. Nor should they need to be, I don't think. I'm not sure how $Filter_Item is being populated, but perhaps something like this will work for you: <?php $I_Count=count($I_EquipID); for($x=0;$x<$I_Count;$x++) { if(isset($E_H_Equip)) { echo "<option"; foreach( $Filter_Item as $item ){ if( $I_EquipID[$x] == $item ) echo " SELECTED"; } echo " value='".$I_EquipID[$x]."'>*".$I_No[$x]." | ".$I_Description[$x]."</option>"; } else { echo("<option value='".$I_EquipID[$x]."'>".$I_No[$x]." | ".$I_Description[$x]."</option>"); } } ?>
  9. Thanks Disco! I *just* found that function myself and here is my solution: <?php $body = preg_replace_callback('([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})', 'encodeEmail', $body); function encodeEmail($email){ $t = $email[0]; $r = ""; for( $i = 0; $i < strlen($t); $i++ ){ $r .= "&" . "#" . ord( substr($t,$i,1) ); } $r = "<a href=\"&#109a&#105l&#116o&#58" . $r . "\">".$r."</a>"; return $r; } ?>
  10. Hmm. Sorry about that. Can you echo $data and $number and compare their contents? That might give insight into why strpos() didn't find a match.
  11. Just a quick observation, you are relying on $x for all your key needs. I think you are going to need to use another variable within your loop to iterate through the second array checking for a match.
  12. <?php // Parse text file for blocked numbers $handle = fopen("blocked.txt", "r"); $data = fread( $handle, filesize( "blocked.txt" ) ); if( strpos( $data, $number ) !== false ){ $error = "That number is blocked on this system"; } fclose($handle); ?>
  13. Sorry I didn't format the code for color. I'm such a n00b. Here it is again in a more readable state: <?php $body = "blah blah john@example.com blah blah". $body = eregi_replace('([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})', encodeEmail('\\1'), $body); function encodeEmail($email){ $t = "mailto:" . $email; $r = ""; for( $i = 0; $i < strlen($t); $i++ ){ $r .= "&" . "#" . ord( substr($t,$i,1) ); } $r = "<a href=\"" . $r . "\">".$r."</a>"; return $r; } ?> Returns: blah blah <a href="&#109&#97&#105&#108&#116&#111&#58&#49">&#109&#97&#105&#108&#116&#111&#58&#49</a> blah blah OR mailto:1 Been playing with this again this morning and cannot figure out how to properly pass the "\\1" value...
  14. Hi all. I was unsure whether to post this in the Regex forum or here. I hope I've chosen correctly. I'm trying to call a routine to obfuscate email addresses from within a regular expression and am stumped. The following code: $body = a post to a page that may include an email address. $body = eregi_replace('([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})', encodeEmail('\\1'), $body); function encodeEmail($email){ $t = "mailto:" . $email; $r = ""; for( $i = 0; $i < strlen($t); $i++ ){ $r .= "&#" . ord( substr($t,$i,1) ); } $r = "<a href=\"" . $r . "\">".$r."</a>"; return $r; } Returns: <a href="&#109&#97&#105&#108&#116&#111&#58&#49">&#109&#97&#105&#108&#116&#111&#58&#49</a> OR mailto:1 Can I not call a user function from within the regex? Am I referencing "\\1" wrong? More confusing to me is that if I return $email from encodeEmail() it passes the correct string (\\1) back. Any help is greatly appreciated. Thanks, Charlie
×
×
  • 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.