i'm having a similar problem, which is cuased by doing this for the first time in PHP.
like was mentinoed before, i would like tohave a list (generated from the database) of items that have a checkbox next to them and a remove button at the end.
the list i can generate, no problem. i'm assiging a name linkId to all checkboxes and the $linkId (taken from the database) as the value. now, here's the part i'm not sure about regarding PHP: when i submit this it creates an array called linkId with the values of $linkId in it - right? assuming that's right (it was when i worked in JSP...), how do i run the delete sql statement on all of them? i tried building a function that reads like this:
function deleteLinks() {
$second_sql = "DELETE FROM links where linkId =\"$linkId\" and userId=\"$userid\"";
$second_sql_result = mysql_query($second_sql,$connection) or die ("Couldn't excute second query");
}
and then putting :
array_walk($linkId,deleteLinks());
i get the error:"
Fatal error: Only variables can be passed by reference in /home/bhmn/public_html/update_tools/remove_link_list.php on line 17" which is the array_walk line.
i have no doubt in my mind i'm doing this wrong, as ryan said build a function, put the sql statement in it and then run array_walk. i'm sure i'm missing something.
any guesses?