How to make a selection from the database, if the data with the value matches another table, for example, how to display the value of Moscow from the users table, if it matches the other table
<?php if ( get_post_meta( $post->ID, 'cp_street', true) ) : require 'connect.php'; mysql_set_charset( 'utf8' ); $sql_select = "SELECT * FROM users"; $result = mysql_query($sql_select); $row = mysql_fetch_array($result); do { printf ("if (city == '".$row['name']."') { $('#mydiv').html('" .$row['last_name']. " - ".$row['email']."');}" ); } while($row = mysql_fetch_array($result)); endif; ?> This is responsible for the sample, the problem is that it displays the entire value