Error in trying to Upload 3 images [closed] - php

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
Hello i'm new in PHP and i'm trying to upload 3 images and i got an error
Please don't downgrade me i'm just learning and trying to make a simple system. Thank you
Parse error: syntax error, unexpected T_STRING in C:\xampp\htdocs\epushmoyan\customer\connect.php on line 17
Here's my code :
function addpost($a,$b,$c,$d,$name,$type,$size,$tmp_name,$error,$name1,$type1,$size1,$tmp_name1,$error1,$name2,$type2,$size2,$tmp_name2,$error2,$e)
{
$img = 'thumbnails/products/'.$name.$name1.$name2
mysql_query("INSERT post(p_name,p_contact,p_email,image,image1,image2,p_address,dateadded) values ('$a','$b','$c','$d','$img','$e',NOW())");
if ($error > 0)
{
die("Error uploading file! Code $error.");
}
else
{
if($size> 10000000000) //conditions for the file
{
die("Format is not allowed or file size is too big!");
}
else
{
move_uploaded_file($tmp_name,$tmp_name1,$tmp_name2,"thumbnails/products/".$name.$name1,$name2);
}
}

Missing ;:
$img = 'thumbnails/products/'.$name.$name1.$name2
^--- here
mysql_query
Voting to close, since it's a simple typo.

Missing ; in
$img = 'thumbnails/products/'.$name.$name1.$name2

Related

Use of undefined constant i - assumed 'i' (this will throw an Error in a future version of PHP) (laravel post method error) [closed]

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 months ago.
Improve this question
I want to enter an multiple field entered data in table with for loop
but I am getting an error in the post method.
The error is:
Use of undefined constant i - assumed 'i' (this will throw an Error in a future version of PHP)
controller code:
$degree = $request->degree;
if($degree > 0)
{
for($i=0;$i<count($degree);$i++){
$edu = new education;
$edu->degree = $request->degree[i];
$edu->clg = $request->clg[i];
$edu->yoc = $request->yoc[i];
$edu->save();
}
}
so, please suggest me what I can do.
here there is a silly mistake bro you not remember to use $i inside loop for the degree, clg and yoc
$degree = $request->degree;
if($degree > 0)
{
for($i=0;$i<count($degree);$i++){
$edu = new education;
$edu->degree = $request->degree[$i];
$edu->clg = $request->clg[$i];
$edu->yoc = $request->yoc[$i];
$edu->save();
}
}

Error: Unexpected $this in PHP Code [closed]

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 7 years ago.
Improve this question
I have two PHP scripts, dispatcher.php and processor.php (there are more, but I've commented the others out because they're not necessary at the moment).
I get the following error:
Parse error: syntax error, unexpected '$this' (T_VARIABLE) in /----home directory-----/classes/processor.php on line 12
Here's the code for processor.php:
class Processor{
protected $player;
protected $name;
protected $id;
function __construct(){
}
function loadvars($request){
$this->loadvar($this->name, $request, "name");
}
private function loadvar($target, $request, $name){
if(isset($request[$name])){
$target = $request[$name];
}
else{
$target = "";
}
}
}
this is the code for dispatcher.php:
require('classes/processor.php');
$test = new Processor();
$test->loadvars($_GET);
I don't see why this error occurs?
I'm coding using Sublime on Windows, if that matters.
Fixed it!
Try retyping the file if you have weird parse errors. I copied the code back from StackOverflow (where I typed it above) and it worked. Guess some unparseable character got into the file somewhere.

PHP - Parse error: syntax error, unexpected T_VARIABLE in /home/a5547326/public_html/index.php on line 6 [closed]

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'];

PHP if x then image, else other image (so close) [closed]

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
It's a basic question, but I've googled all sorts of variations of it & nothing that quite answers me. I want to display one of two images. One if the criteria is met & one if it is not met. This code works. If criteria is met, it does display the image. But there is no alternative
<? if(stripslashes($getfeedbackQryRow['CompanyID'])=='344'){?><img src='img1.png' alt='Todays Bite'><? }?>
Then I put this together, but it's still wrong
<?PHP
if ($getfeedbackQryRow['CompanyID']) == '344') {
print ("<IMG SRC =/img1.png>");
}
else {
print ("<IMG SRC =img2.png>");
}
?>
This one looks like it should be right, but it throws an error... It's probably a syntax issue. Does anyone know what I'm doing wrong?
You have an extra ")"
if ($getfeedbackQryRow['CompanyID']) == '344') {
Remove the ")" here ['CompanyID'])
if ($getfeedbackQryRow['CompanyID']) == '344') {
// ^------- this is causing your error
You should do something simple like this:
$image_name = $getfeedbackQryRow['CompanyId'] == '344' ? 'img1.png' : 'img2.png';
echo '<img src="' . $image_name . '">';

Getting Parse Error While Using Two Functions [closed]

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 am trying to write a program using Call By Reference to calculate the area but I am getting a Parse Error :-
Parse error: syntax error, unexpected 'ar' (T_STRING) in C:\xampp\htdocs\workspace.php on line 7
Now I, cannot think why it is happening?
<?php
function perimeter(&$l,&$b,&$result)
{
$result=2*($l+$b);
}
funtction ar(&$le,&$br,&$result1)
{
$result1=$le*$br;
}
$result=1;
$length=$_GET['length'];
$breadth=$_GET['breadth'];
echo "<h1><center>Area And Perimeter Calculator Using Call By Reference</h1></center>";
$result = perimeter($length,$breadth,$result);
echo "<br />The Perimeter Of The Rectangle Is <strong>$result</strong>";
$result= ar($length,$breadth,$result);
echo "<br /><br />The Area Of The Rectangle Is = <strong>$result</strong>";
?>
You misspelled function:
funtction ar(&$le,&$br,&$result1)
{
$result1=$le*$br;
}
should be
function ar(&$le,&$br,&$result1)
{
$result1=$le*$br;
}

Categories