I tested and successfully used this SQL code below to input data into a database.
INSERT INTO hraps (id, firstname, lastname, gender, year_of_1st_rappel, count_offset_proficiency, count_offset_operational, spotter) values(111111, 'World', 'Hello', 'Male', '2007', '1', '2', '0')
Now I'm trying to integrate it into PHP like this:
$query = "INSERT INTO hraps (firstname, lastname, gender, year_of_1st_rappel, count_offset_proficiency, count_offset_operational, spotter) "
."values('".$this->firstname."','".$this->lastname."','".$this->gender."','".$this->year_of_1st_rappel."',".$this->count_offset_proficiency.",".$this->count_offset_operational.",".$this->spotter.") returning id into :id";
$dbid = "";
$binds = array();
$binds[] = array("name" => ":id", "value" => &$dbid, "length" => 128);
//echo $query;
$result = mydb::cxn()->query($query, $binds);
$this->id = $dbid;
But nothing gets inserted and I'm not getting any error. The only difference is that in this one I'm defining id as $dbid, and before I hard-coded it in the "values" section of the query.
Can somebody please point out why this code is not working successfully?
Thank you.