nevermind, sorry
it was a stupid comma in my sql query...
what i have is very sool tho, so if you would like the script its great!
i derived it, almost entirely from Dan LaFlamme's NOT working script at


----- Original Message -----
From: "olinux" <[EMAIL PROTECTED]>
Sent: Wednesday, March 28, 2001 2:06 PM
Subject: [PHP-DB] global vars

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";


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,

Do You Yahoo!?
Get your free address at

PHP Database Mailing List (
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to