Welcome Guest, Not a member yet? Register   Sign In
SQL errors
#1

[eluser]theknight[/eluser]
Here is my code:

$child = $this->getDetails($row['ParentOf_Id']);

which is in another function that calls a function called getdetails:

function getDetails($child_id=null,$limit=20){

// select all the fields in the children table
$this->db->select(castedColumns($this->children_table, $this->db));
//where the id is the child id
$q = $this->db->get_where($this->children_table, 'id='.$child_id);
//store results array in details
$details = $q->row_array();
I then get the following SQL error:

A Database Error Occurred Error Number:

Incorrect syntax near '='.

SELECT CAST(AdditionalNotes AS TEXT) as AdditionalNotes, CAST(DisabilitiesNotes AS TEXT) as DisabilitiesNotes, DOB, msrepl_tran_version FROM Children WHERE id=

Id does not get appended? why?

Been driving me nuts because, when I do echo $child_id; I get the child Id before passing it into the SQL.
#2

[eluser]douweegbertje[/eluser]
try this?

Code:
function getDetails($child_id=null,$limit=20){

  // select all the fields in the children table
  $this->db->select(castedColumns($this->children_table, $this->db));
  //where the id is the child id
  $q = $this->db->get_where($this->children_table, 'id=' . $child_id . ');
  //store results array in details
  $details = $q->row_array();
#3

[eluser]InsiteFX[/eluser]
26 posts and you still do not know how to use the code tags!




Theme © iAndrew 2016 - Forum software by © MyBB