The code for updating the database with any story editing and added comments
is:
// processed when form is submitted back onto itself
if ($REQUEST_METHOD=="POST")


# setup SQL statement
$SQL = " UPDATE $tablename1 SET";
$SQL = $SQL . " date = '$date',";
$SQL = $SQL . " name = '$name', ";
$SQL = $SQL . " teach = '$teach', ";
$SQL = $SQL . " email = '$email', ";
$SQL = $SQL . " title = '$title', ";
$SQL = $SQL . " story = '$story', ";
$SQL = $SQL . " comments = '$comments', ";
$SQL = $SQL . " approved = 'Y' ";
$SQL = $SQL . " WHERE id = $id ";

// execute SQL statement
$result = mysql_db_query($dbname,"$SQL",$link);

// check for errors
if (!$result) { echo("ERROR: " . mysql_error() . "\n$SQL\n"); }

echo ("<P><B> Link Updated</B></P>\n");?>

<FORM METHOD="link" ACTION="feedback.php?<?'id=$id'?>">
 <INPUT TYPE="submit" VALUE="Email Comments">
<?
}
else { # display edit form (not post method)


// setup SQL statement to retrieve link that we want to edit
$SQL = " SELECT * FROM $tablename1 ";
$SQL = $SQL . " WHERE id = $id ";

# execute SQL statement
$ret = mysql_db_query($dbname,$SQL,$link);

//  retrieve values
$row = mysql_fetch_array($ret);
$name = $row["name"];
$date = $row["date"];
$teach = $row["teach"];
$email = $row["email"];
$title = $row["title"];
$story = $row["story"];
$comments = $row["comments"];
$approved = $row["approved"];

The button "Email Comments" links to the following page:

<?include ("../config.inc.php"); ?>

<?php

// setup SQL statement to retrieve link that we want to edit
$SQL = " SELECT * FROM $tablename1 ";
$SQL = $SQL . " WHERE id = $id ";

// execute SQL statement
$ret = mysql_db_query($dbname,$SQL,$link);

// retrieve values
$row = mysql_fetch_array($ret);
$email = $row["email"];
$title = $row["title"];
$comments = $row["comments"];
$title = $row["title"];

  else {echo(mysql_error());

I get an error at $row = mysql_fetch_array($ret);


--
Alex Francis
Cameron Design
35, Drumillan Hill
Greenock PA16 0XD

Tel 01475 798106
[EMAIL PROTECTED]
http://www.camerondesign.co.uk

This message is sent in confidence for the addressee only. It may contain
legally privileged information.
Unauthorised recipients are requested to preserve this confidentiality and
to advise the sender
immediately of any error in transmission.
Jason Wong <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> On Monday 22 April 2002 18:05, Alex Francis wrote:
> > I am trying to pass an ID to a third page as follows:
> > I have a list of stories to be checked and edited. When one is selected
it
> > is passed to a detail page and is edited and comments are added before
> > posting the edit form back to itself to update the database. At this
stage
> > I would like to give tthe opportunity to email the comments back to the
> > writer. I am having difficulty passing on the ID of the story to the
> > feedback page. Can someone help please.
>
> What is the difficulty you're having?
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
>
> /*
> Keep the phase, baby.
> */



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to