Jump to content

MySQL connection persisting redirect?


monkey_05_06

Recommended Posts

I'm working on a script where I would like a MySQL link identifier to persist over a redirect to another URL. I've tried using session variables to persist the identifier:

 

<?php
  session_start();
  $conn = @mysql_connect("localhost", "username", "pass");
  $_SESSION["conn"] = $conn;
  header("Location: $url");
  ?>

 

The variable persists the redirect, but the identifier seems to be getting modified. I know for a fact that it is a valid MySQL link identifier prior to the redirect, however after the redirect it is invalid. Is there any explanation for this???

Link to comment
https://forums.phpfreaks.com/topic/47357-mysql-connection-persisting-redirect/
Share on other sites

Because it's 3:15 AM [here]. The more important question is why I would be awake. I guess I just figured it would be easier for me to keep the connection open than having to reopen it. I've got all the pertinent data regarding connecting to MySQL available to both pages...it was really just a matter of lack of experience with PHP...and being extremely tired. I understand now why that line of thinking doesn't really make sense.

Archived

This topic is now archived and is closed to further replies.

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