By edhrx on
hi,
function signup_costs_total($nid, $uid){
$sql = 'SELECT sv.value, sv.choices, sf.title, sf.is_costed, sf.amount, sf.type
FROM {signup_fields} as sf INNER JOIN {signup_values} as sv
ON (sf.fid = sv.fid) WHERE sv.nid = %d AND sv.uid = %d';
$r = db_query($sql, $nid, $uid);
....more code etc
I have been staring at the above for about an hour.. so here is the problem
It does not return a row. The record is there because I have used the same sql in a mysql client. the variables $nid and $uid have the correct values to bring back a row
Am I missing something obvious ?
Comments
Your syntax looks perfect -
Your syntax looks perfect - are you sure the $uid and $nid are correct, could they have been swapped around by mistake i.e. are you calling signup_costs_total($uid, $nid) instead of ...($nid, $uid) ?
sql syntax problem
@bladerider
I kid you not, and I have no explanation as to the logic of this I renamed the table signup_values to
signup_costs and with not other changes in code it worked.
I dont have time to unpick what went on but many thanks for your response