Jump to content

jmahdi

Members
  • Posts

    69
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jmahdi's Achievements

Member

Member (2/5)

0

Reputation

  1. Hi there: what i'm trying to do is i want to get the contents of heading and text_details and merge them together before adding them as one entry into database: <div class="heading"><p> Second quote: </div><div class=text_details> <p> Satan's substitute for repentance is the man's rationalization of evil. <p></b></div> my code looks s/thing like this: foreach( $dom->getElementsByTagName('div') as $div ) { foreach( $div->attributes as $attributes ) { if( strtolower($attributes->name) == 'class' ) { if( strtolower($attributes->value) == 'heading' || strtolower($attributes->value) == 'text_details') { $quote = $div->textContent; $clean_quote = mysql_real_escape_string($quote); echo "the quote is: " . $clean_quote . "<br />"; mysql_query("INSERT INTO quotes (quote) VALUES ('$clean_quote')")or die(mysql_error()); } } } } when i do this obviously i get: Second quote of the day entered into a field by itself and Satan's substitute for repentance is the man's rationalization of evil. into another field...how to make them one!?? thanks in advance
  2. thanks everyone.. your help is appreciated
  3. actually it gets the red but not the green, but now i want a regex that excludes rather than restrict to if you know what i mean!!
  4. ya true...but all the fonts i'm using have a color
  5. yes....i solved it /<font.*?(?:color="800080"|color="red"|color="maroon")>(.*?)<\/font>/ ....thanks all for the help
  6. thanks..but can't i use something like [^color|other colar] ? regex
  7. hi i just need to grab all font tags (with innerhtml) excluding tags certain colors, green and red for example or in code 0000DD for example.... thanks in advance
  8. hi there i'm trying to get the number only when in this place: رقم الحديث: 62 the number following an arabic word and a colon, i'm pulling only these numbers from a database and they allways come after this specific arabic word (some times there might be a space between the colon and the digit), i had allready tried this /(\d+) :\p{Arabic}/ but to no avail!! what can i do? thanks
  9. remove the end > you mean $pattern = '~<a.*?href=".+?\?N_ID=(\d+)"~'; !?
  10. thanks, but what about the attributes after href : style="text-decoration: none;"> as the regex does not include it as a possibility...
  11. Hi Im trying to pull N_ID=value in: <a rel="gb_page_center[626, 267]" title="narrator" href="N_Details.php?N_ID=3280" style="text-decoration: none;"> i got regex like: <a[^>]+href=\".*?\\(?:RawyID)=+(.*?)\"> but dont see it working i need a regex that will: pull N_ID and disregard the existence/inexistence of the other attributes, such as : style , rel or whatever.. thanks in advance
  12. I think i found the problem, i was using double quoutes in : $str = "<i><font color="800080"> man </font></i><p><font color="9898989"> hi </font></p><p><font color="1111111"> cheers </font></p>"; while it should be: $str = '<i><font color="800080"> man </font></i><p><font color="9898989"> hi </font></p><p><font color="1111111"> cheers </font></p>'; thanks anyways...
  13. Hi there i have this code: $str = "<i><font color="800080"> man </font></i><p><font color="9898989"> hi </font></p><p><font color="1111111"> cheers </font></p>"; $pattern = '/<font .*?>(.*?)<\/font>/'; if(preg_match_all($pattern, addslashes($str), $posts)){ $i=0; for($i; $i < count($posts[0]); $i++){ echo "content: " . $posts[0][$i] . "<br/>"; echo "colour: " . $posts[1][$i] . "<br/>"; echo "<br />"; } } and it doesn't work apparently because of the addslashes but its really needed as double quotes needs to be escaped, consider that i'm applying this code to a larger html file with hundreds of double quotes to be escaped.... error msg i get is Parse error: syntax error, unexpected T_LNUMBER in thanks in advance..
×
×
  • 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.