Hello All,
I am trying to add to a forum mod invision one
here my problem I have a referal system which works fine I am trying to write some code to show all users who have more than 0 referals which again I have managed np's what I want to do though is add a reset button that when clicked sets all referals from everyone to 0
heres my code it doesn't seem to update the db.
<?php
// Reqwst form reset and do sql
if ($reset)
{
$connection = mysql_connect ("localhost","skip", "tennisballs") or die ("Cannot make the connection");
$db = mysql_select_db ("forum",$connection) or die ("Cannot connect to database");
$SQL = "UPDATE skipmembers set referal = 0 where referal > 0";
mysql_query($SQL);
}
//connect to server with username and password
$connection = mysql_connect ("localhost","skip", "tennisballs") or die ("Cannot make the connection");
//connect to database
$db = mysql_select_db ("forum",$connection) or die ("Cannot connect to database");
//our SQL query
$sql_query = "SELECT name, referal FROM skipmembers WHERE referal > 0 Order by referal DESC";
//store the SQL query in the result variable
$result = mysql_query($sql_query);
if(mysql_num_rows($result))
{
echo ("<form name=update method=post action=ad_page.php><table width=100% cellpadding=0 cellspacing=6 border=0><tr><td bgcolor=#A0BEEF align=center><font face=verdana size=2 color=000000><b>Member Name</b></font></td><td bgcolor=#A0BEEF align=center><font face=verdana size=2 color=000000><b>Number of Referals</b></font><td bgcolor=#A0BEEF align=center><input type=submit name=reset value=reset></td></tr>");
//output as long as there are still available fields
while($row = mysql_fetch_row($result))
{
echo ("<tr><td bgcolor=#EEEEEE align=center><font face=verdana size=2 color=000000>$row[0]</font>");
echo (" <td bgcolor=#EEEEEE align=center><font face=verdana size=2 color=000000>$row[1] <font></td><td bgcolor=#EEEEEE></td></tr>");
}
echo ("</table><form>");
}
//if no fields exist
else
{
echo "no values in the database";
}
?>