Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code>select b.user_id, b.user_name, b.something, b.something2, a.user_id as a_user_id, a.user_name as a_user_name, a.something as a_something, a.something2 as a_something2 from b left join a on a.user_id = b.user_id </code></pre> <p>then your script can check all the fields you want to compare and optionally print the 2 values side by side.</p> <p>you can print each record returned, and under the mismatches, print a second row containing the original values for easy comparison:</p> <pre><code>&lt;style type="text/css"&gt; tr.good td {background: #fff; color: #333;} tr.bad td {background: #aaa; color: #fff;} tr.compare td {background: #000; color: #fff;} td.match {} td.mismatch {background: #ff0000; color: #fff;} &lt;/style&gt; &lt;table&gt; &lt;tr&gt;&lt;th&gt;user id&lt;/th&gt;&lt;th&gt;name&lt;/th&gt;&lt;th&gt;something&lt;/th&gt;&lt;th&gt;something2&lt;/th&gt;&lt;/tr&gt; &lt;?php function tdClass($k, $matches) { return isset($matches[$k]) &amp;&amp; !$matches[$k] ? 'mismatch' : 'match'; } foreach ($rows as $r) { $good = true; $matches = array(); foreach ($r as $k =&gt; $v) { $matches[$k] = isset($r["a_$k"]) &amp;&amp; $r["a_$k"] === $v; if (!$matches[$k]) $good = false; } $url = "user/$row[user_id]"; ?&gt; &lt;tr class="&lt;?php echo $good ? 'good' : 'bad' ?&gt;"&gt; &lt;td&gt;&lt;?php echo $row['user_id'] ?&gt;&lt;/td&gt; &lt;td class="&lt;?php echo tdClass('user_name', $matches) ?&gt;"&gt; &lt;a href="$url"&gt;&lt;?php echo htmlentities($row['user_name']) ?&gt;&lt;/a&gt;&lt;/td&gt; &lt;td class="&lt;?php echo tdClass('something', $matches) ?&gt;"&gt; &lt;?php echo htmlentities($row['something']) ?&gt;&lt;/td&gt; &lt;td class="&lt;?php echo tdClass('something2', $matches) ?&gt;"&gt; &lt;?php echo htmlentities($row['something2']) ?&gt;&lt;/td&gt; &lt;/tr&gt; &lt;?php if (!$good) { ?&gt; &lt;tr class="compare"&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;&lt;a href="$url"&gt;&lt;?php echo htmlentities($row['a_user_name']) ?&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo htmlentities($row['a_something']) ?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo htmlentities($row['a_something2']) ?&gt;&lt;/td&gt; &lt;/tr&gt; &lt;?php } ?&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre>
    singulars
    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.
    1. VO
      singulars
      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