need help in update query


Posted on 16th Feb 2014 07:03 pm by admin

i create a form for update. there are 8 columns in my mysql table. on my main page all the data is retrieve from db and displayed on the page. after every row there is a link edit. when user click that link it goes to a form where all the required fields are displayed. the user may only change one column or two. so my question is how we will know in website which column is to be updated. ofcourse we know the column with modified value will have to be change in db but how we can implement this in php.

my code is my form which is a long one
Code: [Select]<form name="form1" method="post" action="jobsReview.php">
<p align="left">Fill the Following Form</p>
<table width="702" height="486" border="0">
<tr>
<td width="315" height="24"><div align="left">Job Title:</div></td>
<td width="377"><select name="title" id="title">
<option value="Computer Lecturer">Computer Lecturer</option>
<option value="Management Lecturer">Management Lecturer</option>
<option value="English Lecturer">English Lecturer</option>
<option value="Islamyat Lecturer">Islamyat Lecturer</option>
<option value="Electronics Lecturer">Electronics Lecturer</option>
<option value="Economics Lecturer">Economics Lecturer</option>
<option value="Mathematics Lecturer">Mathematics Lecturer</option>
</select></td>
</tr>
<tr>
<td height="26"><div align="left">University:</div></td>
<td><label>
<input type="text" name="university" id="university">
</label></td>
</tr>
<tr>
<td height="24"><div align="left">Minimum Education Required:</div></td>
<td><label>
<input type="text" name="education" id="education">
</label></td>
</tr>
<tr>
<td height="24"><div align="left">Experience Required:</div></td>
<td><label>
<input type="text" name="req_experience" id="req_experience">


</label></td>
</tr>
<tr>
<td height="21">Post On:</td>
<td><select name="day" id="day">
<?php while( $row = mysql_fetch_array($resultday) ) { ?>
<option value="<?php echo $row['id']; ?>"><?php echo $row['day']; ?></option>
<?php } ?>
</select>
-
<select name="month" id="month">
<?php while( $row = mysql_fetch_array($resultmonth) ) { ?>
<option value="<?php echo $row['id']; ?>"><?php echo $row['month']; ?></option>
<?php } ?>
</select>
-
<select name="year" id="year">
<?php while( $row = mysql_fetch_array($resultyear) ) { ?>
<option value="<?php echo $row['id']; ?>"><?php echo $row['year']; ?></option>
<?php } ?>
</select></td>
</tr>
<tr>
<td height="21">Apply By:</td>
<td><select name="days" id="days">
<?php while( $row = mysql_fetch_array($resultdays) ) { ?>
<option value="<?php echo $row['id']; ?>"><?php echo $row['day']; ?></option>
<?php } ?>
</select>
-
<select name="months" id="months">
<?php while( $row = mysql_fetch_array($resultmonths) ) { ?>
<option value="<?php echo $row['id']; ?>"><?php echo $row['month']; ?></option>
<?php } ?>
</select>
-
<select name="years" id="years">
<?php while( $row = mysql_fetch_array($resultyears) ) { ?>
<option value="<?php echo $row['id']; ?>"><?php echo $row['year']; ?></option>
<?php } ?>
</select></td>
</tr>
<tr>
<td height="325" valign="top"><div align="left">Job Description:</div></td>
<td valign="top"><label>
<textarea name="description" id="description" cols="60" rows="20"></textarea>
</label></td>
</tr>
<tr>
<td height="26">&nbsp;</td>
<td><input type="submit" name="submit" id="button" value="Edit Job"></td>
</tr>
</table>
<p>&nbsp;</p>
</form>
and here is my php
Code: [Select]<?php
if(isset($_POST['submit']))
{
$id = $_GET["id"];
$db = mysql_connect("localhost");
mysql_select_db("jobolicious", $db);
$quizquery = "UPDATE jobs_uni SET column='{$data}' WHERE id='{$id}'" or die(mysql_error());
//echo $query;
$result = mysql_query($query) or die(mysql_error());
}
?>

No comments posted yet

Your Answer:

Login to answer
259 Like 31 Dislike
Previous forums Next forums
Other forums

displaying unknown amount of results
I am reading a directory and getting a list of folders in the directory, I want to display the folde

Storing the referrer in session... problems with tabs
Hello All

I am currently working on an ERP project based on the MVC methodology, when a user

Add weeks in a query?
I have a SQL that summarizes the quantity per week. The weeks that has no value does not exist in th

displaying email without attracting a ton of spam
Hello,

this is maybe the wrong place to ask.
How would you display an email address on a w

eregi to preg
Im converting my regex for php 5.3 and I am stuck on the following

Code: [Select]if((eregi(&q

Help With editting and deleting form
Hallo !!

So look at this image :

http://img194.imageshack.us/img194/8272/snapshot5f.pn

Setting a default timezone?
I have read about how to change the timezone in PHPMYADMIN, but it changes back, it doesn't STAY the

Curly Bracket Delimeters.
I'd always believed that the starting and ending delimeters in preg_ functions had to be the same ch

Greek characters in php
Hi,

I'm making a script and I m using for first time greek characters.
I started to write

help need on ob_start()
Hi

I am a newbie in php, I have a code
Line number On/Off | Expand/Contract <?phpo

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash