I am working with PhpSpreadsheet(PHPExcel) to do an Excel in PHP and I got stuck when I needed to use COUNTIF. Here is my code:
$spreadsheet->getActiveSheet()->setCellValueByColumnAndRow(59,5,"=COUNTIF(BH7:BH125,'<>0')"); //BH POSITION
It doesn't work. If I putt /* BH7:BH125, 0 */ ,then it works but I want to use <>0. Can anyone help me?
Thanks.
It expects double-quotes for string parameter. Instead
"=COUNTIF(BH7:BH125,'<>0')"
try to use
"=COUNTIF(BH7:BH125,\"<>0\")"
Related
My example code is given below.
$a= "I think there are many people who can help in my difficulty. breakword Thank you in advance. brwakword If i got this solution I will be happy. Breakword I have already searched in google about it I did not get it's solution. Breakword If you have any link of solution please help me. breakword Thank you again!";
From the above string I want to get the sentence between 2nd and 3rd 'breakword' word.
It means I want to extract 'If i got this solution I will be happy.'.
If you have any solution please help me. Thank you in advance
You can split your string into smaller parts using explode() and get the "Nth" part of the array.
$sentences = explode('breakword', $a);
echo $sentences[2];
PHP > 5.4 will support this too :
echo explode('breakword', $a)[2];
a similar approach but intead of using explode you can also use preg_split
supports (PHP 4, PHP 5)
preg_split('/breakword/', $a);
for the second answer you can use
$dummy=array();
preg_match_all('/breakword/', $a,$dummy)
I m trying to delete one image using unlink function.
But path creates error to pass. My syntax is as below.
unlink('customer\'.$user_id."\book\".$id);
But this will generate error here.
Please help me to solve this. Thanks in advance.
Try this:
unlink('customer\\'.$user_id."\\book\\".$id);
Use this (Use Backslash)
unlink("customer/".$user_id."/book/".$id)
I have a small problem with my PHP script. I want to be able to have a URL within a query string so it would look like this:
http://example.com/?url=http://google.com/
This works absolutely fine and $_GET['url'] will return http://google.com.
The problem is when the URL in my query string already has query string, for example:
http://example.com/?url=http://www.amazon.com/MP3-Music-Download/b/ref=sa_menu_mp3_str?ie=UTF8&node=163856011
will return:
http://www.amazon.com/MP3-Music-Download/b/ref=sa_menu_mp3_str?ie=UTF8
and I want it to return:
http://www.amazon.com/MP3-Music-Download/b/ref=sa_menu_mp3_str?ie=UTF8&node=163856011
I am using PHP for server side.
Could anybody please help?
Update
I am using Codeigniter, so if this is the reason why it isn't working as it should then please let me know.
You need to encode the url passed as query argument:
If you send it from PHP, use urlencode or rawurlencode.
If you send it from JS, use encodeURIComponent.
Use urldecode() to pass query string
yeah, I know, the title is kind of confusing, but no better title came to my mind.
Here is my problem:
I want to use a link in my application, which would look like this:
localhost/index?jumpto=some_folder/somescript.php?someparam1=1234&someparam2=4321
The problem is that &someparam2 is meant to hang on the second $_GET-Param.
It would be like this:
localhost/index?jumpto=some_folder/somescript.php?someparam1=1234&someparam2=4321
Instead, PHP interprets that &someparam2 hangs on the first $_GET-Param.
localhost/index?jumpto=some_folder/somescript.php?someparam1=1234&someparam2=4321
Does anyone know a solution for this?
I already tried
localhost/index?jumpto='some_folder/somescript.php?someparam1=1234&someparam2=4321'
but of course that didn't work.
I hope you can understand my problem.
Thank you for your time.
You will need to URL encode your string some_folder/somescript.php?someparam1=1234 so that php will not parse & in the query string as a param separator.
use urlencode("some_folder/somescript.php?someparam1=1234");
Okay so I have my PHP code: (I need help with the 4th line) More info down below the code.
Basicly I am trying to get code below. i am trying to put get part of url but it doesn;'t work
$oIMDB = new IMDB('<?ph p echo$_GET("m");?> ')
and on the 4th line i put the code
and the code doesn't work, how can i use it?
I think you mean this:
$oIMDB = new IMDB($_GET["m"]);
you shouldn't need the php scripting block inside the class call. Function parameters don't need quotes either unless you are using a literal string. Try
$oIMDB = new IMDB($_GET["m"])