Reputation: 653
Hello i am newbie in php I am having a simple php error I did google. but wasnt able to figure out the exact keywords
<?php
$vtext="<img alt="" src="/wp-content/themes/9GAG/images/smileynearvote.JPG" style="width: 15px; height: 17px; " />";
?>
This is how i call it
<?php echo $vtext ?>
But when i use this i get an Internal server Error
i did google only founded that how to create an image with php
but didnt find how to use it string
My cms is wordpress
Upvotes: 0
Views: 49
Reputation: 97707
You have to escape the "
in your string
$vtext="<img alt=\"\" src=\"/wp-content/themes/9GAG/images/smileynearvote.JPG\" style=\"width: 15px; height: 17px; \" />";
Read more http://php.net/manual/en/language.types.string.php#language.types.string.syntax.double
Upvotes: 1
Reputation: 73011
You need to escape your "
(double quotes) or enclose the entire string in '
single quotes:
$vtext = '<img alt="" src="/wp-content/themes/9GAG/images/smileynearvote.JPG" style="width: 15px; height: 17px; " />';
I encourage you to read more about Strings in PHP.
Note: This may not be the only error. When asking about errors you should always post the full error message and the offending line and the line above it.
Upvotes: 2