-1

I am getting a syntax error,

unexpected '$db' (T_VARIABLE) in /home/u606328786/public_html/qoute/php/connect.php on line 10

Here is the code:

<?php

// Make a MySQL Connection
$host="";
$user="";
$password="";
$db = "";
$link = mysqli_connect($host, $user, $password)
$db = new PDO('mysql:host=mysql.nazuka.net;dbname=;charset=utf8';dbsuser=;dbpass=);

Based on my research the mysql_* functions no longer works and suggest trying the mysqli_* or PDO function. I used the PDO function, but I am still getting the syntax error.

Dharman
  • 30,962
  • 25
  • 85
  • 135
  • 1
    Does this answer your question? [PHP parse/syntax errors; and how to solve them](https://stackoverflow.com/questions/18050071/php-parse-syntax-errors-and-how-to-solve-them) – Dharman Mar 14 '22 at 17:10

1 Answers1

-1

Do not mix mysqli_* interface with the PDO interface. Pick either one, then code according to its rules.

The cause of the syntax error is the missing ";" right before "$db".

Rick James
  • 135,179
  • 13
  • 127
  • 222