Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
The code that i'm using to connect to my database has no problem and it is not working

What I have tried:

Parse error: syntax error, unexpected ''($servername,$username,$email' (T_CONSTANT_ENCAPSED_STRING) in D:\xampp\htdocs\SMART TICKETING\connect.php on line 9
Posted
Updated 19-Apr-22 1:34am
Comments
Richard MacCutchan 19-Apr-22 7:37am    
Please use the Improve question link above, and add complete details of the code that is not working.
Richard Deeming 19-Apr-22 12:41pm    
Your question makes no sense: if it "has no problem", then it would be working. On the other hand, if it is "not working", then it clearly has a problem.

But since you've only shown a truncated part of the error message, and none of the relevant parts of your code, nobody can tell you what the problem is or how to fix it.

1 solution

I feel like you want to make a simple db connection like this maybe it can help you just copy and past and change it to your own db name
PHP
<?php
$servername = "localhost";
$username = "root";
$password = "";
$db = "bestelapp"; // name of your own db

// Create connection
$conn = new mysqli($servername, $username, $password, $db);

// Check connection
if ($conn->connect_error) {
  die("Connection failed: " . $conn->connect_error);
}
//connection works
?>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900