karnegyhall Posted June 13, 2009 Share Posted June 13, 2009 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> Quote Link to comment https://forums.phpfreaks.com/topic/162071-mysql-procedure-is-not-retaining-changes/ Share on other sites More sharing options...
fenway Posted June 15, 2009 Share Posted June 15, 2009 We don't need all the code... just the db statements. You're running an update statement without a where clause! Quote Link to comment https://forums.phpfreaks.com/topic/162071-mysql-procedure-is-not-retaining-changes/#findComment-856471 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.