ok I'm writing a function that can send back generic SQL statments. Here what I've got so far. The problem is I want it to NOT add a comma and a space when it reachs the final value in the array I send it:
<?php
function get_data($table, $fields, $clause, $clause_value) {
foreach($fields as $value) {
$sql.= $value;
if($value isn't the last member of the $fields array){
$sql.=", ";
}
}
$sql. = "select ".$sql."from $table where $clause = $clause_value";
}