Web Hosting Talk







View Full Version : help!


brcolow
11-16-2002, 03:54 PM
Hey, ok I have this script that uploads pictures to a file on my webserver, that works perfectly but im having trouble writing the filename to a mysql database, my query is as follows:

$sql ="INSERT INTO `revscreenshots` (id, name) VALUES ('$id', '$name')";
$result = mysql_query($sql);
if ($result)
echo "Your screenshot has been uploaded to the database.";


and i define id and name here,

$name = $HTTP_POST_FILES['userfile']['name'];
$id = $HTTP_GET_VARS['id'];

It uploads the pictures to the file (another part of the script) but after that it doesnt write them to the database, anyone know why?

Rich2k
11-16-2002, 04:31 PM
Please include your version of PHP and whether register globals is on or off but in PHP 4.2.x + the method of calling post and variables changed.

$_POST['variablename']
$_GET['variablename']

brcolow
11-16-2002, 04:32 PM
nah, that has nothing to do with it, defining them works perfectly it just wont write them to the database....

ChickenSteak
11-16-2002, 11:34 PM
Could you post your Database structure here?

brcolow
11-17-2002, 12:39 AM
uh...wat do you mean by database structure?

Bulldog
11-17-2002, 03:29 AM
He means like ... is the column ID a tinyint or a varchar?
It might be you have the structure set up incorrectly and you're trying to insert something that the column isn't designed to take.

Or that was my read on it.