Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-21-2006, 10:46 PM   PM User | #1
gee25
New to the CF scene

 
Join Date: Nov 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
gee25 is an unknown quantity at this point
connection to mysql table fails - basic

hello all,

i want to create an upload for images for my personal website.

therefore i searched the internet for stuff relating to that. i found the following code which is kinda useful.

Whenever I upload that stuff i get the following errors:
Parse error: parse error, unexpected T_VARIABLE in /kunden/giselbrecht.org/webseiten/share/share2/store.php3 on line 28

Hopefully some of you guys can help me out on that, and save my day,

Philipp


<?php

// store.php3 - by Florian Dittmer <dittmer@gmx.net>
// Example php script to demonstrate the storing of binary files into
// an sql database. More information can be found at http://www.phpbuilder.com/
?>

<html>
<head><title>Store binary data into SQL Database</title></head>
<body>

<?php
// code that will be executed if the form has been submitted:

if ($submit) {

//connect to db
$host = "localhost";
$user = "db34711_3";
$pass = "philgise";
$database = "db34711_3";

$db = mysql_connect("$host","$user","$pass") or die ("Keine Verbindung moeglich");
mysql_select_db("$database",$db) or die ("Datenbank fehlt");

$data = addslashes(fread(fopen($form_data,"r"), filesize($form_data)));

****$result = mysql_query("INSERT INTO binary_data (description,bin_data,filename,filesize,filetype) VALUES ('$form_description','$data','$form_data_name','$form_data_size','$form_data_type')");

****$id = mysql_insert_id();
****print "<p>This file has the following Database ID: <b>$id</b>";

****mysql_close() or die ("Datenbank");

} else {

****// else show the form to submit new data:
?>

****<form method="post" action="<?php echo $PHP_SELF; ?>" enctype="multipart/form-data">
****File Description:<br>
****<input type="text" name="form_description"**size="40">
****<input type="hidden" name="MAX_FILE_SIZE" value="1000000">
****<br>File to upload/store in database:<br>
****<input type="file" name="form_data"**size="40">
****<p><input type="submit" name="submit" value="submit">
****</form>

<?php

}

?>

</body>
</html>
gee25 is offline   Reply With Quote
Old 11-22-2006, 12:50 AM   PM User | #2
guelphdad
Super Moderator


 
guelphdad's Avatar
 
Join Date: Mar 2006
Location: St. Catharines, Ontario Canada
Posts: 2,629
Thanks: 4
Thanked 147 Times in 138 Posts
guelphdad will become famous soon enoughguelphdad will become famous soon enough
please edit your post and add [ php] and [/php] tags for clarity, take the space out of the first tag.

then do a search on unexpected T_VARIABLE either here or on google and you will have the problem explained.
guelphdad is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:43 PM.


Advertisement
Log in to turn off these ads.