Jump to content

Search the Community

Showing results for tags 'Update'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 22 results

  1. Hi, I've got a table with waypoints in my db (called points), these waypoints combine to a route due to the the timestamp in the start and stop column. Now I would like to change the date and/or date + hour to use the track on a different date or start at a differnt hour. But i also would like to keep the intervals between the records. ID Name Lat Lon Start Stop 526 Waypoint X 52.14722000 6.39720000 2020-03-30 20:37:32.0 2020-03-30 20:47:32.0 527 Waypoint Y 52.14670000 6.39139000 2020-03-30 20:47:32.0 2020-03-30 20:52:32.0 528 Waypoint Z 52.14248000 6.39125000 2020-03-30 20:52:32.0 2020-03-30 20:57:32.0 529 Waypoint X 52.14722000 6.39720000 2020-03-30 20:57:32.0 2020-03-30 21:02:32.0 530 Waypoint Y 52.14670000 6.39139000 2020-03-30 21:02:32.0 2020-03-30 21:07:32.0 531 Waypoint Z 52.14248000 6.39125000 2020-03-30 21:07:32.0 2020-03-30 21:12:32.0 532 Waypoint X 52.14722000 6.39720000 2020-03-30 21:12:32.0 2020-03-30 21:17:32.0 533 Waypoint Y 52.14670000 6.39139000 2020-03-30 21:17:32.0 2020-03-30 21:22:32.0 534 Waypoint Z 52.14248000 6.39125000 2020-03-30 21:22:32.0 2020-03-30 21:27:32.0 535 Waypoint X 52.14722000 6.39720000 2020-03-30 21:27:32.0 2020-03-30 21:32:32.0 536 Waypoint Y 52.14670000 6.39139000 2020-03-30 21:32:32.0 2020-03-30 21:37:32.0 Is it possible to use an update querey to change only a part of a datetime stamp? See the colored examples shown below. 2020-03-30 20:37:32.0 2020-03-30 20:37:32.0 Thanks in advance for your help. Arjan
  2. Hi The guide on making a scrolling header is great, but it relies on javascript running every time you scroll. That is really expensive (resource-wise) and contributes to a laggy an unresponsive website. I think the guide should be updated to use sticky css-elements instead of js. This method does not have the same performance issues, and I'd argue it's an easier and more elegant solution. The new guide is pretty much already written here. The support for sticky elements is not perfect, so there is a discussion to be had about whether to prioritize browser support or performance, but i think at the very least the page should have a yellow box, mentioning that the sticky element is a better solution.
  3. I have a diagram representing a database and need to find a way to update a given table with respect to information about elements in that table. Here is the database design: https://i.stack.imgur.com/HR6q2.jpg I have a Playlist defined which is called "Frank's Stuff" which is owned by the Customer Frank Harris. The question is the following: Update the playlist "Frank's Stuff" as a function of the track duration. Display this playlist with the TrackID, Name and Milliseconds to verify. I've read that you cannot use an ORDER BY statement with and UPDATE statement unless it is enclosed in a SELECT statement. I'm not quite sure how to do all this though and would greatly appreciate some help. Thanks!
  4. Hi, I have a goDaddy account and I'm learning to import data. I've had success with a couple of uploads, but I get an error message and I don't understand what I need to do to get rid of it. My code is below, along with the error message I get and the excerpt from the mySQL documentation. Can anyone offer some advice about how to proceed and what may be the problem? The query works and updates the table with the info perfectly, but I think I should find out what this error is b/4 I incorporate into my website. Thanks a million! SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; CREATE TABLE IF NOT EXISTS `myUsers` ( `UserID` char(8) NOT NULL, `firstName` varchar(24) NOT NULL, `lastName` varchar(24) NOT NULL, `viewPref` varchar(16) NOT NULL, `pagePref` varchar(48) NOT NULL, PRIMARY KEY (`UserID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; INSERT INTO `myUsers` (`UserID`, `firstName`, `lastName`, `viewPref`, `pagePref`) VALUES ('sak20007', 'John', 'Smith', 'mobile_phone', 'about.html'); UPDATE; #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 Error: 1064 SQLSTATE: 42000 (ER_PARSE_ERROR) Message: %s near '%s' at line %d
  5. Hello, this post will contains some suggestions which have no link between them. -Firstly, i think it could be great to have something which allows us to follow news from w3schools "easily, something like a page where we could see the last update in a single line. example : 02/03/2018 Update "How to" section 01/30/2018 Add php tutorial (server side) In fact, the website become "big", then it could be an asset. -Secondly, i see more and more websites which have a functionnality to switch the theme (to a night theme) by clicking on one button (in their navbar) and the change is done on the whole website . This featur could get its place in "the How to" section. -To finish, this last idea is probably out of the main content of w3schools, but maybe Java could get its place like Node.js in the server side section although Java does not necessarily have this main purpose. (of course this add should only approach the server side).
  6. TULMER

    updatetext

    I need to update over 400 email address in a table in the database. I need to keep the first half of the email address and change everything after the '@' symbol. Example: FROM: john.doe@oldname.com -- TO: john.don@newcompanyname.com Is there any easy way?
  7. hello programmers am having an update issue and i dont know how to go about it am gonna try n explain it the way i can plz bear with me. i have a table called bids and two important column called bidder and tagged when (bidder 5) has no one to tag he simple drops a bid and when another bidder comes along(bidder 3) he tags (bidder 5) i want bidder 5 row to update showing (bidder 3)in his row. for example bidder 5 place bid it looks like this bidder tagged 5 0 no one to tag so it shows zero i want if bidder 5 get tagged by bidder 3 it update showing the person that tag bidder 5 and it will look like this bidder tagged 5 3 from the image i attached u can simply understand what am saying. looking forward to ur replies thanks code i am using to fill the form is below // tag someone $query = "SELECT b.*, u.nick FROM " . $DBPrefix . "bids b LEFT JOIN " . $DBPrefix . "users u ON (u.id = b.bidder) WHERE b.bidder NOT IN ('b.tagged') and b.tagged IN ('b.bidder') and b.auction = :auc_id "; $params = array(); $params[] = array(':auc_id', $id, 'int'); $db->query($query, $params); $i = 0; while ($row = $db->fetch()) { $template->assign_block_vars('tag_bidder', array( 'ID' => $row['bidder'], 'NAME' => $row['nick'], 'TAGGED' => $row['tagged'] )); $i++; }
  8. Hi,As the title said, i'm trying to update an SQL Server DB with php. From my code below, you can see that i call once a stored proc to get information who will be in a table. One of the row allow me (supposed to be)(the last row who is an input), to change an other one (row name GL). But with the button save, it seems like nothing change at all. I tried to make some log with console and i can see test1 and test2. So it seems like it can go throught but doesnt ajust anything. I really don't know anymore and i really need your help. Any ideas or help will be really really appreciate. More on that, i'm not sure if i do it well about sql injection... <?php if(isset($_POST["test"])) { $NewValue = $_POST["noGL" . $_POST["TLZno"]]; $TLZ = $_POST["TLZ"];?> <script> console.log ("test1"); </script> <?php $sql1 = "UpdateGL @CIE ='RAL', @TLZ='$TLZ', @NOGL='$NewValue'";?> <script> console.log ("test2"); </script> <?php } else { echo "Rien!"; } ?> <button class="btn btn-success btn-sm dropdown-toggle save" name='submit' id='submit' type="submit" value="Enregistrer"> <i class="fa fa-floppy-o fa-lg" aria-hidden="true"> Enregistrer</i> </button> <script> $(document).ready(function(){ $('.save').click(function(){ $('#GL_form').submit(); }); }); </script> </div><!-- Fin class pull-left--> <div class="panel panel-primary filterable"> <div class="panel-heading"> <h1 class="panel-title" style="font-weight:bold;">Liste des numéros de GL</h1> </div><!--Fin class panel-heading--> <div class="table-responsive"> <form id="GL_form" method="post" action="ListeGL.php"> <input type="hidden" id="test" name="test"/> <table id="employees" class="table table-highlight"> <thead> <tr class="filters" id="filters"> <th style="text-align: center;"># TLZ</th> <th style="text-align: left;">Description</th> <th style="text-align: center;">D/C</th> <th style="text-align: center;"># GL</th> <th style="text-align: left;">Nouveau # GL</th> </tr> </thead> <tbody> <?php $sql = "ListeGL"; $result = sqlsrv_query($conn, $sql); $row_count = sqlsrv_num_rows($result); while ($row = sqlsrv_fetch_array($result, SQLSRV_FETCH_ASSOC)) { //print_r( $row ); // debug code $couleur='black'; $font= 'normal'; $input="a"; if( strstr($row['HTML_CODE'], "BOLD()")){ $font= 'bold'; } if( strstr($row['HTML_CODE'], "BG()")){ $font2= '#D8D8D8'; } if( strstr($row['HTML_CODE'], "INPUT()")){ $input= 'input'; $font2= '#transparent'; } ?> <tr> <?php echo "<tr style=\"font-weight:$font; color:$couleur; background-color:$font2;\">"; ?> <td style="text-align: center;"><?php echo ($row['TLZno']); ?></td> <td style="text-align: left;"><?php echo ($row['TlzDescription']); ?></td> <td style="text-align: center;"><?php echo ($row['TlzType']); ?></td> <td style="text-align: center;"><?php echo ($row['noGL']); ?></td> <td style="font-weight: normal; text-align: left; color: #BDBDBD; "> <<?php echo $input . ' name="noGL' . $row['TLZno'] . '"'; ?> type="text" name="new" value="<?php echo ($row['noGL']); ?>" /> </td> </tr> <?php } ?> </tbody> </table> </form>
  9. Is it possible to update a prefix URL dynamically using Javascript? Looking to implement it in SharePoint 2013 Webpart.
  10. Its PHP MYSQL : I have a table prodt , in which i first INSERT a value and with its LAST INSERT ID i do update for MAX + 1 as below , BUT I AM GETTING ERROR You can't specify target table 'prodt' for update in FROM clause $a = db_insert_id(); $sqllast = "UPDATE prodt SET pdname= ((SELECT pdname FROM ( SELECT MAX( pdname ) AS pdname FROM prodt WHERE oid = ".db_escape($oid)." ) AS pdname ) + 1 ), pcyn = ".db_escape(0)." WHERE id = ".db_escape($a)." AND oid= ".db_escape($oid)." "; $resultsqllast = db_query($sqllast); if((!$resultsqllast) || (db_mysql_affected_rows($db) <= 0)) { throw new Exception('Wrong SQL UPDATE' . $sqllast . ' Error: '.db_error_msg($db) . db_error_no()); } After research i tried below : $sqllast = "UPDATE prodt SET pdname= ((SELECT pdname FROM ( SELECT MAX( pdname ) AS pdname FROM ( SELECT * FROM prodt WHERE oid = ".db_escape($oid)." )AS pdname ) AS pdname ) + 1 ), pcyn = ".db_escape(0)." WHERE id = ".db_escape($a)." AND oid= ".db_escape($oid)." "; $resultsqllast = db_query($sqllast); if((!$resultsqllast) || (db_mysql_affected_rows($db) <= 0)) { throw new Exception('Wrong SQL UPDATE' . $sqllast . ' Error: '.db_error_msg($db) . db_error_no()); } But still its not working, getting same error message ... Thanks
  11. Hi, I'm currently experiencing difficulties updating the database. I'm currently creating a 'Forgotten Password' feature. I've finished most of it, however when I attempt to update the database with a new password, nothing happens and the old password remains in the database. I've followed W3Schools example but I'm stuck. --------- The new password is generated by numbers 4 in total, ie $new_pass = (rand(1000,9999); and from the form I've used $user_email= $_POST["retrieve_email"]; then I use the line sql = "UPDATE registration SET Password=$new_pass WHERE Email=$user_email"; I can't get it to work, and I don't know why. Could anyone please write the code I need to make it work, or let me know how to proceed? Thank You. ps. I thought about deleting the entry and re-inserting it. Would that work (out of interest)?
  12. Dear all, i have been working in my college project and i reached a point were i can't get my cart orders into Order history, as it's not working and keep giving me the following error page, Error : INSERT INTO `cib4003_h00233671_at`.`orderhistory`(`order_id`, `Product_ID`, `Product_Name`, `client_ID`, `quantity`) VALUES ('', '', '', '2', ''); Duplicate entry '0' for key 'PRIMARY' ^ i checked the databse and all values are 0 except the Client_ID... thats why i am getting Duplicate entry, however, i tried to fix the problem for the past few hours and i can't find the issue, here my cart page code and here my history php where i do the insert part
  13. Nuimi

    SQL-UPDATE

    Can you help me with this update question. $db= new mysqli("localhost", "dany66", "*******", "mathstart"); $email_n = $_POST['email_n']; $vek_n = $_POST['vek_n']; $datum_n = $_POST['datum_n']; if(isset($email_n)) { $update1 = "UPDATE inf(email) SET email= '$email' WHERE jmeno = '" . $_SESSION['username'] . "'"; $pokus = $db -> query($update1); if(fetch_assoc($pokus) == TRUE) { echo("<script> alert('Řádek s e-mailem byl změněn.')</script>"); } }
  14. Nuimi

    SQL - Update

    Can you help me with sql, I need update form, but I don´t know how can I do it. $db= new mysqli("localhost", "dany66", "*******", "mathstart"); $email_n = $_POST['email_n']; $vek_n = $_POST['vek_n']; $datum_n = $_POST['datum_n']; if(isset($email_n)) { $update1 = "UPDATE inf(email) SET email= '$email' WHERE jmeno = '" . $_SESSION['username'] . "'"; $pokus = $db -> query($update1); if(fetch_assoc($pokus) == TRUE) { echo("<script> alert('Řádek s e-mailem byl změněn.')</script>"); } }
  15. Can anyone find the problem with my code? I have used this code to update a table of contact information in my database, but for some reason, this same structure doesn't work for updating a fee schedule table. I don't get any kind of error, it just won't update the table. echo '<form action=" " method="post">';echo '<table class="contactlist"><tr><caption>FEE SCHEDULE</caption></tr><tr><th>FOR:</th><th>TYPE<th>DESCRIPTION</th><th>AMOUNT</th><th>ORDER</th></tr>'; while ($rw = @mysql_fetch_array($rslt)) {echo '<input type="hidden" name="fee_id" value = "' . $rw['fee_id'] . '" />';echo '<tr><td><input type="text" name="fee_title" value = "' . $rw['fee_title'] . '" size="35" /></td>';echo '<td><input type="text" name="fee_name" rows="5" cols="20" value = "' . htmlspecialchars($rw['fee_name'], ENT_QUOTES, 'UTF-8') . '" size="30" /></td>';echo '<td><input type="text" name="fee_description" value = "' . htmlspecialchars($rw['fee_description'], ENT_QUOTES, 'UTF-8') . '" size="20" /></td>';echo '<td><input type="text" name="fee_amount" value="' . $rw['fee_amount'] . '" size="25" /></td>';echo '<td><input type="text" name="fee_order" value="' . $rw['fee_order'] . '" size="5" /></td>';echo '<td><input type="submit" name="action" value="Edit" /></td></tr>';echo '</form>';} echo '</table>'; if (isset($_POST['action']) and $_POST['action'] =='Edit'){ $fee_id = $_POST['fee_id']; $fee_title = $_POST['fee_title']; $fee_name = $_POST['fee_name'];$fee_description = $_POST['fee_description']; $fee_amount = $_POST['fee_amount']; $fee_order = $_POST['fee_order'];$fee_title= mysql_real_escape_string($fee_title);$fee_description= mysql_real_escape_string($fee_description); $fee_name= mysql_real_escape_string($fee_name);$fee_order= mysql_real_escape_string($fee_order);$sql = "UPDATE fee_schedule SET fee_id = '$fee_id', fee_title = '$fee_title', fee_name = '$fee_name', fee_description = '$fee_description', fee_amount = '$fee_amount', fee_order = '$fee_order' WHERE fee_id ='$fee_id'"; if (!@mysql_query($sql)) { echo '<p>Error updating fee schedule: ' . mysql_error() . '</p>'; exit(); } }
  16. Lets say i want to make it so the red spinning thing that is in the top right corner only appear if a person hasn't visited that picture link, and if i update something on the page you go to after you click the picture link the red spinning thing should reappear.. how do i do it? here is the site: http://itgwebb.se/klass/11d/dante/
  17. I have Table2 with a foreign key to Table1. I want to create a trigger that automatically update Table2 when Table1 is updated. Here is what's on my mind: create trigger MyTrigger on Table1 instead of update asif UPDATE(Table1_ID)begin declare @OldID as int, @NewID as int; select @OldID=P_ID from deleted; select @NewID=P_ID from inserted; update Table2 set Table1_ID=@NewID where Table2.Table1_ID=@OldID; update Table1 set Table1_ID=@NewID where Table1_ID=@OldID;end I received an error from SQL Server indicating that there was a conflict with the foreign key constraint when I tried to update a row. So I modified it a bit: create trigger MyTrigger on Table1 instead of update asif UPDATE(Table1_ID)begin declare @OldID as int, @NewID as int; select @OldID=P_ID from deleted; select @NewID=P_ID from inserted; update Table2 set Table1_ID=null where Table2.Table1_ID=@OldID; update Table1 set Table1_ID=@NewID where Table1_ID=@OldID; update Table2 set Table1_ID=@NewID where Table1_ID=null;end It does work. But pre-existing null values from Table2 are obviously lost if the trigger runs. What is the correct way to do this? Note that I already know of the cascading option when creating table. I just want to do it using trigger. Thanks. Note: I don't know how to loop through the inserted and deleted tables when multiple rows are updated. I'm assuming 1 row is updated at a time.
  18. Here is one of the simplest routines I have written--right? No, wrong. The script takes a table, folds, spindles, and mutilates it, and writes the data back to the table. Here's the code: $Quest = "SELECT * FROM TOAWorkorders";$FindTechResult = mysql_query($Quest, $cxn) or die ('The easter bunny is watching you' . mysql_error());while ($row = mysql_fetch_array($FindTechResult)){ $IdNum = $row['IdNum']; $BBT = $row['BBT']; $BBTArray = explode("-", $BBT); $TechNum = $BBTArray["0"]; $Title = $BBTArray["2"]; $Name = explode(" ", $BBTArray['1']); $FirstName = $Name["0"]; $LastName = $Name["1"]; echo $TechNum . ' !! ' . $FirstName . ' !! ' . $LastName . ' !! ' . $Title . '<br>'; $Quest = "UPDATE TOAWorkorders SET TechNum = '$TechNum', FirstName = '$FirstName', LastName = '$LastName', Title = '$Title' WHERE IdNum = '$IdNum'";$result = mysql_query($Quest, $cxn) or die(mysql_error()); } The problem with the script is the `UPDATE` statement. The field is processed correctly, but the update only updates 2/3 of the table, leaving 33k of rows untouched. Any ideas??
  19. When I try to run this update query in ms access 2007 I get an error box message that says "Data type mismatch in criteria expression". I know the problem is at the end around replace(property.[park city]," ","")=replace(locations2011.city," ",""). But I checked the data types for all the related columns, which is text, and they all match for both tables. If I put quotes around property.[park city] or remove the replace function from it, the query will run but obviously not how I want it to. I've tested this code with a smaller table and it works so what's the problem? UPDATE property, locations2011 SET property.county = locations2011.countyWHERE property.county Is Null And property.[park state]=locations2011.state And replace(property.[park city]," ","")=replace(locations2011.city," ",""); I know I can just remove all the spaces from the property table with ctrl+h replace all but I'd rather leave the data that's already there alone if possible.
  20. Hey .. I do multiple UPdate Data Like this but its still not work ,if I just do update for single tabel no problem its all run very well , what wrong with below code Thanks /*============ Koneksi To DB===========*///require_once'../../../inc/koneksi.php';/*============== Variabel Data Siswa================*/ $id = $_POST['id_user']; $nama = $_POST['nama']; $lahir = $_POST['tempat_lahir']; /*-------- Variabel untuk TBT-------------*///$tgl = $_POST['tgl']; $bulan = $_POST['bulan']; $tahun = $_POST['tahun']; $tbt = $_POST['tahun']."-".$_POST['bulan']."-".$_POST['tgl']; $agama = $_POST['agama'];$jenkel = $_POST['kelamin'];$nm_ortu = $_POST['nm_ortu'];$alamat = $_POST['alamat'];/*================ Variabel Lokal===========*/ $phobi = $_POST['phobi']; $cita = $_POST['cita'];$goll = $_POST['goll'];//Query Update Data$q = "UPDATE duser SET id_user='$id',nama='$nama',tempat_lahir='$lahir',tgl_lahir='$tbt',agama='$agama',jenkel='$jenkel',nm_ortu='$nm_ortu',alamat='$alamat' WHERE id_user ='$id'; UPDATE extrarull SET id_ex='$id',phobi='$phobi',cita='$cita',goll='$goll' WHERE id_ex = $id'";if ($dq = mysql_query($q)) {info_sukses("Sukses Update");}else{info_gagal("Gagal Update ");} This is example of DBso here I want change data for id_user (1001) at 2 table below so I do like above but is it still not run .. but if ijust do single update like this: //Query Update Data$q = "UPDATE duserSET id_user='$id',nama='$nama',tempat_lahir='$lahir',tgl_lahir='$tbt',agama='$agama',jenkel='$jenkel',nm_ortu='$nm_ortu',alamat='$alamat' WHERE id_user ='$id'";if ($dq = mysql_query($q)) {info_sukses("Sukses Update");}else{info_gagal("Gagal Update ");} all work very wellEX : Table duser+---------+--------+----------+---------------------+------------------+----------+------------- +------------------------------+| id_user | nama | tempat_lahir | tgl_lahir | agama | jenkel | nm_ortu | alamat |+---------+--------+----------+---------------------+-------------------+---------+------------- +------------------------------| 1001 | Anton | Padang Pas | 2001-11-12 | samawi | L | Jono w | Jl.tutun naik ptang no90 || 1020 | Alex | Jalan Lama | 1990-10-12 | duniawi | L | Bobo K | Jln majujalan no 99 |+---------+--------+----------+---------------------+-------------------+----------+-------------+----------------------------- EX : Table extrarull+---------+------------+--------------+---------------------+| id_ex | phobi | cita | goll |+---------+------------+--------------+---------------------+| 1001 | Lalok | pragamer | masih di utak | | 1020 | batang | developer | Baru sdangjalan | +---------+-----------+---------------+---------------------+ Thank for helpful
  21. I created a schedule that imports table data from MSaccess database to MySql database a XML file is automatically created. Now in the XML file the function updates data by automatically recreating the table. Is there any way to update the new data by not deleting the table?here is my code: <?xml version="1.0" encoding="UTF-8" ?>- <job version="8.1">- <odbcimport>- <source> <host>localhost</host> <user>root</user> <pwd>admin</pwd> <port>3306</port> <ssl>0</ssl> <sslauth>0</sslauth> <clientkey /> <clientcert /> <cacert /> <cipher /> <charset /> <database>main_data</database> </source>- <dsn type="access"> <name>E:\Main_Data.mdb</name> <user>admin</user> <pwd>pass</pwd> </dsn>- <import source="query"> <query>select * from "AC_Group"</query> <table>ac_group</table> </import> <export target="data" />- <tables all="no">- <table source="Result" target="ac_group" type="MyISAM" index="no" foreignkey="no"> <ddl onconflict="recreate" /> <dml import="yes" onconflict="update" />- <triggers> <delete>no</delete> </triggers>- <columns>- <column> <source>ID</source> <target>id</target> <type>int</type> <length>10</length> <default /> <primary>no</primary> <binary>no</binary> <notnull>yes</notnull> <unsigned>no</unsigned> <autoincr>no</autoincr> <zerofill>no</zerofill> </column>- <column> <source>Mach_No</source> <target>mach_no</target> <type>int</type> <length>10</length> <default /> <primary>no</primary> <binary>no</binary> <notnull>no</notnull> <unsigned>no</unsigned> <autoincr>no</autoincr> <zerofill>no</zerofill> </column>- <column> <source>Dept_Name</source> <target>dept_name</target> <type>varchar</type> <length>255</length> <default /> <primary>no</primary> <binary>no</binary> <notnull>no</notnull> <unsigned>no</unsigned> <autoincr>no</autoincr> <zerofill>no</zerofill> </column>- <column> <source>Group_No</source> <target>group_no</target> <type>int</type> <length>10</length> <default /> <primary>no</primary> <binary>no</binary> <notnull>no</notnull> <unsigned>no</unsigned> <autoincr>no</autoincr> <zerofill>no</zerofill> </column>- <column> <source>Group_Say</source> <target>group_say</target> <type>varchar</type> <length>200</length> <default /> <primary>no</primary> <binary>no</binary> <notnull>no</notnull> <unsigned>no</unsigned> <autoincr>no</autoincr> <zerofill>no</zerofill> </column>- <column> <source>Time_1</source> <target>time_1</target> <type>int</type> <length>10</length> <default /> <primary>no</primary> <binary>no</binary> <notnull>no</notnull> <unsigned>no</unsigned> <autoincr>no</autoincr> <zerofill>no</zerofill> </column>- <column> <source>Time_2</source> <target>time_2</target> <type>int</type> <length>10</length> <default /> <primary>no</primary> <binary>no</binary> <notnull>no</notnull> <unsigned>no</unsigned> <autoincr>no</autoincr> <zerofill>no</zerofill> </column>- <column> <source>Time_3</source> <target>time_3</target> <type>int</type> <length>10</length> <default /> <primary>no</primary> <binary>no</binary> <notnull>no</notnull> <unsigned>no</unsigned> <autoincr>no</autoincr> <zerofill>no</zerofill> </column>- <column> <source>Time_4</source> <target>time_4</target> <type>int</type> <length>10</length> <default /> <primary>no</primary> <binary>no</binary> <notnull>no</notnull> <unsigned>no</unsigned> <autoincr>no</autoincr> <zerofill>no</zerofill> </column>- <column> <source>Time_5</source> <target>time_5</target> <type>int</type> <length>10</length> <default /> <primary>no</primary> <binary>no</binary> <notnull>no</notnull> <unsigned>no</unsigned> <autoincr>no</autoincr> <zerofill>no</zerofill> </column> </columns> </table> </tables> <abortonerror>no</abortonerror> <sendreport send="no" /> </odbcimport> </job>
  22. Hi. Wonder if anyone can help. I have a page (which hopefully when finished) will allow a administration user to go in and update the availability of products. I have done a query first to pull the records from the SQL database, and have then used a loop to display the records in a table: @{ Layout="~/Shared/accountArea.cshtml"; Page.Title="Update Product Availability | Sarnies For All"; if (WebSecurity.IsAuthenticated == false) { Response.Redirect("~/"); } var db = Database.Open("sarniesForAllCurrent"); var extractBread = "SELECT * FROM bread ORDER BY breadId"; if (IsPost) { var sql = "UPDATE [bread] SET available = @0 WHERE @1 = @2"; foreach(var row in db.Query(extractBread)) { } }} <h1>Update Products</h1><p>Here are all the details which we hold on our system about you. Should any of these details change please update them as necessary and click on the Update button below.</p><form method="post" action=""> <table> <tr> <th>ID</th> <th>Description</th> <th>Available</th> <th>Price</th> </tr> @foreach(var row in db.Query(extractBread)) { <tr> <td>@row.breadId</td> <td>@row.breadDescription</td> <td><input type="text" name="@row.breadId" id="@row.breadId" value="@row.available" /></td> <td align="right">£@row.price</td> </tr> } </table> <input type="submit" value="Update" /></form> I am now at a loss at how to then input any changed values back into the SQL database. I have already used the SQL update record for my "Update Profile" page as that is for one record in my user table - but am unsure of the process/code to use to update multiple records at once using the above loop method. Thanks. Kevin
×
×
  • Create New...