brandon0layton89
New Member
- Messages
- 5
- Reaction score
- 0
- Points
- 0
For some reason nothing happens when I click the button. Nothing echos, all that happens is the page refreshes...
This is my php code:
Hopefully its a stupid mistake that I made and someone can explain what is wrong.
Thanks,
Brandon
This is my php code:
Code:
class functions {
public static function chooseGiftee($SS){
echo "chooseGiftee function started...";
$gifteeResults;
$sqllink= mysql_connect($host,$user,$pass);
if(!$sqllink){
echo "Could not connect! Please Try Again";
return mysql_error();
} else {
echo "Connected!";
echo "Selecting Table... ";
if(mysql_select_db("bplayton_ss")){
echo "Selected the Table!";
echo "Fetching row...";
$selectGiftee = "SELECT * FROM ss WHERE Gifter = '' ORDER BY RAND() LIMIT 10";
if($results = mysql_query($selectGiftee)){
echo "Fetched " .$results. " as the row!";
$gifteeResults = $results['Name'];
$addSS = "UPDATE ss SET Gifter = '$SS' WHERE Name = '$gifteeResults'";
echo "Updating Gifter...";
if(mysql_query($addSS)){
echo "Updated Gifter!";
return $gifteeResults;
} else {
echo "Couldn't update Gifter! please try again.";
return "ERROR! TRY AGAIN";
}
} else {
echo "error:";
echo mysql_error();
return "ERROR! TRY AGAIN!";
}
} else {
echo "ERROR: " .mysql_error();
return "ERROR! TRY AGAIN!";
}
mysql_close($sqllink);
}
}
}
if($_SERVER['REQUEST_METHOD'] == "POST"){
$echoName = functions::chooseGiftee($_POST['gifterName']);
echo "Get a gift for: " .$echoName. " and don't tell them ;)";
}
Hopefully its a stupid mistake that I made and someone can explain what is wrong.
Thanks,
Brandon