Web Analytics Made Easy -
StatCounter Edit Row information in Mysql once ID (auto incremented is known) - CodingForum

Announcement

Collapse
No announcement yet.

Edit Row information in Mysql once ID (auto incremented is known)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Edit Row information in Mysql once ID (auto incremented is known)

    Hello to all, my first post. New to Php & Mysql 2 months.
    Perhaps my old brain missing the obvious here, been at it a week.
    Here is the problem

    Converted a Access table to Mysql.(Member Info) One auto incremented ID field plus 9 text fields. (Member not for profit site)
    What is working is Add member & View members by criteria. I need to allow members to edit their own details. By using the View facility they can ascertain their auto incremented ID. I then want to use this to retrieve their data & then be able to edit it and update the entry.

    Tried many suggestions so far all of which I cant get to work. The problem is probably 15 inches from the screen but there it is.

    Bifon

  • #2
    you'll have to be more clear as to what the problem is. Are you having trouble with the PHP code or the mysql code? if the mysql code, are you having trouble with an update, or a join to show you the related information?

    Can you show us your table layout so we can see what you are working with?

    Some more detail will help us to help you.

    Comment


    • #3
      Originally posted by guelphdad View Post
      you'll have to be more clear as to what the problem is. Are you having trouble with the PHP code or the mysql code? if the mysql code, are you having trouble with an update, or a join to show you the related information?

      Can you show us your table layout so we can see what you are working with?

      Some more detail will help us to help you.
      Thanks in advance quelphdad.

      Each entry has a unique ID (auto incremented) below is what is used to add a new member to the db and works fine: I need to be able to edit these entrys using the ID to locate the correct entry: Each member is able to locate their unique Id by another script that returns all members for the Sqn. It also works fine.

      <? include "inc_header.php"; ?>
      <?
      if(!isset($ends_design_add_go)) {
      echo "<p><b>Add New Record to Database</b></p><p>";
      echo "<p><b>Mandatory fields are: First Surname appysqn</b></p><p>";
      ?>
      <form method="post" action="allappysqnsadd.php" name="addForm" enctype="multipart/form-data">
      <table border="1" cellpadding="2" cellspacing="2">
      <input type="hidden" name="ID" value="">
      <tr><td>First</td><td><input type="text" name="First" class="" value=""></td></tr>
      <tr><td>Surname</td><td><input type="text" name="Surname" class="" value=""></td></tr>
      <tr><td>Address</td><td><input type="text" name="Address" class="" value=""></td></tr>
      <tr><td>Suburb</td><td><input type="text" name="Suburb" class="" value=""></td></tr>
      <tr><td>Pcode</td><td><input type="text" name="Pcode" class="" value=""></td></tr>
      <tr><td>Phone</td><td><input type="text" name="Phone" class="" value=""></td></tr>
      <tr><td>Mobile</td><td><input type="text" name="Mobile" class="" value=""></td></tr>
      <tr><td>Email</td><td><input type="text" name="Email" class="" value=""></td></tr>
      <tr><td>appysqn</td><td><select name="appysqn" class=""><option value="1Sqn" >1Sqn
      </option>
      <option value="2Sqn" >2Sqn
      </option>
      <option value="3Sqn" >3Sqn
      </option>
      <option value="4Sqn" >4Sqn
      </option>
      <option value="5Sqn" >5Sqn
      </option>
      <option value="5RSqn" >5RSqn
      </option>
      <option value="6Sqn" >6Sqn
      </option>
      <option value="7Sqn" >7Sqn
      </option>
      <option value="8Sqn" >8Sqn
      </option>
      <option value="9Sqn" >9Sqn
      </option>
      <option value="10Sqn" >10Sqn
      </option>
      <option value="11Sqn" >11Sqn
      </option>
      <option value="12Sqn" >12Sqn
      </option>
      <option value="13Sqn" >13Sqn
      </option>
      <option value="13RSqn" >13RSqn
      </option>
      <option value="14Sqn" >14Sqn
      </option>
      <option value="15Sqn" >15Sqn
      </option>
      <option value="16Sqn" >16Sqn
      </option>
      <option value="17Sqn" >17Sqn
      </option>
      <option value="18Sqn" >18Sqn
      </option>
      <option value="19Sqn" >19Sqn
      </option>
      <option value="20Sqn" >20Sqn
      </option>
      <option value="21Sqn" >21Sqn
      </option>
      <option value="22Sqn" >22Sqn
      </option>
      <option value="23Sqn" >23Sqn
      </option>
      <option value="24Sqn" >24Sqn
      </option>
      <option value="25Sqn" >25Sqn
      </option>
      <option value="26Sqn" >26Sqn
      </option>
      <option value="27Sqn" >27Sqn
      </option>
      <option value="28Sqn" >28Sqn
      </option>
      <option value="29Sqn" >29Sqn
      </option>
      <option value="30Sqn" >30Sqn
      </option>
      <option value="31Sqn" >31Sqn
      </option>
      <option value="32Sqn" >32Sqn
      </option>
      <option value="33Sqn" >33Sqn
      </option>
      <option value="34Sqn" >34Sqn
      </option>
      <option value="35Sqn" >35Sqn
      </option>
      <option value="36Sqn" >36Sqn
      </option>
      <option value="37Sqn" >37Sqn
      </option>
      <option value="38Sqn" >38Sqn
      </option>
      <option value="39Sqn" >39Sqn
      </option>
      <option value="40Sqn" >40Sqn
      </option>
      <option value="41Sqn" >41Sqn
      </option>
      <option value="42Sqn" >42Sqn
      </option>
      <option value="43Sqn" >43Sqn
      </option>
      <option value="44Sqn" >44Sqn
      </option>
      <option value="Pioneers" >Pioneers
      </option>
      <option value="Cherubs" >Cherubs
      </option>
      <option value="Beadsmen" >Beadsmen
      </option>
      <option value="Orts" >Orts
      </option>
      <option value="Acolytes" >Acolytes
      </option>
      <option value="Rubetas" >Rubetas
      </option>
      <option value="Dryads" >Dryads
      </option>
      <option value="Serfs" >Serfs
      </option>
      <option value="Excors" >Excors
      </option>
      <option value="Lemmings" >Lemmings</option>
      </select></td></tr>
      <tr><td>&nbsp;</td><td><input type="hidden" name="ends_design_add_go" value="TRUE"><input type="submit" value="Add Record"></td></tr>

      <?
      echo "</table>";
      } else {


      $ID = addslashes($ID);
      $First = addslashes($First);
      $Surname = addslashes($Surname);
      $Address = addslashes($Address);
      $Suburb = addslashes($Suburb);
      $Pcode = addslashes($Pcode);
      $Phone = addslashes($Phone);
      $Mobile = addslashes($Mobile);
      $Email = addslashes($Email);
      $appysqn = addslashes($appysqn);

      $MYSQLCONN = mysql_connect("localhost","allappys_xxxxx","xxxxx") or die("<b>Error connecting to mySQL database.</b><br><br>Please try again later.");
      mysql_select_db("allappys_xxxx",$MYSQLCONN) or die("<b>Database 'allappys_joom1' could not be found.</b><br><br>Script execution terminating.");
      $query = "INSERT INTO `allappysqns` (`ID`,`First`,`Surname`,`Address`,`Suburb`,`Pcode`,`Phone`,`Mobile`,`Email`,`appysqn`) VALUES ('$ID','$First','$Surname','$Address','$Suburb','$Pcode','$Phone','$Mobile','$Email','$appysqn')";
      if(!mysql_query($query)) {
      echo "Insertion into database failed.";
      } else {
      echo "Insertion into database was successful.";
      }
      echo "<br><br><a href=allappysqnsadd.php><font color=#FFFFFF>Back</font></a>";
      }
      ?>
      <? include "inc_footer.php"; ?>

      Thanks again for looking.

      Bifon
      Last edited by bifon1; Oct 8, 2006, 03:00 AM.

      Comment

      Working...
      X