<?php
session_start();
if($_POST['submit'] == ''){
?>
.....
<form enctype="multipart/form-data" action="<?php echo $_SERVER['file:///C|/Users/Adam/Documents/websites/orangutanenglish/PHP_SELF']; ?>" - I'm not sure what this paths refers to (My Comment)
method="post"> <!-- JHCO: changed from $_SERVER['../PHP_SELF'] to $_SERVER['PHP_SELF'] -->
<div align="center">
<input type="hidden" name="MAX_FILE_SIZE" value="8000000" />
<span class="style18">Select your profile picture</span><strong>:</strong>
<input type="file" name="user_picture" />
<input type="hidden" name="user_id" value="<?php echo $_SESSION['user_id']; ?>" />
<input type="submit" name="submit" value="submit" />
</div>
</form>
....<?php
} else {
require_once('../Connections/sensei.php'); - this file exists (My Comment)
$upload_path = "/home/orangu8/public_html/upload"; - changed to new path (My Comment)
$extension = $_FILES['user_picture']['name'];
$extension = explode('.',$extension);
$extension = array_reverse($extension);
$extension = $extension[0];
$upload_file_name = "user_pic-".$_SESSION['user_id'].'.'.$extension;
$upload_full_path = $upload_path.'/'.$upload_file_name;
if(move_uploaded_file($_FILES['user_picture']['tmp_name'], $upload_full_path)){
$sqlUpdateUser = "UPDATE TestTable SET photoid='".$upload_file_name."', photo='1' WHERE autonumber=".$_POST['user_id'];
mysql_select_db($database_sensei, $sensei);
if(! ( mysql_query($sqlUpdateUser, $sensei))){
die('There was a problem!<br>Query being exectued:'.$sqlUpdateUser.'<br><br> MySQL error number:'.mysql_errno($sensei).'<br><br> MySQL message:'.mysql_error($sensei));
} else {
echo '<script language="JavaScript">
window.location="SenseiConnect_Add_Your_Profile2.php";
</script>';
}
} else {
echo "there was a problem.";
}
}
?>
There was a problem!
Query being exectued:UPDATE TestTable SET photoid='user_pic-.png', photo='1' WHERE autonumber=
MySQL error number:1064
MySQL message:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
ASKER
There was a problem!
Query being exectued:UPDATE TestTable SET photoid='user_pic-.png', photo='1' WHERE autonumber=
MySQL error number:1064
MySQL message:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
ASKER
ASKER
MySQL message:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '=
Notice: Undefined index: user_id in /home/orangu8/public_ht' at line 1
ASKER
ASKER
ASKER
ASKER
PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.
TRUSTED BY
ASKER
qplana, Roads Roads,
You were correct. There is a record insert form before the upload page. The idea is that certain text information is entered through that form, and then when the user clicks submit, there are taken to this (the upload form) where the user uploads a photograph (but to the same record in the database).
Comparing the previous files, it seemed that this line was missing from the 'new' version of the set up in the page prior to the the upload page:
$_SESSION['user_id'] = mysql_insert_id($sensei);
I have now added it, but disappointingly I still get the same error message.
I will try again and make the change to the action part also.
wmadrid1 - I will add your suggested reporting text and post with the results.
Thanks all.