I wonder how do we use this in an MVC framework, CakePHP in particular.
$query = oci_parse($c, "SELECT * FROM JOB ORDER BY job_title");
oci_execute($query);
while($row = oci_fetch_assoc($query)){
$showRowJ .= "<tr>
";
$showRowJ .= "<td><a href = 'job_delete.php?jobid=".$row['JOB_ID']."'> Delete </a></td>
";
$showRowJ .= "<td><a href = 'job_update.php?jobid=".$row['JOB_ID']."'> ".$row['JOB_ID']." </a></td>
";
$showRowJ .= "<td>".$row['JOB_TITLE']."</td>
";
$showRowJ .= "<td>".$row['REQUEST_DATE']."</td>
";
$showRowJ .= "<td>".$row['START_DATE']."</td>
";
$showRowJ .= "<td>".$row['NUMBER_OF_DAYS']."</td>
";
$showRowJ .= "<td>".$row['STATUS']."</td>
";
$showRowJ .= "<td>".$row['CLIENT_ID']."</td>
";
$showRowJ .= "</tr>
";
}
and if for MySQL: (example)
$result = mysql_query('SELECT * WHERE 1=1');
if (!$result) {
die('Invalid query: ' . mysql_error());
}
I'm confused some say it should be in a model and some are using find('all')
UPDATE:
Hey sorry I meant when we want to query joint tables. The above is just an example when we need to include WHERE 2-3 times for joining tables.
Let's say I want to query:
SELECT users.name, foods.name FROM users, foods WHERE users.id='1' AND users.id=foods.id
Something like above.. How should we do it in CakePHP ?
Thanks.