0

this code was developed in config.php file but it gives that........ Parse error: syntax error, unexpected 'utf' (T_STRING), expecting ',' or ';' in /home2/champio1/public_html/includes/config.php on line 16 i.e meta charset="utf-8" />


<?php
$db_host = "localhost";
$db_username = "champio1_EyeLion";
$db_password = "";
$db_name = "champio1_database";

$con = @mysqli_connect("$db_host","$db_username","$db_password","$db_name");

if(!$con)
{
echo"
<html>

<head>
<meta charset="utf-8" /> 
</head>

<center>    
<br>
<br>
<br>        <h1>Coming Soon - سيتم تشغيل الموقع قريبا </h1>



</html>";
exit;
}

$DomainUrl = "http://joglobe.com";

?>
Amr Gomaa
  • 11
  • 3

2 Answers2

0

The quotes inside the HTML you're trying to echo break the string. You could try to escape them, but using a nowdoc would be so much simpler:

$comingSoon = <<< 'COMING_SOON'
<html>

<head>
<meta charset="utf-8" /> 
</head>

<center>    
<br>
<br>
<br>        <h1>Coming Soon - سيتم تشغيل الموقع قريبا </h1>



</html>
COMING_SOON;

echo $comingSoon;
Mureinik
  • 297,002
  • 52
  • 306
  • 350
  • With over 100k reputation I think you should know how many duplicates there exist for this kind of question and that you can vote to close them. – Rizier123 Jan 05 '17 at 22:47
  • Thanks a lot it worked partially but when get http://joglobe.com//signup many errors appeared....... Warning: mysqli_query() expects parameter 1 to be mysqli, boolean given in /home2/champio1/public_html/includes/account.function.php on line 98 Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, null given in /home2/champio1/public_html/includes/account.function.php on line 99 Warning: mysqli_query() expects parameter 1 to be mysqli, boolean given in /home2/champio1/public_html/includes/account.function.php on line 41 – Amr Gomaa Jan 06 '17 at 00:38
0

You have double quotes embedded in a string in double quotes. This makes the PHP interpreter think you're done with your string, so it expects the next thing to be probably a semicolon. You need to escape the double quotes, like this \"

In other words, replace all instances of " in the text you want to echo with \" and you'll be fine.

For instance:

echo "<meta charset=\"utf-8\">"
shalvah
  • 881
  • 10
  • 21