Quantcast
Channel: WampServer - WampServer English
Viewing all articles
Browse latest Browse all 3177

Connect to SQL with any old username ? (no replies)

$
0
0
I'm new to PHP and the actual workings of Wamp. It seems that it does not matter what ever I enter for username and password, I always connect. If I'm running locally, do they not matter ?

<?php
$servername = "localhost";
$username = "Fred";
$password = "Blogs";
$dbname = "clubs_db";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}

$sql = "SELECT MemName FROM members_cams";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "MemName: " . $row["MemName"]. "<br>";
}
}
else {
echo "0 results";
}
$conn->close();
?>

Viewing all articles
Browse latest Browse all 3177

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>