Jump to content

Mysql procedure is not retaining changes


karnegyhall

Recommended Posts

I have a series of pages built with the php SESSION_ID() function.  I'm trying to determine why my changes are not being retained after I log in a seperate time. 

Below is my code, which gives users the ability to post pictures to the db, but after I log out and log back in with a different username, the pics are not retained. 

 

on the database side, i'm seeing all the rows in the tblathletepics being updated the same way, and with a new session id each time i log in.  i'm new at this.. help..

 

<?php
@require_once('sports-auth.php');




$conn = mysql_connect("host", "database", "password"); 

if (!$conn)
{
  die('Could not connect: ' . mysql_error());
}

$select = mysql_select_db('sportstalkadmin', $conn);

if (!$select)
{
  die('could not select db: sportstalkadmin ' . mysql_error());
}

$ID = $_SESSION['SESS_MEMBER_ID'];
$target = "upload/" . $_FILES["file"]["name"];


if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/JPG")
|| ($_FILES["file"]["type"] == "application/x-shockwave-flash/swf")
|| ($_FILES["file"]["type"] == "image/GIF")
|| ($_FILES["file"]["type"] == "image/pjpeg"))
&& ($_FILES["file"]["size"] < 20000000))
  {
  if ($_FILES["file"]["error"] > 0)
    {
    echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
    }
  else
    {
    echo "Upload: " . $_FILES["file"]["name"] . "<br />";
    echo "Type: " . $_FILES["file"]["type"] . "<br />";
    echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
    echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";

    if (file_exists("upload/" . $_FILES["file"]["name"]))
      {
      echo $_FILES["file"]["name"] . " already exists. ";
      }
    else
      {
      move_uploaded_file($_FILES["file"]["tmp_name"],
      "upload/" . $_FILES["file"]["name"]);
      echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
      }
    }
  }
else
  {
  echo "Invalid file";
  }



$targetSCS2 = mysql_query("UPDATE tblathletepics SET strPicPath='$target', intAtheleteID='$ID'");

if (!$targetSCS2)
{
die ('could not insert file' . mysql_error());
}

echo "$ID";

?>
<h1>Your File has been uploaded</h1><br />
<a href="sports-memberindex.php">Back to Your Profile</a>

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.