Parse error: syntax error, unexpected T_STRING in /home/hyeworld/hyeworld.com/html/port.php on line 3 <? php
session_start ();
mysql_connect ("localhost", "hyeworld", .......
Closed due to the fact that the essence of the issue is not clear to the participants of Dmitriy Simushev , Kromster , HamSter , cheops , post_zeew Oct 26 '16 at 10:12 .
Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .
- In general, the mysql_connect function returns a connection identifier. Therefore, you need to assign a variable that you later use in queries - systemiv
- You would have the 3rd line completely copied here. And that mistake is in her, and you cut her off - DemoS
|
2 answers
Create a conf.php
file. In it, assign the value to variables
<?php $host='localhost; $login='hyeworld'; $parol='пароль'; $dbname='имя БД'; ?>
Further, in your file in which you write this, do this:
<?php require_once ("conf.php"); session_start(); mysql_connect ($host, $login, $parol); mysql_select_db($dbname); ................. ?>
That seems so ...
- oneWell, this is not even advice ... <br> It's just that you propose to separate the config - systemiv
- And what exactly is not going to suit you? Do the same thing in one. What is the difference then? - new_russian_man
|
You have an error in the first line:
<? php
Because of the space, the interpreter recognizes the first line as the opening tag and php as a separate element with an unclosed line, and therefore swears at line 3.
Or make
<?php
Or
<?
- short_open_tags is already cut from PHP. <? - not an option. But about the gap - you are right. - ilyaplot
- It depends on the version used. I strongly doubt that the author uses the latest version of php. - Victor
- Regardless of the version, using short tags today is a bad form. - ilyaplot
- Just noticed that the question was asked 5 years ago - Victor
- one@ilyaplot, in the context of the question, it’s about the fact that the interpreter recognizes them and in the sum with a space before php you get this picture. And in a question of their use, I completely agree with you - Victor
|