Jump to content

show only the ID chosen from DB?


derrick1123

Recommended Posts

I need to get them to get the ID I want from the database so I can update that row only.

<?php
include("db_settings.php");
$id = $_POST['id'];
$step = $_POST['step'];
$name = $_POST['name'];
$msg = $_POST['msg'];
$email = $_POST['email'];
$website = $_POST['website'];
$time = time();
$result = mysql_query("SELECT * FROM remember");

	if($step==0 || $step==""){
			echo "Choose your id";

			echo "<form method='POST' action='update.php'>";
			echo "<input type='hidden' value='1' name='step'>";
			echo "ID #:<input type='text' name='id' size=30><br>";
			echo "<input type='submit' value='Update Memo'>";
			echo "</form>";
while($row = mysql_fetch_array($result))
  {
  $name = $row['name'];
  $email = $row['website'];
  $msg = $row['msg'];
		if($step==1){
			//show input
			echo "<b>Remember Information:<br></b>"; 

			//form
			echo "<form method='POST' action='update.php'>";
			echo "<input type='hidden' value='2' name='step'>";
			echo "A Name:<input type='text' name='name' value='$name' size=30><b>*</b><br>";
			echo "An Email:<input type='text' name='email' value='$email' size=30><br>";
			echo "A Website:<input type='text' name='website' value='$website' size=30><br>";
			echo "Memo:<br><textarea cols='30' rows='6' name='msg' wrapping='virtual'>$msg</textarea><b>*</b><br>";
			echo "<input type='submit' value='Update Memo'>";
			echo "</form>";
			echo "* required";
			echo "<br><br><br>Created by <a href='http://smfhost.info'>derrick1123</a>";
		}
	}
	if($step==2){
				//show the thumbs up
				$q = "UPDATE remember SET msg=$msg, name=$name, email=$email, website=$website, time=$time WHERE id=$id";
				$go = mysql_query($q);

				if(!$go){
				echo "SHIT!!! Something went wrong.";
				echo "<br><br><br>Created by <a href='http://smfhost.info'>derrick1123</a>";
				} else {
				echo "YAY!!! Your message got updated!";
				echo "<br><br><br>Created by <a href='http://smfhost.info'>derrick1123</a>";
				}
		}
	}
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.