Aureole Posted August 16, 2007 Share Posted August 16, 2007 I hate MYSQL. Here's the query... <?php $query = mysql_query("UPDATE gs_mem SET mem_avx='$extension' WHERE mem_id='$whichid'"); $result = mysql_query($query) or die(mysql_error()); ?> Here's the file it is from... <?php session_start(); include("connect.php"); include("functions.php"); $whichid = $_SESSION['mem_id']; // the code below is just a quick webpage, don't use it for proper thing if (!$_FILES['file_loc']) die('<html><head><title><body><p>Upload a <i>.jpg/.gif/.png/.bmp</i> image for your avatar:</p><form enctype="multipart/form-data" method="post" action=""><input type="file" name="file_loc" /><br><input type="submit" value="Upload Avatar" /></form></body></html>'); // the PHP below is to process the form. copy and paste it where it's needed if ($_FILES['file_loc']['size'] <= 200000) { $file_type_arr = explode(".", $_FILES['file_loc']['name']); $extension = $file_type_arr[1]; $file_types = array("jpg","jpeg","gif","png","bmp"); if (array_search($extension, $file_types) != "") { if (move_uploaded_file($_FILES['file_loc']['tmp_name'], 'img/avatars/'.substr($_SESSION['mem_id'],0,1).'/'.$_SESSION['mem_id'].'.'.$extension)) { print 'Extension: '.$extension.'<br />'; print 'File size: '.$_FILES['file_loc']['size'].'<br />'; print 'File type: '.$_FILES['file_loc']['type'].'<br />'; print 'File was uploaded successfully. Click here to view it <a href="'.$new_loc.'" target="_blank">'.$new_loc.'</a>'; $query = mysql_query("UPDATE gs_mem SET mem_avx='$extension' WHERE mem_id='$whichid'"); $result = mysql_query($query) or die(mysql_error()); } else print "Error uploading image!"; } else print "Invalid image type! (".$extension."!)"; } else print "Invalid file size!"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/65170-solved-mysql-problem-again/ Share on other sites More sharing options...
trq Posted August 16, 2007 Share Posted August 16, 2007 And your question / problem is? Quote Link to comment https://forums.phpfreaks.com/topic/65170-solved-mysql-problem-again/#findComment-325394 Share on other sites More sharing options...
Aureole Posted August 16, 2007 Author Share Posted August 16, 2007 The MYSQ Quote Link to comment https://forums.phpfreaks.com/topic/65170-solved-mysql-problem-again/#findComment-325409 Share on other sites More sharing options...
trq Posted August 16, 2007 Share Posted August 16, 2007 Please. Maybe the link, How to ask.... in my signiture will help you. Quote Link to comment https://forums.phpfreaks.com/topic/65170-solved-mysql-problem-again/#findComment-325411 Share on other sites More sharing options...
AndyB Posted August 16, 2007 Share Posted August 16, 2007 Don't just throw code at us. Explain your problem (it was blindingly obvious in your code this time). Change: $query = mysql_query("UPDATE gs_mem SET mem_avx='$extension' WHERE mem_id='$whichid'"); $result = mysql_query($query) or die(mysql_error()); To: $query = "UPDATE gs_mem SET mem_avx='$extension' WHERE mem_id='$whichid'"; $result = mysql_query($query) or die(mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/65170-solved-mysql-problem-again/#findComment-325623 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.