Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 9 years ago.
Improve this question
I am getting the following error message. Can someone please help me.
Parse error: syntax error, unexpected T_LNUMBER, expecting ']' in /home/whilesto/public_html/includes/init.php on line 61
Following is the code from line 54 to 66
if ($setts['is_mod_rewrite'])
{
$valsArray = explode(",", $_REQUEST['rewrite_params']);
$valsCnt = 0;
$count_valsArray = count($valsArray);
while ($valsCnt < $count_valsArray)
{
$_REQUEST[$valsArray[$valsCnt 1]] = $valsArray[$valsCnt];
$_GET[$valsArray[$valsCnt 1]] = $valsArray[$valsCnt];
$_POST[$valsArray[$valsCnt 1]] = $valsArray[$valsCnt];
$valsCnt = 2;
}
}
The error lies not only in line 61 but also in lines 62 and 63. You have to remove the 1 from between $valsCount and ]:
$_REQUEST[$valsArray[$valsCnt]] = $valsArray[$valsCnt];
$_GET[$valsArray[$valsCnt]] = $valsArray[$valsCnt];
$_POST[$valsArray[$valsCnt]] = $valsArray[$valsCnt];
It also seems to me that you’ve written an endless while loop. You may consider changing line 64 to:
$valsCnt++;
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 5 years ago.
Improve this question
I'm trying to establish a new PDO instance with the following code
<?php
$handler = new PDO(“mysql:host=127.0.0.1;dbname=database”,
“root”, “”);
I get the following error message:
Parse error: syntax error, unexpected ':', expecting ',' or ')' in /Applications/XAMPP/xamppfiles/htdocs/example/connection.php on line 2
There has been no problems like this before until I attempted to do this on a new Mac. Can someone help with this issue?
try this:
$handler = new PDO("mysql:host=127.0.0.1;dbname=database",
"root", "");
your quotes were wrong
You should to this:
<?php
$handler = new PDO("mysql:host=127.0.0.1;dbname=database","root", "");
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I'm getting this error:
Parse error: syntax error, unexpected ']', expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in your code on line 70
Line 70 is $message.
$random_keys=array_rand($lel,1);
$message[] = $lel[$random_keys[0]];
The whole code is here:
$message = array();
$lel = array(
'Are you sure its the new year?',
'And i thought i was dumb', 'its not new year yet',
'LOL its ${date}', '...', '.....', '...', 'WUT', '.......',
'Ya drunk bruh ?', 'You sure you are not drunk ? what is 1+1 then ?'
);
$random_keys=array_rand($lel,1);
$message[] = $lel[$random_keys[0]];
Can we do it like this?
$message[] = $lel[rand(1,11)];
It still gives:
Parse error: syntax error, unexpected ']', expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING)
You are only picking one random key here:
$random_keys=array_rand($lel,1);
So you want to do this:
$random_key = array_rand($lel,1);
$message[] = $lel[$random_key];
Working example: http://3v4l.org/PHWD8
Though, since you're only picking one random key, and one random message, do you even need $message to be an array? I'd just do this:
$message = $lel[array_rand($lel)];
Working example: http://3v4l.org/jJKrG
As for your parse error, there's something we're not seeing in the code you posted. Perhaps it is some other surrounding code, or perhaps you modified the code before pasting here? In any event, you can see that your exact code does not produce a parse error: http://3v4l.org/Io1jc
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I have been trying to put up a small testing site for a project at codebase.host22.org, and I cant seem to get my PHP script to work. The script is hown as follows:
<?php
$browser = get_browser(null, true);
$data = $browser[browser]
$f = fopen("data.csv", "a");
fwrite($f, $data = ",");
fclose($f);
?>
I don't see a problem. But I get this error when trying to visit the page:
Parse error: syntax error, unexpected T_VARIABLE in /home/a5547326/public_html/index.php on line 6
My hosting is with 000webhost. Is there a problem with my code or the server?
You missed semicolon after $data variable.
$data = $browser[browser];
You're missing the quote and the semicolon:
$data = $browser['browser'];
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
i have this bunch of code:
$field_with_lengths = array('menu', 'position', 'visible');
foreach($field_with_lengths as $field_with_lenths => $maxlength){
if(strlen(trim(mysql_prep($_POST[$fieldname]))) => $maxlength){
$errors[] = $fieldname;}
i'm getting the folowing error:
Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW) in C:\xampp\htdocs\vp\edit_info.php on line 22
wich is: if(strlen(trim(mysql_prep($_POST[$fieldname]))) => $maxlength){
i am not managing to find anything wrong on line 22
how can i fix that up?
It's >= (greater than or equal to) not => (equal to or greater than):
if(strlen(trim(mysql_prep($_POST[$fieldname]))) >= $maxlength){
if(strlen(trim(mysql_prep($_POST[$fieldname]))) >= $maxlength){
Equal sign must come after the bracket
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Improve this question
I'm getting the following error:
Parse error: syntax error, unexpected '[' in C:\xampp\htdocs\Ads\register.php on line 5
This is not the full code, but a part of it. Why is that error being thrown?
$fname = _POST['name[first]'];
$lname = _POST['name[last]'];
$email = _POST['email'];
$address1 = _POST['address[addr1]'];
$address2 = _POST['address[addr2]'];
$city = _POST['address[city]'];
$state = _POST['address[state]'];
$country = _POST['address[country]'];
$phno = _POST['number'];
$adtype = _POST['select'];
You're missing the $ in $_POST on all your lines. And your syntax for multi-dimensional arrays is incorrect.
$fname = $_POST['name']['first'];
When you have name="name[first]" in the HTML input element, PHP turns this into a nested array in $_POST, rather than using name[first] as the key.
Try this
$fname= $_POST['name']['first'];
When you see syntax error, unexpected '[' in C:\xampp\htdocs\Ads\register.php on line 5
You should always check your code on line 5, it has invalid syntax
In this case on line 5:
$fname = _POST['name[first]'];
this is a invalid syntax
should replace with:
$fname = $_POST['name']['first'];