如何从 SQL 表的列中获取所有数据并与从表单中获取的数据进行检查?这是我到目前为止所拥有的:
<?php
$con=mysqli_connect("www.tqbtest.comlu.com","a5349216","Password","a5349216_test");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
//How do I check the data from the form to make sure there is no username/email already used?
$sql="INSERT INTO Profiles (firstName, lastName, username, email, password, region, profileGroup, verified)
VALUES
('$_POST[firstname]','$_POST[lastname]','$_POST[age]')";
if (!mysqli_query($con,$sql))
{
die('Error: ' . mysqli_error($con));
}
echo "1 record added";
mysqli_close($con);
?>