close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Dreamweaver (Update Database Problem)

Thread began 4/04/2014 10:08 pm by Joanne | Last modified 4/07/2014 8:09 am by Joanne | 602 views | 1 replies

Joanne

Dreamweaver (Update Database Problem)

Hi Jason,
I have another problem that I need to resolve… the problem related to updating database information.
I am trying to create a simple system to fill up an online event proposal for student. One student may fill more than one proposal. Each student has it own unique matrix number which I define them as my primary key. However, my current problem is whenever I try to update the data with the same matrix number and with different event the entire row with same matrix number affected. How can I restrict it so that only the event that I want to update is updated without the other event with same matrix number affected? I realized that my current method is a bad practice but I really don’t know how to do it already…. Please help me…. Or guide me please because I kindda lost here…
Thank you.

PHP
=======

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE exclusive_summary SET event=%s, category=%s, club=%s, aim=%s, theme=%s, introduction=%s, `date`=%s, `time`=%s, venue=%s, officer=%s, participant=%s, conclusion=%s WHERE matrix=%s",
GetSQLValueString($_POST['event'], "text"),
GetSQLValueString($_POST['category'], "text"),
GetSQLValueString($_POST['club'], "text"),
GetSQLValueString($_POST['aim'], "text"),
GetSQLValueString($_POST['theme'], "text"),
GetSQLValueString($_POST['introduction'], "text"),
GetSQLValueString($_POST['date'], "date"),
GetSQLValueString($_POST['time'], "date"),
GetSQLValueString($_POST['venue'], "text"),
GetSQLValueString($_POST['officer'], "text"),
GetSQLValueString($_POST['participant'], "text"),
GetSQLValueString($_POST['conclusion'], "text"),
GetSQLValueString($_POST['matrix'], "text"));

mysql_select_db($database_localhost, $localhost);
$Result1 = mysql_query($updateSQL, $localhost) or die(mysql_error());



<tr valign="baseline">
<td nowrap="nowrap" align="right">Matrix:</td>
<td><?php echo $row_E_summary['matrix']; ?></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Event:</td>
<td><input type="text" name="event" value="<?php echo htmlentities($row_E_summary['event'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Category:</td>
<td><select name="category">
<?php
do {
?>
<option value="<?php echo $row_category['code']?>" <?php if (!(strcmp($row_category['code'], htmlentities($row_E_summary['category'], ENT_COMPAT, 'utf-8')))) {echo "SELECTED";} ?>><?php echo $row_category['Category']?></option>
<?php
} while ($row_category = mysql_fetch_assoc($category));
?>
</select></td>
</tr>
<tr> </tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Club:</td>
<td><select name="club">
<?php
do {
?>
<option value="<?php echo $row_club['C_Club']?>" <?php if (!(strcmp($row_club['C_Club'], htmlentities($row_E_summary['club'], ENT_COMPAT, 'utf-8')))) {echo "SELECTED";} ?>><?php echo $row_club['club']?></option>
<?php
} while ($row_club = mysql_fetch_assoc($club));
?>

<tr valign="baseline">
<td nowrap="nowrap" align="right" valign="top">Conclusion:</td>
<td><textarea name="conclusion" cols="50" rows="5"><?php echo htmlentities($row_E_summary['conclusion'], ENT_COMPAT, 'utf-8'); ?></textarea></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">&nbsp;</td>
<td><input type="submit" value="Update record" /></td>
</tr>
</table>
<input type="hidden" name="MM_update" value="form1" />
<input type="hidden" name="matrix" value="<?php echo $row_E_summary['matrix']; ?>" />
</form>

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...