Problem with multiple checkboxes through multiple tables

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!

Moderator: General Moderators

Post Reply
User avatar
Shinmeiryu
Forum Commoner
Posts: 29
Joined: Wed Nov 13, 2002 2:57 am

Problem with multiple checkboxes through multiple tables

Post by Shinmeiryu »

What's wrong with my code? I'm trying to multiple select through multiple tables to post a date and activate publishing, but I keep getting bad arguments for every line on implode and an error making the query.

The mysql error gives me 'Table 'browngai_cms.titles' doesn't exist', however, it does exist.

The form method is post, and I just checked by reverifying each variable using $_POST, but the same issues keep occuring.

It only doesn't do those bad arguments implode error when I at least check one thing from each section (table selected in the form), otherwise it gives me error for any section's records completely unchecked.

Code: Select all

<?php
if ($command == "publishcontent"){
		    $titleID = "" . implode(", ", $titleID); 
			$newsID = "" . implode(", ", $newsID);
			$reviewID = "" . implode(", ", $reviewID);
			$articleID = "" . implode(", ", $articleID);
			$screenshotID = "" . implode(", ", $screenshotID); 
			
			$titledate = date("Y-m-d H:i:s");
			$newsdate = date("Y-m-d H:i:s");
			$reviewdate = date("Y-m-d H:i:s");
			$articledate = date("Y-m-d H:i:s");
			$screenshotsdate = date("Y-m-d H:i:s");
			
			$query = "UPDATE titles SET titledate='$titledate',activate='1' WHERE ID IN ($titleID)";
			$result = mysql_query($query) or die(mysql_error());
			$query = "UPDATE news SET newsdate='$newsdate',activate='1' WHERE ID IN ($newsID)";
			$result = mysql_query($query) or die(mysql_error());	
			$query = "UPDATE reviews SET reviewdate='$reviewdate',activate='1' WHERE ID IN ($reviewID)";
			$result = mysql_query($query) or die(mysql_error());
			$query = "UPDATE articles SET articledate='$articledate',activate='1' WHERE ID IN ($articleID)";
			$result = mysql_query($query) or die(mysql_error());
			$query = "UPDATE screenshots SET screenshotsdate='$screenshotsdate',activate='1' WHERE ID IN ($screenshotID)";
			$result = mysql_query($query) or die(mysql_error());
			echo 'All selected content has been published.<br>';
		  }
?>
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

Post by kendall »

Shinmeiryu,

im not too clear on your implode issue but from what i see concerning MySQL....

im seein in your query statements you have
"UPDATE titles SET titledate='$titledate',activate='1' WHERE ID IN ($titleID)";
it is perculiar you use "WHERE ID IN" maybe this is why you get the table doesnt exist..sometimes i get that when i am unable to properly execute certain mysql functions try using "WHERE ID = '$titleID';

hopes that sheds some lite....

Kendall
Post Reply