Jump to content

Undrium

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Undrium's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Yeah, you are right, it is working. I turned off all my other processing of the text and it turned out to be my antiinjectfunction screwing it up. Thanks for the second view.
  2. It's not doing the trick, though. Sat some hours yesterday with this problem: $s = preg_replace('#(?<=^|\s|\()(http://[^\s\)]+)#', '[url=$1]$1[/url]', $data); Everything works fine until a newline occurs, if the URL is located after a newline it won't activate. However if I make a space after the newline it will replace. Also it works if the URL is at the start of a string. This will work: Some text http://www.address.com This won't work: Some text http://www.address.com
  3. Sorry I wasn't clear enough, I am writing an assertion and this is how far I have come. I want to preg_replace a word if it does have a whitespace, is the start of string or a newline is preceded. Problem is I do not know how to write newline in the assertion. I know that \s for instance means any whitespace so I have that sorted out.
  4. I have this: #(?<=\n|^|\s|\() I also want to squeeze in that it's okey if it is preceded by a newline, how do I write that?
  5. Another suggestion is that you do not delete the appointments but use a status flag instead. Then you can have a column named "lastEditedBy" or something similar where you put the users ID.
  6. The problem with your code is that you are doing everything within your while-loop. Focus the removal of the last coma outside your loop. There are 100s of different ways of doing what you're trying to achieve. One easy way is to just remove the last character of your string (since it's always a coma, right?). Try just doing it like this: $query1 = mysql_query("SELECT b_id FROM benefits"); while ($row = mysql_fetch_array($query1)) { $b_id .= $row['b_id'] . ","; } substr($b_id,0,-1); That should remove the last coma, you can however do this in many other ways as I said earlier.
  7. Are you familiar with objects? If so, create an object and insert it into an array, if you want a key for this object just make use of associative arrays. The object could have your variables Title, Header, and an array containing the keys. Then to loop through the array you just do: foreach($objectArray as $object){ //Extract the data from the object here } Did I understand you right?
  8. if (empty($string) || $string == "word1") { || means "or".
  9. Also the code you're presenting is very redundant, a tips is to use the already existing HTML and inject the variables there.
  10. Been programming PHP for roughly 12 years now (Since PHP 3) and am here to gather information and help.
×
×
  • 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.