Jump to content

[SOLVED] Adding something to a DB the ID being a session name


jonoc33

Recommended Posts

Hey guys

 

<?php
$con = mysql_connect("localhost","jonoc33","***");
if (!$con)
  die('Could not connect: ' . mysql_error());
mysql_select_db("revolutiongamerz_net_-_clansolutions", $con);
$sql="INSERT INTO emails (accid, email, redirectto, activated)
VALUES ('" . $_POST["accid"] . "','" . $_POST["q1_E-mail"] . "','" . $_POST["q9_Redirectto"] . "','0')";
$rs = mysql_query($sql) or die ("Problem with the query: $sql <br>" . mysql_error);
echo "<center>Email added.";
echo "<center><a href=emails.php>Back</a>";
?> 

 

This is my code for adding something to a database. Note $_POST accid.

 

On the previous page I have a hidden field called accid. In it, I need to display a session name that I am using for a login system.

 

The session name is client_id.

 

<input name="accid" type="hidden" class="text " id="accid" value="" size="20"  />

 

What would I add in value="" to make this work?

Awesome, that worked.

 

Now how exactly would I display that? This is what I put.

 

<?

include("inc/dbconnect.php");

 

$results = mysql_query("SELECT email, redirectto, activated FROM emails WHERE accid = "$HTTP_SESSION_VARS['client_id']"");

while($values = mysql_fetch_array($results)){

    echo $values['email']." redirects to ".$values['redirectto']."<br />";

echo $values['activated'] != 1 ? "Not Activated" : "Activated";

echo "<p>";

}

?>

That didn't work. Seems to appear right through the word colouring though.

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.