Insertion is a pain, any ideas?

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
DynPHP
Forum Newbie
Posts: 10
Joined: Tue Mar 04, 2003 8:25 am

Insertion is a pain, any ideas?

Post by DynPHP »

Working on storing information that is choosen via checkbox, tested with print_r() and information is parsing thru, but will not insert into table. Any ideas?

Code: Select all

if(isset($_POSTї"std_sw"]) ):  // check to see if any checkboxes selected 
$std_sw = $_POSTї"std_sw"];  // get the array of selected values 
$cnt = count($std_sw);  // count the number of selected items 


 //Insert into cpu_sw_linking table
for( $i = 0; $i < $cnt; $i++):
$cpu_sw_link_insert = "INSERT INTO cpu_software_link (cpu_id,sw_id) VALUES ("$_POST&#1111;cpu_id]","$std_sw&#1111;$i]")";
$cpu_sw_link_insert_result = mysql_query($cpu_sw_link_insert) or die ("Could not insert into cpu_sw_link");
endfor; 

endif;
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

try

Code: Select all

$cpu_sw_link_insert_result = mysql_query($cpu_sw_link_insert) or die ($cpu_sw_link_insert . ': '. mysql_error());
Post Reply