Insert Into problem

wxdqz

New Member
I've got this piece of code....


function connect(){
global $link, $id;
$link = mysql_connect("localhost", "username", "password") or die ("Could not connect");
mysql_select_db ("dbtoselect") or die ("Could not select database");
}
function check_session(){
global $id, $link, $results;
connect();
$sql = "SELECT * FROM sessions WHERE sesid = '$id'";
$results = mysql_query($sql) or die ("Query failed");
$affected = mysql_num_rows($results);
if ($affected == 0){
insert();
} elseif ($affected == 1) {
load_data();
} else {
cleanup();
insert();
}
mysql_free_result ($result);
close();
}

///problem is here///
function insert(){
global $id;
$sql = "INSERT INTO sessions(sesid, productids, quantity) VALUES ('$id','','')";
mysql_query($sql);
}

assuming the insert function is called I get a parse error on the insert into line... I can't figure why.

Mark
 
Back
Top