Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP/MYSQL Retain Variable after INSERT

Status
Not open for further replies.

tanaka99

MIS
Feb 25, 2002
9
US
I am using this page (insert.php) to insert data via a form into MYSQL:

<HTML>
<HEAD><TITLE>INSERT Data via PHP</TITLE></HEAD><BODY>
<?PHP

$connection=mysql_connect(&quot;localhost&quot;,&quot;username&quot;,&quot;userpass&quot;) or die('Could not connect to the database server');
$db = mysql_select_db(&quot;blah_blah&quot;, $connection) or die (&quot;Unable to select database.&quot;);
$sql = &quot;insert into Dealers (UserID, DlrName, DlrAddress, DlrCity, DlrState, DlrZip, DlrPhone, DlrType, DlrEmail, DlrWeb, DlrPass, DlrAccess, DlrNumber, DlrDist) Values ('$AddID', '$AddName', '$AddAddress', '$AddCity', '$AddState', '$AddZip', '$AddPhone', '$AddType', '$AddEmail', '$AddWeb', '$AddPass', '$AddAccess', '$AddNumber', '$AddDist')&quot;;
$sql_result = mysql_query($sql,$connection) or die ('Could not insert data');
echo(&quot;<table border=\&quot;0\&quot; width=\&quot;760\&quot; height=\&quot;300\&quot; background=\&quot;images/common/logoback.jpg\&quot;> <tr><td align=\&quot;center\&quot; valign=\&quot;middle\&quot;><font face=\&quot;verdana,arial\&quot; size=\&quot;3\&quot;><b>User has been added to the database. </b></font><font face=\&quot;verdana,arial\&quot; size=\&quot;2\&quot;><br><br>Click <a href=\&quot; to return to the Partner Area Home Page.</td></tr></table>&quot;);

?>

</BODY>
</HTML>

I want the link back to the Partner Area Home page to ... take me back to the home page, and retain the original user's access code to allow access. Here is the Partner Area Home Page PHP:

<?php

include(&quot;dbinfo.inc.php&quot;);


mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( &quot;Unable to select database&quot;);

$sql = &quot;SELECT *
FROM Dealers
WHERE UserID='$user' and DlrPass='$pass'&quot;;


$result = mysql_query($sql)
or die (&quot;Unable to get results.&quot;);

$num = mysql_numrows($result)
or die (&quot;You're not authorized to be here. If you feel you have recieved this
message in error, please contact <a
href=\&quot;mailto:custsvc@tanaka-ism.com\&quot;>Customer Service</a>&quot;);

$i=0;
while ($i < $num) {

session_register(&quot;UserID&quot;);
$UserID=mysql_result($result,$i,&quot;UserID&quot;);
session_register(&quot;DlrName&quot;);
$DlrName=mysql_result($result,$i,&quot;DlrName&quot;);
session_register(&quot;DlrAddress&quot;);
$DlrAddress=mysql_result($result,$i,&quot;DlrAddress&quot;);
session_register(&quot;DlrCity&quot;);
$DlrCity=mysql_result($result,$i,&quot;DlrCity&quot;);
session_register(&quot;DlrState&quot;);
$DlrState=mysql_result($result,$i,&quot;DlrState&quot;);
session_register(&quot;DlrZip&quot;);
$DlrZip=mysql_result($result,$i,&quot;DlrZip&quot;);
session_register(&quot;DlrPhone&quot;);
$DlrPhone=mysql_result($result,$i,&quot;DlrPhone&quot;);
session_register(&quot;DlrType&quot;);
$DlrType=mysql_result($result,$i,&quot;DlrType&quot;);
session_register(&quot;DlrEmail&quot;);
$DlrEmail=mysql_result($result,$i,&quot;DlrEmail&quot;);
session_register(&quot;DlrWeb&quot;);
$DlrWeb=mysql_result($result,$i,&quot;DlrWeb&quot;);
session_register(&quot;DlrPass&quot;);
$DlrPass=mysql_result($result,$i,&quot;DlrPass&quot;);
session_register(&quot;DlrAccess&quot;);
$DlrAccess=mysql_result($result,$i,&quot;DlrAccess&quot;);
session_register(&quot;DlrNumber&quot;);
$DlrNumber=mysql_result($result,$i,&quot;DlrNumber&quot;);
session_register(&quot;DlrDist&quot;);
$DlrDist=mysql_result($result,$i,&quot;DlrDist&quot;);



++$i;
}

$temp = $DlrAccess;
?>

Please Help!!!! I keep getting the 'You are not authorized to be here' error.
 
OMFG!!! Name calling while seeking help .. interesting.
Personally speaking, tanaka99, I'd suggest you read up on manners and netiquette sometime damn soon and come back with 2 things:
1) apologies for people trying to help you.
2) a clearer explanation of what you are trying to achieve and what is not happening correctly.

//Karv.

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Been a while Bro, just thought I'd stop by and see whats going down, hope you and the boys are all well :)

//karv

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Probably :)

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top