Need help with what I am attempting to do.
I am attempting to do a simple if statement in PHP relating to Mysql, however it's not working properly.
here's what I am basically doing:
using this select command to count the number of rows affected. if there is 1 or more (not null), it should run the update, if there is none, then it should run the insert. simple and basic I'm just losing my mind. and am stuck in VBSCRIPT LAND, I am missing what I am doing wrong here.
$ctr = "SELECT * FROM `selections` WHERE `name` = '" . $gnme . "' AND `week` LIKE '" . $week . "'"
$ctr2 = mysql_query($ctr) or die(mysql_error())
if ($ctr2) {
/* This section is to be used if for the selected week there is no entry for the name provided */
$query = "INSERT INTO selections VALUES ('$gnme','$gme1','$gme2','$gme3','$gme4','$gme5','$gme6','$gme7','$gme8','$gme9','$gme10','$gme11','$gme12','$gme13','$gme14','$gme15','$gme16','$gme17','$gme18','$gme19','$week','$gscor')"
mysql_query($query)
echo "Your Picks have been posted."
}
else // If there is a - I will complete the Update command, just annoyed with other part.
{
update query here....
}
would appreciate the help getting frustrated, also to pay immediately I can only do 2, but by the end of the weekend I will provide the remainder.
need by morning if at all possible.