Jump to content

dvent

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

dvent's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. UPDATE test SET '' = '' WHERE '[tenID]' = 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 ''' = '' WHERE '[tenID]' =' at line 1
  2. [tenID] is the name of my ID column in the test table. So basically what I'm trying to say it put the $value into the $column when the tenID is the same as the $id captured
  3. I've got this: mysql_query("UPDATE test SET $column = $value WHERE [tenID] = $id" ) or die(mysql_error()); But get the following error: 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 '= value WHERE [tenID] =' at line 1 Thoughts please?
  4. Yes I have a MySQL server, Yes I can connect to it and Yes I can send from a form. I have done those three things literally once though for a specific example, so tweaking and changing is what I need to do here - hence asking for help. I would like the data to go into the table in the background. Dave
  5. Hi All, I have a table (with an ID of example) that can be seen here: http://tinyurl.com/cfla7wp The following script calls jeditable.js and makes the Telephone & Mobile columns editable. Once edited, the table shows the new value plus a * symbol. <script type="text/javascript"> $(document).ready(function() { /* Init DataTables */ var oTable = $('#example').dataTable(); /* Apply the jEditable handlers to the table */ $('td:eq(4), td:eq(5)', oTable.fnGetNodes()).editable( 'update_table_tenants.php', { "callback": function( sValue, y ) { var aPos = oTable.fnGetPosition( this ); oTable.fnUpdate( sValue, aPos[0], aPos[1] ); }, "submitdata": function ( value, settings ) { return { "row_id": this.parentNode.getAttribute("1"), "column": oTable.fnGetPosition( this )[2] }; }, "height": "14px" } ); } ); </script> What I need to do however is add the value entered into my database, but I do not know how to do this. I believe I need to do something like: UPDATE my_table VALUE whatever column has been edited in the table WHERE tenID is the same as the row selected in the table i.e. if I update the MOBILE NUMBER of the person called BILL GATES it would find his tenID, update numMobile in the table called my_table All help appreciated Dave
  6. Aha! Forgot to change the table name. Cheers dcro2!!
  7. Getting an error on submit: Error: 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 'table (`tenForename`, `tenSurname`, `tenSuitablePostcodes`) VALUES ('1', '1111',' at line 1
  8. Sorry to be completely thick, but where does this bit go? dvent
  9. Thanks for the replies. I've added my example table here: http://bit.ly/Hslw4X You'll see the box asking for suitable postcodes. That is built using the following code: <div class="mws-form-row"> <label>Suitable Postcodes</label> <div class="mws-form-item large"> <div class="mws-dualbox clearfix"> <div class="mws-dualbox-col1"> <div class="mws-dualbox-filter clearfix"> <label for="box1Filter">Filter</label> <input type="text" id="box1Filter" class="mws-textinput" /> <button type="button" id="box1Clear">CLEAR</button> </div> <select id="box1View" multiple="multiple" size="3"> <option value="1">Code 1</option> <option value="2">Code 2</option> <option value="3">Code 3</option> </select> <span id="box1Counter" class="countLabel"></span> <select id="box1Storage"></select> </div> <div class="mws-dualbox-col2"> <button id="to2" type="button">></button> <button id="allTo2" type="button">>></button> <div class="clear"></div> <button id="allTo1" type="button"><<</button> <button id="to1" type="button"><</button> </div> <div class="mws-dualbox-col3"> <div class="mws-dualbox-filter clearfix"> <label for="box2Filter">Filter</label> <input type="text" id="box2Filter" class="mws-textinput" /> <button type="button" id="box2Clear">CLEAR</button> </div> <select id="box2View" multiple="multiple" size="3" name="tenSuitablePostcodes"></select> <span id="box2Counter" class="countLabel"></span> <select id="box2Storage"></select> </div> </div> </div> </div> My three values are defined in this bit: <select id="box1View" multiple="multiple" size="3"> <option value="1">Code 1</option> <option value="2">Code 2</option> <option value="3">Code 3</option> </select> How can I put these into your example and post them to the DB, separated by a comma? Thanks dvent
  10. Hi All, I'm very new to PHP so please bear with me. I have created a form with 3 fields. One field is a multi select / checkbox with the name 'tenCode'. How do I get all of the values selected from this box and add them to my database? My submission code (submit.php) <?php $con = mysql_connect("localhost","dbname","dbpassword"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("dbname", $con); $sql="INSERT INTO tablename (tenFirst,tenPhone,tenID) VALUES ('$_POST[tenFirst]','$_POST[tenPhone]','$_POST[tenID]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "Adding Ten. The page will refresh in 5 seconds."; echo "<meta http-equiv='Refresh' content='5; URL=nextpage.php'/>"; mysql_close($con) ?> Thanks dvent
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.