Answer the question
In order to leave comments, you need to log in
How to make validation and SQL query?
Hi everyone, I have this code
var connection = mysql.createConnection({
host : 'localhost',
user : 'root',
password : '',
database : 'database'
});
connection.connect();
var queryString = 'SELECT * FROM table WHERE id = 4 AND paid = 9 LIMIT 0, 1';
connection.query(queryString, function(err, rows, fields) {
if (err) {
console.log("ERROR");
}
else
{
if(rows.length != 0)
{
console.log("FOUND");
}
else
{
console.log("NOT FOUND");
}
}
});
connection.end();
$mysqli = new mysqli("localhost", "root", "", "database");
$query = $mysqli->query("SELECT * FROM `table` WHERE `id` = '5'");
if($query->fetch_array())
{
echo "FOUND";
}
else
{
echo "NOT FOUND";
}
$mysqli->close();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question