I have a sql database that when a key is passed from the web page input box back to the sql database (server) this generates the encoded key and passes it back to the web page. If the wrong key is sent then it returns wrong key. If it is correct it will return the generated key. This works perfectly. However when i try to add an additional check in the name of payment 1 for true 0 for false i can not combine the two. Meaning i would like both conditions to be met to make this work. Here is the code that works.
$sql = "SELECT decrypt_key FROM keys WHERE software_key=" . "'" . $software_key_encoded . "'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
echo $row["decrypt_key"];
}
} else {
echo "Failed";
}
$conn->close();
}
else {
echo "Failed";
}
followed by what i am trying to do, This throws the error of Trying to get property of non-object in /---/ Failed
$sql = "SELECT decrypt_key FROM keys WHERE software_key=" . "'" . $software_key_encoded . "'";
$eql = "SELECT payment FROM new_keys WHERE payment =1";
$result = $conn->query($sql) && $result1 = $conn->query($eql);
if ($result->num_rows > 0 && $result1->num_rows > 1) {
while($row = $result->fetch_assoc()) {
echo $row["decrypt_key"];
#echo $row["payment"];
}
} else {
echo "Failed";
}
$conn->close();
}
else {
echo "Failed";
}
Aucun commentaire:
Enregistrer un commentaire