akaballa123
Technical User
Hi I am requesting some variables from a form into a server side script using ajax. I applied some logic into the server side script. However, when I added the logic, my form db does not get updated. Anywyz...my problem seems to be within the serverside php code of things, I have been toiling very hard to figure out this problem but havent found it. However, I am positive that it might have something to do with the mysql_fetch_array().
Please help!
Please help!
Code:
<?php
//this page is used to updated the courses table with the current security id
include("mysqlConnection.php");
$secid = $_GET['secid'];
$name = $_POST['Name'];
//$otherOrg = $_GET['otherOrg']
$insert = "INSERT INTO courses
(securityId)
VALUES('$secid')";
$courses = @mysql_query('SELECT * FROM courses', $con);
//$organizations = @mysql_query('SELECT * FROM organizations', $con);
$counter = false;
while($rand = @mysql_fetch_array($courses))
{
if(($rand['securityId'] == $secid) || ($rand['courseName'] == $name))
{
$counter = true;
break;
}
}
if($counter != true)
{
mysql_query($insert, $con);
echo 'success';
echo $_GET['secid'];
}
include("mysqlConnClose.php")
?>