Hi,
I have searched the net quite a lot and all I can find is people quering field on different tables or different databases.
I have a java bot that sends information to a php action script in the form: http://domain.com/?choice=thecoice&name=yourname&code=1234
I have a database and a table called cornetto. my fields are 'choice, name, mobile, code, valid, winner'
this is my code:
<?php
$con = mysql_connect("localhost","user","pass");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("dbase", $con);
$name=mysql_real_escape_string($_GET['name']);
$mobile=mysql_real_escape_string($_GET['mobile']);
$choice=mysql_real_escape_string($GET['choice']);
$code=mysql_real_escape_string($GET['code']);
$sql="INSERT INTO cornetto (name,mobile,choice,code) VALUES ('$name','$mobile','$choice','$code')";
if (!mysql_query($sql,$con)) {
die('Error: ' . mysql_error());
}
// my query should go here to see if the two validate the 'code' field against the 'valid' field
mysql_close($con);
?>
This is like a competition for a npo company and I said I'll help them. The user puts in his/her details and I record the values just fine. In my valid column I have all the valid codes. I want the user to validate their entry with these codes and if the codes match then put it in the 'winner' column
Just not getting this right...Please if anyone can help I would much appreciate it.
Thank you