Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

edit data from the database through checkbox

Status
Not open for further replies.

misslois74

Programmer
Sep 27, 2008
63
0
0
PH
i have seen one thread from this forum which manipulates data using checkbox my question is im using serialize to store data and unserialize to display data now my problem is what if i want to edit the data that is stored on the database what will be my approach....
here is my sample code:

//to store to the database:
Code:
$quer = "Select * from tbl_job_categories
						 where job_id = $vid";
				$result = mysql_query($quer) or die(mysql_error());
				$row = mysql_fetch_array($result);

				//$appid				= $_POST['app_id'];
				
				$idjob				= $_POST['id_job'];  //job posting
				
				$page				= $_POST['page'];
				
				$id				    = $_POST['jid'];    //for category of job
				
				$stats				= serialize($_POST['status']);
				
				//$news_title 		= addslashes($_POST['news_title']);

				//$applicants_name 	= $_POST['applicants_name'];

				$encoded_by 		= $_SESSION['usernameSESSION'];

				$date_encoded		= date('Y-m-d');

				$time_encoded		= date('G:i:s');

				$ip 				= $_SERVER['REMOTE_ADDR'];				

				if (is_array($_POST['status']))
				{
					    $sqlQuery = "INSERT INTO tbl_employers_shortlist (job_category_id, job_id, status, encoded_by, date_encoded, time_encoded, ip)
							    	VALUES ($id, $idjob, '$stats', '$encoded_by', '$date_encoded', '$time_encoded', '$ip')";

						if ($sqlQuery)
						{
							$result = mysql_query($sqlQuery);
						}
				}

//to view the data
Code:
while ($rows = mysql_fetch_array($result))
						{	
								
										$stats					= unserialize($rows['status']);
										$id						= $rows[job_id];
										foreach($stats as $s)
										{
												$ids = $s;
												if($ids == $rows[id])
												{
													echo "<span class='textmenu2'>$rows[name]</span><br /><br>";
																									}
																						}
		
										//echo "<a href='employers_shortlisted_hotelstaffs_cms.php?p=employers_shortlisted_hotelstaffs_ed&newsID=$newsID'>edit</a> &nbsp; | &nbsp; <a href='confdel.php?cur_page=$cur_page&newsID=$newsID'>delete</a>";
										
										echo "<a href='employers_shortlisted_cms.php?p=". $row[action3] . "&id=$id'>edit</a> &nbsp; | &nbsp; <a href='confdel.php?cur_page=$cur_page&id=$id&jobid=$row[job_id]'>delete</a>";
				
										echo "<br /><img src='images/break.gif'><br /><br />";
												
						}
				}

now if i want to edit the content of the field lets say uncheck the item selected how will i go about it
thanks in advance....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top