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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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