Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The short answer is: no, you should not expect it to, especially if using the <a href="http://php.net/manual/en/migration54.new-features.php" rel="nofollow">new features</a> of PHP 5.4 within your code.</p> <p>The specific error you are referring to with: </p> <blockquote> <p>Parse error occur to the code</p> </blockquote> <p>is because the line </p> <pre><code>$country = mysql_fetch_row(queryMySQL("----"))[0]; </code></pre> <p>is using the new feature: </p> <blockquote> <p>Function array dereferencing</p> </blockquote> <p>Which, prior to PHP 5.4, had to use a temporary variable in order to access a specific index of the return, ie:</p> <pre><code>$country_temp = mysql_fetch_row(queryMySQL("----")); $country = $country_temp[0]; </code></pre> <p>Now, being that you are a novice developer, there are a few things you should note. The first and most important being that <code>mysql_</code> functions are <a href="http://us2.php.net/manual/en/function.mysql-query.php" rel="nofollow">deprecated</a> giving the note: </p> <blockquote> <p>This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQL extension should be used.</p> </blockquote> <p>In other words, use <a href="http://us2.php.net/manual/en/book.pdo.php" rel="nofollow">PDO</a> if wanting to use prepared statements, or <a href="http://us2.php.net/manual/en/book.mysqli.php" rel="nofollow">MySQLi</a> if not. Another advantage of using PDO and obtaining only one column as you are in the example code is that once you are connected, you can use the function <a href="http://us2.php.net/manual/en/pdostatement.fetchcolumn.php" rel="nofollow"><code>PDOStatement::fetchColumn()</code></a> to obtain only one column like you are trying to do now.</p> <p>Anyways, I hope this explanation helps you understand why you can't go back to PHP 5.3.x if using specific PHP 5.4 abilities - and also some understanding of how to improve your database connection and available functions that can help you get your desired result without using the "array dereferencing" that is provided with PHP 5.4. ^^</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload