I am working with global variables and functions, specifically calling a function
inside another function.
I checked the online docs and don't see any problems with what i have... i declare the
table_name as global inall functions
What I am trying to do is DELETE all entries for a uid before INSERTING the new skills
my insert_skills() calls the function to DELETE entries and then the function that
creates the INSERT query
the lookup_skills table columns looks like this.
| id | uid | skills_id |
here are a couple excerpts from my code:
table_name = "lookup_skills";
...
function insert_skills($uid, $skills) {
global $table_name;
purge_lookup($table_name, "1");
$query = create_checkbox_query($skills, $table_name, "1");
...
function purge_lookup($table, $uid) {
global $table_name;
$q = "DELETE FROM $table, WHERE uid = $uid";
mysql_query($q);
}
...
function create_checkbox_query($arr, $table, $uid) {
global $table_name;
$q = "INSERT INTO $table (uid, skill_id) VALUES";
foreach ($arr as $check) {
$q .= " ( $uid , $check )" . ",";
}
return substr($q, 0, -1);
}
insert_skills("1", $skills);
thanks much,
olinux