I have these queries in the database
<?php
$consulta = mysql_query("SELECT * FROM mesas LIMIT 50");
if (mysql_num_rows($consulta)==true) {
while($lnmesas = mysql_fetch_array($consulta)){
$consultainterna = mysql_query ("SELECT * FROM mesas INNER JOIN pedidos");
?>
I need to make a comparison of a record in the database where the mesas
column of the pedidos
table is equal to the id
column of the mesas
table. If the result is positive it gives a echo
with a value, otherwise it gives a echo
with another value.
I combed this way would work:
if($lnmesas['pedidos.mesas'] == $lnmesas['mesas.id']){
echo "success":
}else{
echo "danger";
}
But unfortunately it did not work. Can someone explain to me the correct way to do this, I'm a beginner, I do not have much experience yet.
Here is the structure of my tables ...