RE: [PHP] passing mysql_error() out put to a different page?
| From: | Peter Houchin | Date: | Tue, 15 Oct 2002 03:43:49 +0000 |
| Subject: | RE: [PHP] passing mysql_error() out put to a different page? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-119981@lists.php.net to get a copy of this message | ||
I think that should work but for some reason nothing is getting written into
the session
function new_user() {
$res = mysql_query("INSERT INTO users WHERE uname='$_POST[uname]' ,
passwd='$_POST[pass]', firstname='$_POST[firstname]',
lastname='$_POST[lastname]', email='$_POST[email]',
company='$_POST[company]'")
//I get out put here in mysql_error() when uncommented
//or die (mysql_error());
//no output from mysql_error() in $_SESSION['mysqlerror'] when i call
$_SESSION['mysqlerror'] but does take the redirect
or die ($_SESSION['mysqlerror'] = mysql_error() && Header("Location:
logerror.php?op=insert_error"));
Header("Location: index.php");
}
here is the code am calling it with :
function insert_error()
{
echo "<div align=center> <font class=\"option\"> There was an error
<br><br>";
echo $_SESSION['mysqlerror'];
echo "</font></div>";
}
I have tripple checked that both pages have the session_start() on them
before any function is started.
any idea's?
> -----Original Message-----
> From: John W. Holmes [mailto:holmes072000@charter.net]
> Sent: Tuesday, 15 October 2002 11:21 AM
> To: 'Peter Houchin'; 'Brad Bonkoski'
> Cc: 'php_gen'
> Subject: RE: [PHP] passing mysql_error() out put to a different page?
>
>
> Maybe you should just save the error message into a cookie or session
> and then use header() to redirect to the error page.
>
> ---John Holmes...
>
> > -----Original Message-----
> > From: Peter Houchin [mailto:php@vfsa.com.au]
> > Sent: Monday, October 14, 2002 9:22 PM
> > To: Brad Bonkoski
> > Cc: php_gen
> > Subject: RE: [PHP] passing mysql_error() out put to a different page?
> >
> > i have tried this .. but am getting errors at the moment .. (the sql
> error
> > is deliberate)
> >
> > can figure out why.. but other wise i can't figure out how to pass the
> die
> > value through if i make the error redirect out side the die and have
> it
> >
>