title: Get the column name of random row PHP
body: <p>I have a table with 5 columns (id, s1, s2, s3, s4) and let's say, 3 rows:</p>
  
  <pre><code>First one -&gt; (1, 40, 30, 20, 15) 
  Second one -&gt; (2, 22, 32, 45, 18)
  Third one -&gt; (3, 89, 24, 65, 12)
  </code></pre>
  
  <p>So I get a random row from the 4 s columns from, for example, the first row id.</p>
  
  <pre><code>$query = "SELECT s1, s2, s3, s4 FROM table WHERE id = 1";
  $result = mysql_query($query);
  $row = mysql_fetch_assoc($result);
  echo $row[array_rand($row, 1)].'&lt;br&gt;';
  </code></pre>
  
  <p>With this, I get, from the id row number 1, a random between the 4 s columns (40, 30, 20 or 15), but what I really want to get is the name of that column, not the value of that field from the column (not the 40, 30, 20 or 15, but s1, s2, s3 or s4) so I can print that name later (so a image or another is loaded if s1, s2, s3 or s4 is chosen) and update the random field with 1 number less (if I got s1, 40 is 39, or if the random was s2, 30 is then 29, and etc, etc).</p>
  
  <p>I dont know if my logic is wrong or I should make a different approach with the tables. </p>
  
  <p>Thanks in advance!</p>