Jump to content

AbraCadaver

Staff Alumni
  • Posts

    1,893
  • Joined

  • Last visited

  • Days Won

    8

AbraCadaver last won the day on November 3 2013

AbraCadaver had the most liked content!

About AbraCadaver

  • Birthday 02/20/1971

Contact Methods

  • Website URL
    http://www.spidean.com

Profile Information

  • Gender
    Male
  • Location
    The Republic of Texas

Recent Profile Visitors

25,089 profile views

AbraCadaver's Achievements

Newbie

Newbie (1/5)

61

Reputation

1

Community Answers

  1. $confirmation is a string and not an array at that point. If you did $confirmation[0] it would give you string offset 0 which is the first character of the string, but there is no redirect offset in a string.
  2. Another one: if(preg_grep("/$search/i", file("legitimatesites.txt"))) { echo "This website is an authorised distributor"; } elseif(preg_grep("/$search/i", file("illegitimatesites.txt"))) { echo "This website is NOT an authorised distributor"; } else { echo "Unknown website"; }
  3. First, clarify what "but it doesnt seem to work" means. Report any errors using: error_reporting(E_ALL); ini_set('display_errors', '1'); Also, no need to loop, you can use arrays in the str_ireplace: $haystack = file($file); /* put contents into an array */ $search = "$name, $sname"; /* value to be replaced */ $replace ="replaced, replaced"; /* value doing the replacing can be replaced by new variables*/ $haystack = str_ireplace($search, $replace, $haystack); /* case insensitive replacement */ But one problem is, what if $name and $sname are on different lines? No replacement is made. Maybe just use the file as a string: $haystack = file_get_contents($file); /* put contents into a string */ $search = "$name, $sname"; /* value to be replaced */ $replace ="replaced, replaced"; /* value doing the replacing can be replaced by new variables*/ $haystack = str_ireplace($search, $replace, $haystack); /* case insensitive replacement */
  4. You want to use the key from the foreach. Also you want to use !== false because it exists: foreach($scanned_directory as $key => $elements){ $pos = strpos($elements, 'thumbnail'); if($pos !== FALSE){ unset($scanned_directory[$key]); } } However this is much simpler (replaces all of your code): $files = preg_grep("/thumbnail/", glob("$var/*.*"), PREG_GREP_INVERT);
  5. For the original question, if you don't need the 1 or 0 for some other reason (or even if you do, just include both the column and the column case), do it in the query: SELECT column_name, CASE WHEN column_name IS 1 THEN 'Yes' ELSE 'No' END AS something FROM table_name Or: SELECT column_name, IF(column_name=1,'Yes','No') AS something FROM table_name For the fetch issue: $select_rma_detail->setFetchMode(PDO::FETCH_ASSOC);
  6. If you are instantiating an object of a class that contains those functions then upon calling set_FullName() if the if condition evaluates to true then the object var $this->FlagCount will be incremented 3 times. You haven't shown enough code or where you are attempting to see $this->FlagCount and it has not been incremented.
  7. This will never strips tags: $var = htmlentities($var); $var = strip_tags($var); Maybe reverse them.
  8. Though not the best solution, this should work: $newpost = str_replace("<div contenteditable=\"true\"><p>", "<p>", $post); $newpost = str_replace("<p>", "<div contenteditable=\"true\"><p>", $newpost); EDIT: Actually, your other idea should work: $newpost = str_replace("<p>", "<div contenteditable=\"true\"><p class=\"paragraph\">", $post);
  9. IPv6 enabled Windows, such as Windows 8 resolve localhost to an IPV6 address ::1. If your application is not IPV6 then the connection must timeout and then the IPV4 address 127.0.0.1 is resolved and used.
  10. Where are you running out of memory? Building the $values array?
  11. $allusers = mysql_query("SELECT * FROM PMs WHERE `status`='0' AND ReceiveID='$myU->ID' ORDER BY ID"); if(!$allusers) { echo mysql_error(); } Just a guess but you'll probably need: ReceiveID='{$myU->ID}'
  12. If all you need is the count, here's one way: str_replace($needle, null, $result, $count); echo $count;
×
×
  • 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.