You are here: Home > Uncategorized > Get Ex Back Forum

Get Ex Back Forum




get ex back forum
What is the correct way to edit a database entry in PHP?

I fetch results with PHP by selecting a dates. I have a (lowerlimit) and (upperlimit). Ex.When i select Nov-2006, it displays all entries(journal) for the month of Nov in 2006 in a typical forum format.

I would like to add a tag at the top right of each result that comes back that would do the following. The a-href would direct the user to a different page say ‘editentry.php?y=2004&m=12&d=14 . At the top of editentry.php, id use _GET to fetch that particular entry and enter the results into a form. The form would be identical to the original form that was used to enter the information into it.

So the user would have all those entries fields in plain view. The auto-increment-primary key field and the date field would be viewable but not editable.

Anywho, at the bottom of editentry.php when all the changes are made, there would be a “submit changes” button and a “delete entry” button.

What would the mysql command be to
a)resubmit
b)delete

tyvm

Let’s assume you have a table with four columns: The uniqueid field, a datetime field called mydate, a text field called myname and a text field called mytext.

From your menu page, you would simply list off the records in a table. A column on the left would be the edit link column, and a column at the right would be the delete column.

'your connection info
$rs = mysql_query("SELECT * FROM mytable");

if(mysql_num_rows( $rs ) == 0) {
echo "No records";
}
else {
echo "

“;
echo “

“;
while($row = mysql_fetch_array($rs)) {
echo “

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;
}
echo “

Edit My Name My Date My Text Delete
Edit $row[myname] ” . date( ‘F j Y g:i a’, $row['mydate']) . “ $row[mytext] Delete

“;
}
?>

This code calls on two pages: edit.php or delete.php. It uses the uniqueid column to know which record to edit.

Let’s do delete.php first, because it’s quick and dirty. All we’ll do is run a SQL command to delete the record and kick the user back to the list page (which we’ll call list.php). We don’t need any HTML; just connect to the DB and let PHP do the work.

'your connection script

if(!isset($_GET['id'])) {
header('Location: list.php');
}
else {
$sql = "DELETE FROM mytable WHERE uniqueid = $_GET[id]";
$rs = mysql_query($sql);
header('Location: list.php');
}
?>

Edit.php is a bit more complicated. We need to both get the current record, so we have something to edit, and update the record. We first check for page postback; if it is set, we go ahead and update the record. Then, we get a recordset corresponding to the same ID, and populate the form fields with the data:

'your connection info

if(!isset($_GET['id'])) {
header('Location: list.php');
}

if(isset($_POST['submit'])) {
$sql = "UPDATE mytable SET myname = '$_POST[myname]', mydate = $_POST[mydate], mytext = '$_POST[mytext]' WHERE uniqueid = $_GET[id]";
$rs = mysql_query($sql);
}
$sql = "SELECT * FROM mytable WHERE uniqueid = $_GET[id]";
$rs = mysql_query($sql);
$row = mysql_fetch_array($rs);
?>


Record ID:
My Name:


Note that this code is not very secure and does not trap for errors. It’s just illustrative. It works but it’s not ready for prime time.


Forum Novelties 63503 Amazing Gag Shock Lighter


Forum Novelties 63503 Amazing Gag Shock Lighter


$0.25


It may look like a regular lighter, but press the button to try and light it and you will find out quickly this is not your average flame lighter! This novelty, gag gift lighter delivers a quick shock to the person trying to ignite the lighter which startles more than actually hurts. This is intended as a simple, funny and harmless practical joke. It is hysterically funny for the giver and anyone …

ASUS A52F-X3 15.6-Inch Laptop (Black)


ASUS A52F-X3 15.6-Inch Laptop (Black)


$629.00


Get Started with Capable Graphics and Communications Tools The 15.6-inch, HD-ready A52F-X3 notebook is a versatile notebook with a scratch-resistant infusion design so it stays new-looking day after day, and includes a host of convenient features that all translate into an incredible value. You’ll experience a new level of multitasking performance powered by the Intel Core i3 processor that…
eBay Logo  

GetExBak.info Membership Access 50% Off - Get Your Ex Back / Save Your Marriage!


GetExBak.info Membership Access 50% Off – Get Your Ex Back / Save Your Marriage!


$4.00


GetExBak.info Membership Access 50% Off - Get Your Ex Back / Save Your Marriage!


GetExBak.info Membership Access 50% Off – Get Your Ex Back / Save Your Marriage!


$3.99


GetExBak.info Membership Access 50% Off - Get Your Ex Back / Save Your Marriage!


GetExBak.info Membership Access 50% Off – Get Your Ex Back / Save Your Marriage!


$5.00


GetExBak.info Membership Access 50% Off - Get Your Ex Back / Save Your Marriage!


GetExBak.info Membership Access 50% Off – Get Your Ex Back / Save Your Marriage!


$3.99


Young Bucks - Get Your Feet Back On The Ground - 7


Young Bucks – Get Your Feet Back On The Ground – 7″ 1976 – Ex


$1.58


GET YOUR EX BACK*HOW TO GET BACK YOUR EX PARTNER TODAY! STEP-BY-STEP GUIDE ON CD


GET YOUR EX BACK*HOW TO GET BACK YOUR EX PARTNER TODAY! STEP-BY-STEP GUIDE ON CD


$4.27


THREE DEGREES get your love back 7


THREE DEGREES get your love back 7″ WS EX/ philly soul


$11.06


Joe Thomas  Make Your Move / Get on Back  12


Joe Thomas Make Your Move / Get on Back 12″ Ex – TK Disco 1979


$9.95


HOW TO GET BACK WITH YOUR EX ~WHAT YOU CAN DO TO MAKE IT HAPPEN ~PLUS A FREE MP3


HOW TO GET BACK WITH YOUR EX ~WHAT YOU CAN DO TO MAKE IT HAPPEN ~PLUS A FREE MP3


$11.06


Ex love return spell-extremely powerful- GET YOUR EX BACK NOW! BLACK MAGICK


Ex love return spell-extremely powerful- GET YOUR EX BACK NOW! BLACK MAGICK


$80.00

Tags: , , , , , ,

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • Twitter
  • RSS

Comments are closed.