PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Burrito wrote:the uid looks to be alphanumeric, you'll need to quote that in your sql statement. If you put some error checking in your mysql_query() as has been suggested, you'd see this.
what is that supposed to mean? it's still passing the same information the same way... my debug output shows that $c is printing the values of the uID's that i want to be deleted. it's printed the same exact way in the sql query. so i don't understand what you mean? can you explain?
if($_POST['delete'] != NULL){
foreach($_POST['delete'] as $k => $c){
echo $k ." / ". $c ." || "; //<-- prints the EXACT correct information for the sql query to be properly executed.
$sql = "DELETE * FROM my_search_table WHERE uID = ". $c ."";
mysql_query($sql) OR die ("The query:<br>" . $sql . "<br>Caused the following error:<br>" . mysql_error());
}
}
0 / 7djtV0nIPaui9Wt7WkIUBts2M3b3bh || The query:
DELETE * FROM my_search_table WHERE uID = 7djtV0nIPaui9Wt7WkIUBts2M3b3bh
Caused the following error:
You have an error in your SQL syntax near '* FROM my_search_table WHERE uID = 7djtV0nIPaui9Wt7WkIUBts2M3b3bh' at line 1
even if i click more than one checkbox, it only prints an error for the FIRST of the many to be checked (in order from top to bottom). which makes sense. but what does the error mean?
Last edited by boo_lolly on Mon Nov 27, 2006 10:30 am, edited 1 time in total.
$_POST['delete'];
if($_POST['delete'] != NULL){
foreach($_POST['delete'] as $k => $c){
//echo $k ." / ". $c ." || "; //<-- prints the EXACT correct information for the sql query to be properly executed.
$sql = "DELETE FROM my_search_table WHERE uID = '". $c ."'";
mysql_query($sql) OR die ("The query:<br>" . $sql . "<br>Caused the following error:<br>" . mysql_error());
}
}