php unexpected 'meta_value' (T_STRING) [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 8 years ago.
Improve this question
im getting this error but cannot figure out why
while($info = mysql_fetch_array( $data ))
{
echo itg_fetch_image('.$info['meta_value'].'); //the line giving error
Print "<tr>";
Print "<th>ID:</th> <td>".$info['meta_id'] . "</td> ";
Print "<th>VALUE:</th> <td>".$info['meta_value']. "</td> ";
Print "<th>DONE:</th> <td>YES</td> ";
}
if i comment out this line it shows fine in the value td, ive tried everthing. taking the dots out the taking the comments out then adding "". itg_fetch_image is http://www.intechgrity.com/automatically-copy-images-png-jpeg-gif-from-remote-server-http-to-your-local-server-using-php/#
the code is ment to be echo itg_fetch_image('url') and all meta_values return a url string

The quotes on the echo line are causing the problem.
It should look like this:
echo itg_fetch_image($info['meta_value']);

it seems that itg_fetch_image() is a function
try this:
echo itg_fetch_image($info['meta_value']);
you can just pass variable . do not need to use quotes.

You must write it as
echo itg_fetch_image($info['meta_value']);

Related

How come id will not pass through link? [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 4 years ago.
Improve this question
I have a simple link that needs to pass a variable through $_GET and set it to a variable in the page that is being opened. It is failing every time however and I am not sure why.
<a class='section_header' href='category/index.php?`id='" . $catid . "'><b>" . $row[0] ."</b></a>
Code in category/index.php
$id = $_GET['id'];
echo $id;
<a class='section_header' href="category/index.php?id=<?php echo $catid?>"><b><?php echo $row[0];?></b></a>
Try
<a class='section_header' href='category/index.php?id='" . $catid . "'><b>" . $row[0] ."</b></a>
You had a random ` in there. Once it prints out you can use inspect element to make sure the url looks correct and id is populated.

Unable to view images in php [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 am unable to view images on my webserver in php and I keep getting server 500 error.
I believe that it is this line of code echo "<img src='$row["sourchPath"]'>":
while ($row = mysqli_fetch_assoc($result)){
if($row){
echo $row["sourchPath"]; // this works
echo "<img src='$row["sourchPath"]'>";
}
else {
echo "error";
}
}
My file directory is like images/football.jpg
The problem is because of this line:
echo "<img src='$row["sourchPath"]'>"; // syntax error
It should be,
echo "<img src='" . $row["sourchPath"] . "' />";
You may use
echo "<img src='" . $row["sourchPath"] . "'>";
in place of your code.
It will work

HTML in PHP (IMG SRC with variable as URL) [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 am trying to display an image using a variable "$images" that contains the URL parsed form an API.
This is my code:
echo "<td>""<img src='",$image,"'>""</td>\n";
I assume there is a typo I cannot detect because I get a blank screen when running this.
echo "<td>"."<img src='".$image."'>"."</td>";
Or
echo "<td><img src='".$image."'></td>";
You were missing the dots/commas after/before the td tags
use . not ,
<img src='".$image."'>
PHP requires that you chain your strings together using a .
E.g.
echo 'Test' . ' ' . 'Hello'; // Test Hello
Or simply :
echo "<td><img src='$image'></td>";
Check documentation.

PHP console does not echo [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
Okay this really strange or I am missing something. When I run this very simmple PHP script on cmd I get the expected output which is 0. but when I uncomment the last two lines of code. . .nothing is displayed.
<?php
$test1 = 0;
echo $test1;
$test2 = 0;
#$test1_weight = 0:
#$test2_weight = 0;
?>
Is there some rule against declaring variables after an echo statement?
$test1_weight = 0:
--> change ":" to ";"
No there is no rule against declaring variables after an echo statement

echo out valuename in php [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 years ago.
Improve this question
how can I print out a variable name in text in php?
I want to accomplish something as simple as having this:
echo "|" . "$myvariable" . "|";
print out this:
|$myvariable|
instead of this:
||
how can I accomplish this?
Use single quotes so that the variables don't get interpolated:
echo "|" . '$myvariable' . "|";
As others pointed out, use single quotes to show the variable name "as is".
echo "|" . '$myvariable' . "|";
Be sure to read this part of the manual.

Categories