Hi
I have this code snippet that is supposed to return the file names of uploaded timesheets for a specific user:
$my_sql = "select signedtimesheet from tbltimesheets where user = '{login}'";
sc_lookup(my_data, $my_sql);
if ({my_data} === false) {
echo "<script type='text/javascript'>alert('Access error. Message=" . {my_data_erro} . " - " .
"Delete cancelled.');</script>";
} elseif (!isset({my_data[0][0]})) {
echo "<script type='text/javascript'>alert('No Files!');</script>";
}
When run, the “elseif” fires saying “No files”. But this should not be happening! When I run the same SELECT directly against the database (whether via phpMyadmin, or SC’s own database builder tool) I get the results I expect to get. For example, using the following (I have substituted {login} with a real user name. ‘adam’):
select signedtimesheet from tbltimesheets where user = 'adam'
I get (see image below):
So - the data is definitely in the database, and the query to extract it is correct - yet when using sc_lookup (or sc_select - I have tried both) I get told there is no data. For some reason the my_data variable is not being initialized?
Anyone have any ideas please?
Thanks
Adz