PHP - Update
some how i cant update i dont know y
Code: [Select] <div id="ahome"> <?php include "scripts/connect.php"; if(isset($_GET[edit])){ $newid = $_GET['edit']; $query = mysql_query("SELECT * FROM news WHERE id='$newid' LIMIT 1"); $rows = mysql_fetch_array($query); $newstitle = stripslashes($rows['title']); $newsby = stripslashes($rows['by']); $newsbody = stripslashes($rows['body']); } ?> <?php if ($_POST['saveedit']){ $newid = mysql_real_escape_string($_POST['saveedit']); $newstitle = mysql_real_escape_string($_POST['title']); $newsby = mysql_real_escape_string($_POST['by']); $newsbody = mysql_real_escape_string($_POST['body']); if ($newstitle && $newsby && $newsbody){ $query = mysql_query("UPDATE news SET title='$newstitle', by='$newsby', body='$newsbody' WHERE id='$newid'"); echo "UPDATE SUCCESFULLY!"; }else $msg = "<font color=red>YOU DID NOT FILL ALL OF THEM IN!</font>"; } ?> <form action='enews.php' method='POST'> <table> <tr> <td></td> <td><?php echo $msg; ?></td> </tr> <tr> <td>Article Title</td> <td><input type='text' name='title' size='45' value='<?php echo $newstitle; ?>'/></td> </tr> <tr> <td>By:</td> <td><input type='text' name='by' size='30' value='<?php echo $newsby; ?>' /></td> </tr> <tr> <td>Article Body</td> <td><textarea cols='45' rows='25' name='body'><?php echo stripslashes($newsbody); ?></textarea></td> </tr> <tr> <td><input type='hidden' name='saveedit' value='$newid'/></td> <td><input type='submit' name='updatebtn' value='Update' /></td> </tr> </table> </form> </div> Similar TutorialsHi i have this simple update form and scrip but somehow it doesnt seem to be update the field on the database can someone help out please. The html form is the second form bellow where the action send to status_update.php HTML FORM Code: [Select] <?php include("../header.html"); ?> <?php include("header_news.html"); extract($_REQUEST,EXTR_SKIP); ?><?php /* print("sfilm_refnum = $sfilm_refnum<BR>"); print("sfilm_addr01 = $sfilm_addr01<BR>"); print("sfilm_postcode = $sfilm_postcode<BR>"); print("Film Client = $fclient<BR>"); */ ?> <form id="search" action="list.php" method="post" name="search"> <table width="780" border="0" cellspacing="0" cellpadding="4" bgcolor="#eeeeee"> <tr> <td align="right" width="140"></td> <td width="320"><span class="hofblack10"> </span> </td> <td align="center" width="100"><input type="hidden" name="lstart" value="<?php print("$lstart"); ?>" /><input type="hidden" name="lend" value="<?php print("$lend"); ?>" /><input type="hidden" name="lamount" value="<?php print("$lamount"); ?>" /></td> <td align="center" width="100"></td> <td align="right"></td> </tr> </table> </form> <table width="780" border="0" cellspacing="0" cellpadding="4" bgcolor="#4050c4"> <tr> <td width="60" class="hofwhite10">action</td> <td width="140"><span class="hofwhite14">DATE</span></td> <td width="80"><span class="hofwhite14">ID</span></td> <td><span class="hofwhite14">News Titile</span></td> <td width="100"><span class="hofwhite14">Status</span></td> </tr> <tr height="0"> <td bgcolor="white" width="60"></td> <td bgcolor="white" width="140" height="0"></td> <td bgcolor="white" width="80" height="0"></td> <td bgcolor="white" height="0"></td> <td bgcolor="white" width="100" height="0"></td> </tr> </table><table width="780" border="0" cellspacing="0" cellpadding="4"><tr> <td width="60"></td> <td width="80"></td> <td><a class="blueullrg" href="add.php">Add News</a></td> <td align="right" width="120"></td> </tr> <tr height="0"> <td width="60" height="0"></td> <td width="80" height="0"></td> <td height="0"></td> <td align="right" width="120" height="0"></td> </tr> </table> <?php //get the DB connection variables include("../../../includes/config.php"); //connect to DB $connection = @mysql_connect($db_address,$db_username,$db_password) or die("Couldn't CONNECT."); $db = @mysql_select_db($db_name, $connection) or die("Couldn't select DATABASE."); $query2="SELECT * FROM news WHERE !(news_status='deleted')"; $result2 = mysql_query($query2) or die("Couldn't execute QUERY - Select NEWS Qty"); $fqty = mysql_num_rows($result2); //SELECT or FIND the same USERNAME $query3="SELECT * FROM news WHERE !(news_status='deleted') ORDER BY news_id DESC"; $result3 = mysql_query($query3) or die("Couldn't execute QUERY - Select NEWS"); while ($row = mysql_fetch_array($result3)) { $news_id = $row['news_id']; $news_title = $row['news_title']; $news_story = $row['news_story']; $news_image = $row['news_image']; $news_image_caption = $row['news_image_caption']; $news_image_link = $row['news_image_link']; $news_date_day = $row['news_date_day']; $news_date_month = $row['news_date_month']; $news_date_year = $row['news_date_year']; $news_status = $row['news_status']; $news_website = $row['news_website']; $news_date_created = $row['news_date_created']; $news_date_modified = $row['news_date_modified']; ?> <table width="780" border="0" cellspacing="0" cellpadding="4" bgcolor="#eeeeee"> <tr> <td width="60"><span class="hofblack10"> <?php if($news_status=="deleted"){ print("<a class='hifblack10'>deleted</span>"); }ELSE{ print("<a class='blueul' href='edit.php?id=$news_id'>edit</a>"); } ?> </span></td> <td width="140"><span class="titlegrey12"> <?php if(!$news_date_day) { echo "00"; } else{ echo $news_date_day; } echo "/"; if(!$news_date_month) { echo "00"; }else{ echo $news_date_month; } echo "/"; if(!$news_date_year) { echo "0000"; }else{ echo $news_date_year; } ?> </span></td> <td width="80"><span class="titlegrey12"><?php print("$news_id"); ?></span> </td> <td><?php if($news_status=="deleted") { print("<class='hofblack10'>$news_title</span>"); }ELSE{ print("<a class='blueul' href='edit.php?id=$news_id'>$news_title</a>"); } ?></td> <td width="100"> <form id="list_update" action="status_update.php" method="post" name="list_update"> <select name="newnstatus" size="1"> <option <?php if($row['news_status'] == "") { print("selected"); } ?> selected="selected" value="">Status...</option> <option <?php if($row['news_status'] == "on") { print("selected"); } ?> value="on">On</option> <option <?php if($row['news_status'] == "off") { print("selected"); } ?> value="off">Off</option> <option <?php if($row['news_status'] == "deleted") { print("selected"); } ?> value="deleted">Delete</option> </select> <input type="hidden" name="nstatus" value="<?php echo $row[news_status]; ?>" /> <input type="hidden" name="id" value="<?php echo $row[news_id]; ?>" /> <input type="submit" name="update" value="update" /> </form> </td> </tr> <tr height="0"> <td bgcolor="white" width="60"></td> <td bgcolor="white" width="140" height="0"></td> <td bgcolor="white" width="80" height="0"></td> <td bgcolor="white" height="0"></td> <td bgcolor="white" width="100" height="0"></td> </tr> </table> <?php } mysql_close($connection);//}?> <table width="780" border="0" cellspacing="0" cellpadding="4"> <tr> <td width="60"></td> <td width="80"></td> <td><a class="blueullrg" href="add.php">Add News</a></td> <td align="right" width="120"></td> </tr> </table><?php // include("list_navigation.html"); ?> <?php include("../footer.html"); ?> </div></body></html> The action script php Code: [Select] <?php /* echo "fstatus: ".$fstatus."<BR>"; echo "id: ".$id."<BR>"; echo "fclient: ".$fclient."<BR>"; echo "newfstatus: ".$newfstatus."<BR>";*/ //set the date of agreement $timestamp = date('l jS \of F Y h:i:s A'); //get the DB connection variables include("../../../includes/config.php"); //connect to DB $connection = @mysql_connect($db_address,$db_username,$db_password) or die("Couldn't CONNECT."); $db = @mysql_select_db($db_name, $connection) or die("Couldn't select FILMS DATABASE."); // All appears well, so enter into database $query= "UPDATE news SET news_status = '$newnstatus' WHERE news_id='$id'"; $result = mysql_query($query) or die("could not execute query - Update FILMS Record to DB"); //setup an email to the Admin @ hof, w/o attachment $emailto="xx@xxx.co.uk"; $emailfrom="no-reply@xxxx.co.uk"; $emailsubject="xx Record Updated"; $emailmessage="Hello Registrar\n\n"; $emailmessage.="News ID: ".$id."\n"; $emailmessage.="Updated on: ".$timestamp."\n\n"; $emailmessage.="Status was: ".$nstatus."\n"; $emailmessage.="Status now: ".$newfnstatus."\n"; $emailmessage.="Thank you,\n\n"; $emailmessage.="Web Site ROBOT\n"; $emailmessage.="(Administrator)\n"; $emailmessage.="xxx.co.uk | xxx.biz\n"; $emailmessage.="----------------------------------------------\n"; $emailmessage.="e. http://www.xxx.co.uk/contact.php\n"; $emailmessage.="w. http://www.xxx.co.uk\n"; $emailheader="From: xxx.co.uk<$emailfrom>"; $emailheader .= 'Cc: xxx@xxx.co.uk'."\r\n"; $emailheader .= 'Bcc: xxx@xxxxx.co.uk'."\r\n"; $ok=mail($emailto,$emailsubject,$emailmessage,$emailheader); mysql_close($connection); if ($ok) { header("Location: list.php"); /* Redirect browser */ exit; } else { $errmsg="There was a problem, please try later or telephone us direct."; $errsta="1"; include("edit_error.html"); //echo "<p>Mail could not be sent. Sorry!</p>"; exit; } ?> Thanks in advance Can anyone post a generic update function to update mysql table. The manual approach: update $tablename set $column1='a', $column2='b' where $id=$value; what Im basically trying to do is just like a phpmyadmin function... you select rows you want to update with a checkbox and then it takes you to a page where the rows that are clicked are shown in forms so that you can view and edit info in them... and then have 1 submit button to update them all at once. As the title says I need help with multiple update system.. Can't really get it to work at all >.< Here's some code: $selectt = mysql_query("SELECT * FROM exercises WHERE user='" . $_SESSION["user"] . "' AND exname='" . $_GET["edit"] . "'"); echo '<form method="POST" action="exercises.php?edited">'; echo '<div id="newexx">'; while($raw = mysql_fetch_array($selectt)) { echo '<input type="text" name="up[' . $raw["id"] . ']" value="' . $raw["swe"] . '">'; echo '<input type="text" name="up1[' . $raw["id"] . ']" value="' . $raw["eng"] . '"><br>'; echo '<input type="hidden" name="id[' . $raw["id"] . ']">'; } echo '</div>'; echo '<input type="submit" value="Update Exercise">'; echo '</form>'; if(isset($_GET["edited"])) { $swe = $_POST["up"]; $eng = $_POST["up1"]; $id = $_POST["id"]; foreach($id as $value => $index) { $update = "UPDATE exercises SET swe='".$swe."', eng='".$eng."' WHERE id='".$index."'"; mysql_query($update); } Would be thankful for reply! I created this code to upload a member's main picture on his member page on website. I'll only include the query part of the code since that's what is relevant to my problem. The idea is basically to upload a new picture onto the database if no picture already exists for that member and display the picture on the page. If a picture already exists, then the script replaces the old picture with the new one upon upload. But for whatever reason I don't understand, when I try to replace the old pic, it gets inserted in a new row on the database instead of replacing the old row, and the new pic gets displayed on the web page alongside the old. Code: [Select] $query = "SELECT username FROM images WHERE member_id = '".$_SESSION['id']."' AND image_cartegory = 'main'"; $result = @mysql_query($query); $num = @mysql_num_rows($result); if ($num> 0) { //Update the image $update = mysql_query("UPDATE images SET image = '" . $image['name'] . "' WHERE member_id = '".$_SESSION['id']."' AND image_cartegory = 'main'"); $_SESSION['error'] = "File updated successfully."; //really should be session success message. header("Location: member.php"); exit; } else { // NOTE: This is where a lot of people make mistakes. // We are *not* putting the image into the database; we are putting a reference to the file's location on the server $sql = "insert into images (member_id, image_cartegory, image_date, image) values ('{$_SESSION['id']}', 'main', NOW(), '" . $image['name'] . "')"; $result = mysql_query($sql) or die ("Could not insert data into DB: " . mysql_error()); $_SESSION['error'] = "File uploaded succussfully."; //really should be session success message. header("Location: member.php"); } So can anyone tell me what the problem is? Could the fact that my insert script actually uploads the image onto a folder on my server and only stores the path name in the database have anything to contribute to the mixup? Appreciate your responses in advance. Hi Guys, I want my UPDATE function from the code below to only update those fields that are NOT empty - if they are empty on submit then do not update or change any values from that field. I know that sounds odd, but with my file fields, when I submit to change something else at a later date it will overwrite the photo, download1,2 & 3 values and as a result I loose my files from the mysql table. Cheers, S <?php include('config.php'); if (isset($_GET['Ter']) ) { $ter = (int) $_GET['Ter']; if (isset($_POST['submitted'])) { //Photo & Document Upload Upload $timestamp_photo = time(); $timestamp_download1 = time(); $timestamp_download2 = time(); $timestamp_download3 = time(); //This is the directory where the files will be saved //Photos $photo_target = "images/"; $photo_target = $photo_target .$timestamp_photo. basename( $_FILES['photo']['name']); //Documents $download_target = "documents/"; $download_target1 = $download_target .$timestamp_download1. basename( $_FILES['download1']['name']); $download_target2 = $download_target .$timestamp_download2. basename( $_FILES['download2']['name']); $download_target3 = $download_target .$timestamp_download3. basename( $_FILES['download3']['name']); //This gets all the other information from the form $photo = ($_FILES['photo']['name']); $download1 = ($_FILES['download1']['name']); $download2 = ($_FILES['download2']['name']); $download3 = ($_FILES['download3']['name']); //Pause Photo/Document Upload foreach($_POST AS $key => $value) { $_POST[$key] = mysql_real_escape_string($value); } $sql= "UPDATE `ter` SET `Ter` = '{$_POST['Ter']}' , `BranchName` = '{$_POST['BranchName']}' , `BranchAddress` = '{$_POST['BranchAddress']}' , `BranchTel` = '{$_POST['BranchTel']}' , `BranchEmail` = '{$_POST['BranchEmail']}' , `BranchLink` = '{$_POST['BranchLink']}' , `Theme` = '{$_POST['Theme']}' , `LocalInfo` = '{$_POST['LocalInfo']}' , `BranchInfo` = '{$_POST['BranchInfo']}' , `photo` = '$timestamp_photo{$_FILES['photo']['name']}' , `download1` = '$timestamp_download1{$_FILES['download1']['name']}' , `download1name` = '{$_POST['download1name']}' , `download2` = '$timestamp_download2{$_FILES['download2']['name']}' , `download2name` = '{$_POST['download2name']}' , `download3` = '$timestamp_download3{$_FILES['download3']['name']}' , `download3name` = '{$_POST['download3name']}' WHERE `Ter` = '$ter' "; mysql_query($sql) or die(mysql_error()); //Unpause Photo/Document Upload //Writes the photo to the server if(move_uploaded_file($_FILES['photo']['tmp_name'], $photo_target)) { echo "<br />The file ".$timestamp_photo. basename( $_FILES['photo']['name']). " has been uploaded. <br />"; } else { echo ""; } //End of Photo/Document Upload //Writes the photo to the server if(move_uploaded_file($_FILES['download1']['tmp_name'], $download_target1)) { echo "<br />The file ".$timestamp_download1. basename( $_FILES['download1']['name']). " has been uploaded. <br />"; } else { echo ""; } //End of Photo/Document Upload //Writes the photo to the server if(move_uploaded_file($_FILES['download2']['tmp_name'], $download_target2)) { echo "<br />The file ".$timestamp_download2. basename( $_FILES['download2']['name']). " has been uploaded. <br />"; } else { echo ""; } //End of Photo/Document Upload //Writes the photo to the server if(move_uploaded_file($_FILES['download3']['tmp_name'], $download_target3)) { echo "<br />The file ".$timestamp_download3. basename( $_FILES['download3']['name']). " has been uploaded. <br />"; } else { echo ""; } //End of Photo/Document Upload echo (mysql_affected_rows()) ? "<br />Edited Branch.<br />" : "<br />Nothing changed. <br />"; } $row = mysql_fetch_array ( mysql_query("SELECT * FROM `ter` WHERE `Ter` = '$ter' ")); ?> I'm new to PHP and I was able to figure out how to populate data from my database into my text fields. I am trying to add the update information to the same php file; however, I am now receiving errors within the data I was able to populate,
Notice: Undefined variable: stmt in C:\xampp\htdocs\Cust_App\update.php on line 47 and errors with the Update statement
Notice: Undefined variable: stmtupdate in C:\xampp\htdocs\Cust_App\update.php on line 96 I had defined the customerID variable above in the code, but it isn't being captured from here. I tried setting up this query like the one which gathered the data, but I'm off by a little bit. I would like the option to be able to update all fields. Any help is appreciated. I'm trying to learn as I may get asked to update other forms in the future. (new boss asks a lot) <?php require_once('database.php'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <!-- the head section --> <head> <title>My Guitar Shop</title> <link rel="stylesheet" type="text/css" href="main.css" /> </head> <!-- the body section --> <body> <div id="page"> <div id="header"> <h1>SportsPro Technical Support</h1> <p>Sports management software for the sports enthusiast.</p></h1> </div> <div id="main"> <h1>View/Update Customer</h1> <form action="update.php" method="get" > <?php if(isset($_GET['customerID'])) { $customerID = filter_input(INPUT_GET, 'customerID', FILTER_SANITIZE_NUMBER_INT); $sql = "SELECT * FROM customers WHERE customerID =$customerID "; $stmt = $db->query($sql); } ?> <div id="content"> <!-- display a table of products --> <h2>Customers</h2> <form method = "edit"> <?php foreach ($stmt as $cust) { ?> <div> <label>First Name</label> <input type="text" name="name" class ="form-control" value ="<?php echo $cust['firstName']; ?>"> </div><br> <div> <label>Last Name</label> <input type="text" name="name" class ="form-control" value ="<?php echo $cust['lastName']; ?>"> </div><br> <div> <label>Address</label> <input type="text" name="address" class ="form-control" value ="<?php echo $cust['address']; ?>"> </div><br> <div> <label>City</label> <input type="text" name="city" class ="form-control" value ="<?php echo $cust['city']; ?>"> </div><br> <div> <label>State</label> <input type="text" name="state" class ="form-control" value ="<?php echo $cust['state']; ?>"> </div><br> <div> <label>Country</label> <input type="text" name="countryCode" class ="form-control" value ="<?php echo $cust['countryCode']; ?>"> </div><br> <div> <label>Zip Code</label> <input type="text" name="postalCode" class ="form-control" value ="<?php echo $cust['postalCode']; ?>"> </div><br> <div> <label>Email </label> <input type="text" name="email" class ="form-control" value ="<?php echo $cust['email']; ?>"> </div><br> <div> <label>Phone Number </label> <input type="text" name="phone" class ="form-control" value ="<?php echo $cust['phone']; ?>"> </div><br> <div> <label>Password </label> <input type="text" name="password" class ="form-control" value ="<?php echo $cust['password']; ?>"> </div><br> <div> <?php } ?> <input type="Submit" name="Update_Data" value="Update Data"></input> <?php $sql2 = "UPDATE customers SET firstName = ". $stmtupdate['firstName']." WHERE customerID =$customerID "; $stmtupdate = $db->query($sql2); ?> </div> </div> <div id="footer"> <p> © <?php echo date("Y"); ?> SportsPro, Inc. </p> </div> </div><!-- end page --> </body> </html>
Good morning. I am looking fo some help with an update script to update all rows in a table. This is what I have for a form and all looks well. form.php <?php // run the query and put the results in an array variable called $result $result = mysql_query("SELECT * FROM table ORDER BY 'id', 'title', 'text', 'number'"); print "<form method='post' action='update.php'> <table width='100%' border='0' cellspacing='1' cellpadding='1'><tr> <td align='center'><strong>ID</strong></td> <td align='center'><strong>Title</strong></td> <td align='center'><strong>text</strong></td> <td align='center'><strong>Number</strong></td> </tr>\n"; // start a loop to print all of the courses with their book information // the mysql_fetch_array function puts each record into an array. each time it is called, it moves the array counter up until there are no more records left while ($Update = mysql_fetch_array($result)) { // start displaying the info; the most important part is to make the name an array (notice bookinfo[$i]) print "<td align='center'><p>{$Update['id']}</p></td>\n"; print "<td align='center'><input type='text' name='title' value='{$Update['title']}' /></td>"; print "<td align='center'><input type='text' size='40' name='text' value='{$Update['text']}' /></td>\n"; print "<td align='center'><input type='text' size='40' name='number' value='{$Update['number']}' /></td>\n"; print "</tr>\n"; // add 1 to the count, close the loop, close the form, and the mysql connection } print "<tr> <td colspan='4' align='center'><input type='submit' value='submit' />"; print "</td> </tr> </table> </td> </tr> </form> </table>"; print "</tr>\n"; ?><br /><br /> My question is. How do I update this info into the database with the proper info. ie. Update.php? Hi all, I have a script that is supposed to upload an image and then update a field in the table with the image's path in it. The image uploads okay but the details do not UPDATE in the table... any ideas? I have echoed after the sql statement which doesn't appear upon submitting but it shows the query printed out doing the right thing (I think) Quote UPDATE `fleet` SET `fleetimage4` = '../fleet/last.JPG' WHERE `fleetref` = '9' LIMIT 1 Code: [Select] <?php $ref = (!empty($_GET['ref']))?trim($_GET['ref']):""; $image = (!empty($_GET['image']))?trim($_GET['image']):""; $idir = "../fleet/"; // Path To Images Directory if (isset ($_FILES['fupload'])){ //upload the image to tmp directory $url = $_FILES['fupload']['name']; // Set $url To Equal The Filename For Later Use if ($_FILES['fupload']['type'] == "image/jpg" || $_FILES['fupload']['type'] == "image/jpeg" || $_FILES['fupload']['type'] == "image/pjpeg") { $file_ext = strrchr($_FILES['fupload']['name'], '.'); // Get The File Extention In The Format Of , For Instance, .jpg, .gif or .php $copy = copy($_FILES['fupload']['tmp_name'], "$idir" . $_FILES['fupload']['name']); // Move Image From Temporary Location To Permanent Location } } if (isset($_POST['submit'])){ //$fleetref=$_POST["fleetref"]; $fleetimage1 = mysql_real_escape_string("$idir" . $_FILES['fupload']['name']); $fleetimage2 = mysql_real_escape_string("$idir" . $_FILES['fupload']['name']); $fleetimage3 = mysql_real_escape_string("$idir" . $_FILES['fupload']['name']); $fleetimage4 = mysql_real_escape_string("$idir" . $_FILES['fupload']['name']); # setup SQL statement if ($image == "1") { $query = sprintf("UPDATE `fleet` SET `fleetimage1` = '$fleetimage1' WHERE `fleetref` = '$ref' LIMIT 1"); } else if ($image == "2"){ $query = sprintf("UPDATE `fleet` SET `fleetimage2` = '$fleetimage2' WHERE `fleetref` = '$ref' LIMIT 1"); } else if ($image == "3"){ $query = sprintf("UPDATE `fleet` SET `fleetimage3` = '$fleetimage3' WHERE `fleetref` = '$ref' LIMIT 1"); } else if ($image == "4"){ $query = sprintf("UPDATE `fleet` SET `fleetimage4` = '$fleetimage4' WHERE `fleetref` = '$ref' LIMIT 1"); } #execute SQL statement echo "before exe"; $result = mysql_db_query($db,$query,$cid) or die($query."<br>".mysql_error()); echo "after exe"; # check for error if (!$result){ echo("ERROR: " . mysql_error() . "\n$SQL\n"); }} ?> <div class="controls_left"> <FORM NAME="fa" ACTION="<?php echo "fleet_edit_image.php?ref=$ref&image=$image"; ?>" METHOD="POST" enctype="multipart/form-data"> <input type = "hidden" name="MAX_FILE_SIZE" value = "1000000"> Select image: <input type = "file" name = "fupload"> <p>Copyright note: Please only use photographs either that you have taken yourself or that you have permission to use as we will not be held responsible for any Copyright infringement.</p> <input name="submit" type="submit" value="Edit image" /> </FORM> </div> <div class="image_right"><?php if ($image == "1") { $imageprint = "$fleetimage1"; } else if ($image == "2") { $imageprint = "$fleetimage2"; } else if ($image == "3") { $imageprint = "$fleetimage3"; } else if ($image == "4") { $imageprint = "$fleetimage4"; } echo "<div class=\"image_right\"><img src=\"../$imageprint\" alt=\"Edit image\" width=\"293\" height=\"218\"></div>"; ?> Please help me with this: been doing this for 2 days and still cannot solve it. it won't update... I have attached my file: <?php include('connect-database.php'); if (isset($_POST['submit']) AND $_POST['submit'] == 'update') { $error = false; extract($_POST); if (empty($full_name)) $error = true; if (!$error) { $update = "UPDATE users SET full_name = '$full_name', WHERE id=$id "; mysql_query($update) or die(mysql_error() . "<br><br>" . $update); $full_name = ''; $message = "Record successfully updated."; } else { $message = "There is an error in your entry"; } } else { $id = intval(isset($_GET['id']) ? $_GET['id'] : 0); } if ($id == 0) { echo "<div style='margin-bottom:10px'>Invalid ID.</div>"; exit; } $query = "SELECT * FROM users WHERE id=$id"; $result = mysql_query($query) or die(mysql_error() . "<br><br>" . $query); if (mysql_num_rows($result) == 0) { echo "<div style='margin-bottom:10px'>Record Not Found in Database!</div>"; exit; } $row = mysql_fetch_array($result); extract($row); ?> <div id="mainContent" class="tab_container"> <div id="tab1" class="tab_content"> <h1>Edit Personal Data</h1> <div style="color:red;font-weight:bold"><? echo $message; ?></div> <form name="submit" action="" method="post"> <ul> <li><b>ID # :</b> <?php echo $id?></li> <li><b>Name :</b> <input type="text" name="full_name" id="" size="30" value="<?php echo $full_name ?>" /></li> <li><b>Address :</b> <input type="text" name="address" id="" size="55" maxlength="100" value="<?php echo $address ?>" /></li> <li><b>Contact Number :</b> <input type="text" name="contact_number" id="" size="11" value="<?php echo $contact_number ?>" /></li> <li><b>Email Address :</b> <input type="text" name="user_email" id="" size="30" value="<?php echo $user_email ?>" /></li> <li><b>Status :</b> <input type="text" name="status" id="" size="10" value="<?php echo $status ?>" /></li> <li><b>Nationality :</b> <input type="text" name="nationality" id="" size="20" value="<?php echo $nationality ?>" /></li> <li><b>Religion :</b> <input type="text" name="religion" id="" size="20" value="<?php echo $religion ?>" /></li> </ul> <h2>Self Description</h2> <p><textarea rows="9" cols="40" name="self_description" ><?php echo $self_description ?></textarea></p> <input type="hidden" name="id" value="<?php echo $id; ?>" /> <input type="submit" name="submit" value="update" /> </form> </div> i have got the update script below it works but what i want to know is could i change the id text box into a drop down that lists all of the ids in the database and when one is selected it shows the other information in the other fields next to it so it is easier to edit the required field. update.php <?php include("dbinfo1.inc.php"); $link=mysql_connect($localhost,$username,$password); mysql_select_db($database) or die("unable to connect"); $result=mysql_query("SELECT * FROM Testimonials where id") or die("ERROR:".mysql_error()); $row=mysql_fetch_array($result,MYSQL_ASSOC); print '<form method="POST" action="updated.php">'; print 'id:<input name="id" value="'.$row['id'].'">'; print '<br />'; print 'Name:<input type="text" name="Name" value="'.$row['Name'].'" />'; print '<br />'; print 'Message:<input type="text" name="Message" value="'.$row['Message'].'" />'; print '<br />'; print 'Download:<input type="text" name="Download" value="'.$row['Download'].'" />'; print '<br />'; print '<input type="submit" name="submit" value="Update">'; mysql_close($link); ?> updated.php <META HTTP-EQUIV="refresh" content="0;URL=index.php"><?php include("dbinfo1.inc.php"); $link=mysql_connect($localhost,$username,$password); mysql_select_db($database) or die("unable to connect"); $id=$_POST['id']; $Name=$_POST['Name']; $Message=$_POST['Message']; $Download=$_POST['Download']; mysql_query("UPDATE Testimonials SET Name='$Name', Message='$Message', Download='$Download' where id='$id'") or die("ERROR:".mysql_error()); echo "thanks"; mysql_close($link); ?> I'm trying to make sure if this block of code makes sense to everyone and if not what am I doing wrong? Code: [Select] if (isset($_POST['editbio'])) { $defaultCharID = (int)$_POST['defaultCharID']; foreach($_POST as $fieldID => $value) { if($bioFieldID != "submitBio" || "defaultCharID") { $query = "UPDATE `fieldContents` SET `content` = '".$value."', `fieldID` = '".$fieldID."' WHERE `characterID` = '".$defaultCharID."'"; mysqli_query($dbc,$query); $result = "good"; } } } <?php mysqli_report(MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT); $conn = mysqli_connect("localhost","root", "","update"); // // PROCESS POSTED DATA // if ($_SERVER['REQUEST_METHOD']=='POST') { $stmt = $conn->prepare("UPDATE ronel SET status = ?, comment = ?, department = ? WHERE id = ? "); $stmt->bind_param('ssi', $_POST['status'], $_POST['comment'], $_POST['department'], $_POST['id']); $stmt->execute(); header("Location: ronel_dashboard.php"); exit; } if (!isset($_GET['id']) || trim($_GET['id'])=='') { header("Location: "); exit; } $res = $conn->prepare("SELECT id , location , status , comment , department FROM ronel WHERE id = ? "); $res->bind_param('i', $_GET['id']); $res->execute(); $res->bind_result($id, $location, $status, $comment, $department); $res->fetch(); $res->close(); // // status-dependent processing // $buttons = "<div class='data'> <button name='status' class='w3-button w3-khaki' value='$status'>Update</button> </div> "; ?> <!DOCTYPE html> <html> <head> <meta http-equiv="content-language" content="en"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Details</title> <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"> <style type='text/css'> body { font-family: calibri, sans; font-size: 12pt; } label { display: inline-block; width: 150px; background-color:#E4EBC5; color:orangered; padding: 8px; font-weight: 600; margin-right:30px; vertical-align: top;} .data { display: inline-block; width: 500px; padding: 8px; vertical-align: top;} /*.comment { display: inline-block; width: 450px; vertical-align: top;} */ </style> </head> <body> <header class="w3-display-container w3-orange w3-padding" style='height:90px;'> <div class="w3-left"> <h2>Details</h2> </div> <div class="w3-right w3-margin"> <a href='ronel_dashboard.php' class='w3-khaki w3-button'>Dashboard</a> </div> </header> <div class='w3-container'> <form method='POST'> <input type='hidden' name='id' value='<?=$id?>'> <div class="w3-card w3-padding" style='max-width: 750px; margin: 30px auto;'> <div> <label>ID</label> <div class="data"><?=$_GET['id']?></div> </div> <div> <label>Location</label> <div class="data"><?=$location?></div> </div> <div> <label>Status</label> <div><?=$status?></div> </div> <div> <label>Comments</label> <div class="data"><textarea name='comment' class='w3-input w3-border' rows='5'><?=$comment?></textarea></div> </div> <div><label for="cars">Select Department:</label> <div class="data"> <select id="department"> <option value="volvo">MMD</option> <option value="saab">O&M</option> <option value="opel">Civil</option> <option value="audi">C&M</option> </select> </div> </div> </div> <div class='w3-content w3-center w3-padding'> <?=$buttons?> </div> </form> </div> </body> </html> Dear Sir/Madame Can someone help me with this piece of code? I have tried updating a comment section with approve and reject status button here and Sir Barand has helped me a lot with the project code which he provided me!! Now after the approval/reject part done what i am trying to do is update a department section with the comment section as well and instead of approve/reject button i want to update only with a different page. or need to run this code on the server every 4 to 5 s without opening the page in browser <?php $con = mysql_connect("*","*","*"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("*", $con); $result = mysql_query("SELECT * FROM `ta` WHERE `top` LIKE '0' LIMIT 0,1"); $row_ro = mysql_fetch_array($result); $a = $row_ro['id']; $query="UPDATE tr SET top = '1' WHERE id = '$a'"; mysql_query($query); mysql_close($con); ?> regards How do i update proposals with date and time when someone approves/complete/rejects the proposal? Screen123 is my database's image. Do i have to add a new column in it for date and time separately? Down below screen12 is my dashboard image, in here i would like to add and show the time and date of the proposal after it gets approved/rejects/completed? 1. This code here shows the approval index. <body> <?php session_start(); //Checking User Logged or Not if(empty($_SESSION['user'])){ header('location:index.php'); } ?> <?php mysqli_report(MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT); $conn = mysqli_connect("localhost","root", "","registration"); $res = $conn->query("SELECT id , details , location , date , time , reporteddept , reportedname , status FROM proposals WHERE YEAR(date) = YEAR(CURDATE()) ORDER BY id "); ?> <!DOCTYPE html> <html> <head> <meta http-equiv="content-language" content="en"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head> <body> <h2 style="text-align:center; font-size:20px; inline-block; width: 180px; position: relative; left:40%; top:5px; font-weight: bold; background-color:#00FFFF; padding:6px;">DASHBOARD</h2> <div class="w3-content w3-padding"> <style> table { font-family: arial, sans-serif; border-collapse: separate; width: 100%; table-layout: fixed; background-color: #EBFFE3; overflow: auto; flex:1; text-overflow: ellipsis;} td, th { border: 1px solid #90D199; text-align: left; padding: 8px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap;} tr:nth-child(even) { background-color: #dddddd; text-overflow: ellipsis;} </style> <table> <h3> <tr style="background-color:#E4EBC5; color:orangered;"> <th>Nearmiss No.</th> <th>Details</th> <th>Location</th> <th>Date</th> <th>Time</th> <th>Status</th> </tr> </h3> <?php if ($row = $res->fetch_assoc()) { do { switch ($row['status']){} echo "<tr> <td><a href='plantapproval.php?id={$row['id']}' class='w3-button w3-tiny w3-khaki'>{$row['id']}{$row['reportedname']}{$row['reporteddept']}</a></td> <td>{$row['details']}</td> <td>{$row['location']}</td> <td>{$row['date']}</td> <td>{$row['time']}</td> <td>{$row['status']}</td> </tr> "; } while ($row = $res->fetch_assoc()); } else { echo "<tr><td>No records</td></tr>" ; } ?> </table> </div> </body> </html> </body> 2. This code here is the approval.php and i want to add the date and time when the approval button gets clicked? <?php mysqli_report(MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT); $conn = mysqli_connect("localhost","root", "","registration"); // // PROCESS POSTED DATA // if ($_SERVER['REQUEST_METHOD']=='POST') { $stmt = $conn->prepare("UPDATE proposals SET status = ? WHERE id = ? "); $stmt->bind_param('si', $_POST['status'],$_POST['id']); $stmt->execute(); header("Location: plantdashboard.php"); exit; } if (!isset($_GET['id']) || trim($_GET['id'])=='') { header("Location: "); exit; } $res = $conn->prepare("SELECT id , details , location , date , time , checkbox , injured , agegender , contact , empid , dept , organization , summary , image , outcome , cause , action , reportedname , position , organisation , reportedcontact , reporteddept , status , department FROM proposals WHERE id = ? "); $res->bind_param('i', $_GET['id']); $res->execute(); $res->bind_result($id, $details, $location, $date, $time, $checkbox,$injured,$agegender,$contact,$empid,$dept,$organization,$summary,$image,$outcome,$cause,$action,$reportedname,$position,$organisation,$reportedcontact,$reporteddept,$status,$department); $res->fetch(); $res->close(); // // status-dependent processing // $buttons = "<div class='data'> <button name='status' class='w3-button w3-khaki' value='$status'>Update</button> </div>"; switch ($status) { case 'pending': $cls1 = 'class="w3-dark-gray data"'; $buttons = "<div class='data'> <button name='status' style='background-color:deepskyblue; border-radius:10px; cursor:pointer; font-size:20px;' class='w3-button w3-green' value='approved'>Approve</button> <button name='status' style='background-color:deepskyblue; border-radius:10px; cursor:pointer; font-size:20px;' class='w3-button w3-red' value='rejected'>Reject</button> </div> "; break; case 'approved': $cls1 = 'class="w3-pale-green data"'; break; case 'rejected': $cls1 = 'class="w3-pale-red data"'; } $buttons1 = "<div class='data'> <button name='status' class='w3-button w3-khaki' value='$status'>Update</button> </div>"; switch ($status) { case 'approved': $cls1 = 'class="w3-green data"'; $buttons = "<div class='data'> <button name='status' style='background-color:deepskyblue; border-radius:10px; cursor:pointer; font-size:20px;' value='completed' disabled>Complete</button> </div>"; break; case 'completed': $cls1 = 'class="w3-pale-green data"'; $buttons = "<div class='data'> <button name='status' style='background-color:deepskyblue; border-radius:10px; cursor:pointer; font-size:20px;' value='$status' disabled>Update</button> </div>"; case 'rejected': $cls1 = 'class="w3-pale-green data"'; $buttons = "<div class='data'> <button name='status' style='background-color:deepskyblue; border-radius:10px; cursor:pointer; font-size:20px;' value='$status' disabled>Update</button> </div>"; } ?> <html lang = "en"> <head> <title>Proposals</title> <meta charset = "UTF-8" /> </head> <body><button onclick="myFunction()">Print</button> <script> function myFunction() { window.print(); } </script> <h1>Proposal Form No : <?php echo $id ?></h1> <form method='POST' id='formId'> <input type='hidden' name='id' value='<?=$id?>'> <fieldset> <legend>NearMiss Proposal</legend> <p> <b style="font-size:17px; color:black; position: absolute; top:130px;">Details of incident :</b> <textarea style="position:relative;" disabled id = "myTextArea" rows = "5" cols = "110"><?php echo $details ?></textarea></p><br> <fieldset style="height:55px; width:848px; border:1px solid #888;"> <p> <b style="font-size:17px; color:black; position: relative; bottom:-5px;">Location :</b> <textarea style="position:absolute; left:115px;" disabled id = "myTextArea" rows="2" cols="56"><?php echo $location ?></textarea> </p> <br> <p> <b style="font-size:17px; color:black; position:relative; left:545px; bottom:80px;" >Date :</b><textarea style="position:relative; left:555px; bottom:70px;" disabled id = "myTextArea" rows="2" cols="10"><?php echo $date ?></textarea> </p> <p> <b style="font-size:17px; color:black; position:relative; left:708px; bottom:135px;" >Time :</b><textarea style="position:relative; left:715px; bottom:125px;" disabled id = "myTextArea" rows="2" cols="10"><?php echo $time ?></textarea> </p> </fieldset> <p><b>Classification(Tick the appropriate one, Leave blank if you find it difficulty) :</b><br> <label style="font-size:16px;color:black;">Selected Classification :</label> <textarea style="position:relative; bottom:-3px;" disabled id = "myTextArea" rows="1" cols="47"><?php echo $checkbox ?></textarea> </p> <p> <b style="font-size:17px;color:black;">Details of Injured(IP)(if any) :NA</b><br> <b>Name:</b> <textarea style="position:relative; bottom:-5px;" disabled name="name" cols="25" rows="1" class="form-control"> <?php echo $injured ?></textarea> </p> <p style="position:relative; left:280px; bottom:35px;"> <b style="position:relative; bottom:4px;">Age/Gender :</b> <textarea disabled name="agegender" cols="3" rows="1"><?php echo $agegender ?></textarea> </p> <p style="position:relative; left:435px; bottom:75px;"> <b style="position:relative; bottom:4px;">Contact :</b> <textarea disabled name="agegender" cols="9" rows="1"><?php echo $contact ?></textarea> </p> <p style="position:relative; left:600px; bottom:115px;"> <b style="position:relative; bottom:4px;">Organization :</b> <textarea disabled name="agegender" cols="9" rows="1"><?php echo $organization ?></textarea> </p> <p style="position:relative; left:0px; bottom:125px;"> <b style="position:relative; bottom:4px;">Department :</b> <textarea disabled name="agegender" cols="9" rows="1"><?php echo $dept ?></textarea> </p> <p style="position:relative; left:226px; bottom:165px;"> <b style="position:relative; bottom:4px;">Employee ID :</b> <textarea disabled name="agegender" cols="9" rows="1"><?php echo $empid ?></textarea> </p><br> <p> <b style="color:black; position: relative; bottom:204px;">Summary of Incident(Attach Photographs, if any, as Annexure1) :</b> <textarea style="position:absolute; left:25px; top:525px;" disabled id = "myTextArea" rows="8" cols="110"><?php echo $summary ?></textarea> </p> <div class="form-group"> <label style="position:absolute; left:82%; top:505px;">Uploaded Images Here :</label><b style="position:relative; left:88%; bottom:198px;"><?php echo "<a href='uploads/" . $image . "'><img src='uploads/" . $image . "'height='105' width='120'></a>" ?> </b> </div> <p> <b style="color:black; position: relative; bottom:186px;">Potential outcome(Incase of Near Miss Case or Potential incident only) :</b> <textarea style="position:absolute; left:27px; top:700px;" disabled id = "myTextArea" rows="8" cols="110"><?php echo $outcome ?></textarea> </p> <p> <b style="color:black; position: relative; bottom:146px;">Likely cause(s) :</b> <textarea style="position:relative; right:112px; top:-10px;" disabled id = "myTextArea" rows="8" cols="110"><?php echo $cause ?></textarea> </p><br> <p> <b style="position: absolute; top:1032px;">Immediate action(s) taken :</b> <textarea style=" float:left; position:relative; bottom:14px;" disabled id = "myTextArea" rows="8" cols="110"><?php echo $action ?></textarea></p> <br><br><br><br><br><br><br> <p style="float:left;"> <b style="font-size:17px;color:black;">Incident reported by :</b><br><br> <b>Name:</b> <input type="text" disabled value="<?php echo $reportedname ?>"> <b>Position:</b> <input type="text" disabled value="<?php echo $position ?>"> <b>Organisation:</b> <input type="text" disabled value="<?php echo $organisation ?>"><br><br> <b>Reporter contact no:</b> <input type="text" disabled value="<?php echo $reportedcontact ?>"> <b>Reporter department:</b> <input type="text" disabled name="name" value= "<?php echo $reporteddept ?>"> </p> <fieldset style="position:relative; top:30px; width:848px; "> <p> <b style="font-size:18px; color:darkblue;">Status of the Proposal : <div<?=$cls1?>><?=$status?></div></b> </p> <!--<p> <b style="font-size:18px;">Select Department :</b> <input type='hidden' name='department'> <tr> <td><select name='department'> <option value='' selected>------SELECT DEPARTMENT------</option> <option value='Civil'>Civil</option> <option value='O&M'>O&M</option> <option value='C&M'>C&M</option> <option value='MMD'>MMD</option> <option value='Logistics'>Logistics</option> <option value='HR&ADMIN'>HR&ADMIN</option> <option value='Fire & Safety'>Fire & Safety</option> <option value='IT & MIS'>IT & MIS</option> <option value='F&M'>F&M</option> <option value='EMD'>EMD</option> <option value='C&I'>C&I</option> <option value='Store'>Store</option> <option value='EHS'>EHS</option> <option value='Tech Cell'>Tech Cell</option> <option value='Operation'>Operation</option> </select></td> </tr> </p>--> <div> <b style="font-size:18px;">Selected Departments : <input type="text" disabled value="<?php echo $department ?>"></b> </div> </fieldset> <br><br><br> </fieldset><br> <div style="display: flex; justify-content: center;"> <?=$buttons?> </div> </form> </body></html> <br> <label style="background-color:deepskyblue; border-radius: 5px; font-size:32px;">Uploaded Files after Completion</label> <fieldset style="background-color:aliceblue;"> <br> <!--<div> <form action="upload.php" method="post" enctype="multipart/form-data"> <input type="hidden" name="id" value="<?php echo $row->id?>"> <div> <label><b>Upload Image Here :</b></label><br><br> <div> <input type="file" name="name" enctype="multipart/form-data" id="incident_reference" onchange="document.getElementById('inc_ref').src = window.URL.createObjectURL(this.files[0]); document.getElementById('inc_ref').className +='_active'; document.getElementById('inc_ref_span').className += '_hidden'"> </div><iframe id="inc_ref" width="220px" height="130px"></iframe><br><br> <b>Details :</b><br> <div> <textarea rows="6" cols="110" style="border-radius:12px;" name="details" placeholder="Details"></textarea> </div> </div> <input type="submit" name="submit" style="background-color:deepskyblue; cursor:pointer; border-radius: 8px; font-size:19px;" value="Submit"></form> </div>--> <?php mysqli_report(MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT); $conn = mysqli_connect("localhost","root", "","registration"); $res = $conn->prepare("SELECT id ,image, details FROM upload WHERE id = ? "); $res->bind_param('i', $_GET['id']); $res->execute(); $res->bind_result($id,$image,$details); while ($res->fetch()) { echo '<b style="font-size:18px;">Click Image to View</b><br><br>'; echo"<a href='completedupload/" . $image . "'><img src='completedupload/" . $image . "'height='105' width='120'></a><br><br>"; echo '<b style="font-size:18px;">Details :'.$details.'</b><br>'; } ?> </fieldset><br> <fieldset style="background-color:aliceblue;"> <label style="background-color:deepskyblue; border-radius: 5px; font-size:22px;">Comment Section</label><br><br> <div> <form action="plantcomment.php" method="post"> <input type="hidden" name="id" value="<?php echo $id ?>"> <div> <b>Name :</b> <input type="text" name="cname" style="border-radius:5px;"><br><br> <b>Leave a Comment :</b> <div> <textarea rows="6" cols="110" style="border-radius:12px;" name="comment" placeholder="comment"></textarea> </div> </div> <input type="submit" name="postcomment" style="background-color:deepskyblue; cursor:pointer; border-radius: 8px; font-size:19px;" value="comment"></form> </div> <?php mysqli_report(MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT); $conn = mysqli_connect("localhost","root", "","registration"); if (!isset($_GET['id']) || trim($_GET['id'])=='') { header("Location: plantapproval.php "); exit; } $res = $conn->prepare("SELECT id ,cname, comment,date FROM comments WHERE id = ? "); $res->bind_param('i', $_GET['id']); $res->execute(); $res->bind_result($id,$cname,$comment,$date); while ($res->fetch()) { echo'<b style="color:darkmagenta">'.$cname.' : </b>'; echo ''.$comment.'<br>'; echo'<b style="color:gray">'.$date.'</b><br><br>'; } ?> </fieldset> Kindly help me i am stuck. Thanks alot. right first off i've seen alot of examples of how to update your database via sql. I don't want to do this. i want to be able to review my data what i've searched for and then post that data into a table (already done this). Then from the results i want to be able to update the information on the columns i want to. any ideas? I'm not sure if this is possible but is it possible to update an xml file using php which in turn the xml updates the flash file? so say the user enters some data into the database the database is then read by the php which sends to xml and then updates the flash file? hope that makes some form of sense and if it does exist or some form of system that does this could you please give me some guidance in the right direction Thanks James any reason why this may not be updating Code: [Select] <?php if(isset($_POST['submitbtn'])){ //will open up the db connection require_once"../includes/connect.php"; $errors = ""; $welcometitle = mysql_real_escape_string($_POST['welcometitle']); $welcomesection = mysql_real_escape_string($_POST['welcomesection']); $infotitle = mysql_real_escape_string($_POST['infotitle']); $infosection = mysql_real_escape_string($_POST['infosection']); $videotitle = mysql_real_escape_string($_POST['videotitle']); $videosection = mysql_real_escape_string($_POST['videosection']); if(isset($welcometitle, $welcomesection) && !empty($welcometitle) && !empty($welcomesection)){ if(isset($infotitle, $infosection) && !empty($infotitle) && !empty($infosection)){ if(isset($videotitle, $videosection) && !empty($videotitle) && !empty($videosection)){ //adding them to the db $query = mysql_query("UPDATE `home` SET `welcometitle`=`$welcometitle`,`welcomesection`=`$welcomesection`,`infotitle`=`$infotitle`, `infosection`=`$infosection`,`videotitle`=`$videosection`"); header("location: http://www.website.org/control/edithome"); }else{ $errors = "Please fill in the Video Section"; } }else{ $errors = "Please fill in the Info Section"; } }else{ $errors = "Please fill in the Welcome Section"; } mysql_close();//will close the inlcude db connection } ?> Hi I am trying to do this UPDATE table SET field1=field1 + ',20'; but it is not working whats spose to happen is: if field1 is 5 it should become 5,20 etc Thank you |