Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP To Vote No More Then Once, How Do I Code This Within My Code?
    text
    copied!<p>i have the following php code which selects all the elections which are currently recorded in my mysql database:</p> <pre><code> &lt;?php $result = mysql_query("SELECT * FROM elections WHERE status = 'in_progress'") or die(mysql_error()); if (mysql_num_rows($result) == 0) { echo '&lt;h5&gt;This Election Does Not Exist Anymore&lt;/h5&gt;&lt;hr&gt; '; } else { while($info = mysql_fetch_array($result)) { echo "&lt;tr&gt;"; echo "&lt;td&gt;" . $info['name_of_election']. "&lt;/td&gt;"; echo "&lt;br/&gt;&lt;br/&gt;&lt;td&gt;" . $info['date']. ' '. $info['month']. ' ' . $info['year']. "&lt;/td&gt;"; echo "&lt;br/&gt;&lt;br/&gt;&lt;td&gt;" . '&lt;a href="vote.php?election=' . $info['election_id'] . '"&gt;Vote Now&lt;/a&gt;' . "&lt;/td&gt;"; echo '&lt;hr&gt;'; } } ?&gt; </code></pre> <p>as you may notice, there is a link at the bottom which says 'vote now'. this allows the user to go and vote. how can i possibly alter this code to show/hide this link depending on whether or not the user has casted a vote.</p> <p>my database tables look like this:</p> <p>elections: election_id, name_of_election, date, party1, party2, party3, status.</p> <p>public: firstname, surname, address, postcode, ni, ref, active.</p> <p>votes: vote_id, election_id, ni, party</p> <p>the users logon with their ni and ref number which are all unique. i have a session which registers the users ni number. the casted votes go into the votes table. </p> <p>i hope this post is much clearer then my other post. </p> <p>thanks in advance for any help.</p>
 

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