Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP function to compare data in two tables to incorporate in existing script
    primarykey
    data
    text
    <p>I need a PHP script that would pull data (player ID) from a mysql table (I know how to do it so far) AND THEN use that player ID (1-5 digit number) to find the corresponding player name in another table.</p> <p>Basically I need to display which player posted which message on a website.</p> <p>Here's the script:</p> <pre><code>&lt;?php include('mysql_connection.php'); $c = mysqlConnect(); $locale = $_GET['locale']; $last_bulletins_id = $_GET['bulletins_id']; sendQuery ("set character_set_results='utf8'"); sendQuery ("set collation_connection='utf8_general_ci'"); if(strcmp($locale,"en") != 0) $locale = "en"; $result = sendQuery("SELECT * FROM bulletins WHERE id &gt; ".$last_bulletins_id." and locale = '".$locale."' ORDER BY id DESC LIMIT 10"); echo '&lt;table width=\"100%\"&gt;'; while($row = mysql_fetch_array($result, MYSQL_NUM)) { echo '&lt;tr&gt;&lt;td width=\"100%\"&gt;&lt;b&gt;Author: &lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;'; echo '&lt;tr&gt;&lt;td width=\"100%\"&gt;&lt;b&gt;Date: &lt;/b&gt;'.$row[2].'&lt;/td&gt;&lt;/tr&gt;'; echo '&lt;tr&gt;&lt;td width=\"100%\"&gt;'.nl2br($row[4]).'&lt;/td&gt;&lt;/tr&gt;'; echo '&lt;tr&gt;&lt;td width=\"100%\"&gt;&lt;hr style="height: 2px; border: none; background: #515151;"&gt;&lt;/td&gt;&lt;/tr&gt;'; } echo '&lt;/table&gt;'; mysqlClose($c); ?&gt; </code></pre> <p>However, the message rows do not have the player name. Only his ID. His name is held in another database. So I somehow have to pull the ID, use it to find the corresponding name in another table and display the corresponding name.</p> <p>What function to use to do this?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload