I can't find the error in this line of php code.I tried checking it online and I get this is wrong. 'darth'(T_STRING), expecting ']' in your code on line 1
I am new and know very little about coding. Can someone please help! Thank you!
if(trim(strtolower($_POST['bonusq’]))!='darth vader’) {
You are using typographical single quotes after "bonusq" and "vader", which can't work - change them to regular quotes
Try with this:
$a = $_POST['bonusq'];
if(trim(strtolower($a))!='darth vader') {
Hope to help you.
Related
So I'm not familiar with PHP and a friend of mine got this error message from their site:
Uncaught Error: Function name must be a string in
/var/www/wp-content/themes/framework/php/class-htmlhelper.php:222
Any help on what is needed would be greatly appreciated! I've tried to understand what component needs to become a string but I'm not sure...
In line number 218 you have to write $this->element to call a function.
I think $this->$element['type'] not string.
You try print $this->$element['type']
What is difference between "hard-coding" and "soft-coding"?
Please explain it with an example of PHP code and MYSQL.
Thanks a lot.
I googled it.
Check this out: http://www.thoughtclusters.com/2007/08/hard-coding-and-soft-coding/
So I am having problems with the symbol µg in PHP. The symbol is inside an array of data but I can't seem to match it with the following:
if($value == 'µg') {
echo 'blah';
}
Does anyone happen to have a work around for this? I'm assuming PHP saves it as a different type then what I am comparing it to because it never echo's the 'blah' above. I have searched around for a while now and cannot find anything to help me. Thanks!
Okay so even with the help of some people I haven't found the answer.
The best I came up with that actually works is:
substr('µg', 1,7) == 'micro;g'
That's the only way I found out how to parse the data. If you put the & in front of the micro; you get the µ. A dirty fix but if anyone has a way around please let me know. Thanks!
<?php
$file_handle=fopen("normal.txt","rb");
$i=0;
while (!feof($file_handle)){
$fline=gets($file_handle);
$fparts=preg_split("/:|;\");
$x_values[$i]=(float)$parts[1];
$y_values[$i]=(float)$parts[2];
$i=$i+1;
}
include 'libchart/libchart/classes/libchart.php';
$data_length=sizeof($x_values);
for(i=0;$i< $data_length; $i++)
$dataset -> addPoint(newPoint('',$y_values[$i]));
$chart -> render('figs/text.png');
?>
//this part is not recognised...so it is thhrowing an error.
I think the rest of the code is ok....but that thing keeps throwing that error at the end of my code.I just don't know why...could please someone help me? I'd appreciate that much .That is the only error i find....if there are others too please tell me...i am just a beginner at website designing...
So your help is precious to me
You have delimted your closing quote in this line:
preg_split("/:|;\");
You should put in a second \ to counter it:
preg_split("/:|;\\", $string);
Normally when you put a \ before a quotation, it means "treat the quotation as part of the string". As you don't want it to mean that you need to delimit the delimiter heh. The compiler thinks that the rest of your code is still part of the string - even the syntax highlight here on SO is showing it.
See the difference:
$fline=gets($file_handle);
$fparts=preg_split("/:|;\\", $string);
$x_values[$i]=(float)$parts[1];
$y_values[$i]=(float)$parts[2];
$i=$i+1;
Edit: The elephant in the room was pointed out by KarelG. Good show. preg_split does indeed need to params. Without the extra \ it would have still not worked though :)
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)