|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
I am doing the "Blobbing Data With PHP and MySQL" tutorial and
I keep geting a parse error on the grabfiles.php in line 17, when I run it and I can't find the problem. Could someone take a look and see if they can find it? Also I took out the user, pass and database, so please don't tell me that it is the problem. Thanks here is the code: <?php // GrabFile.php: Takes the details // of the new file posted as part // of the form and adds it to the // myBlobs table of our myFiles DB. global $strDesc; global $fileUpload; global $fileUpload_name; global $fileUpload_size; global $fileUpload_type; <input type="text" name="myName" value="Mitchell Harper"> echo $HTTP_GET_VARS["myName"]; echo $HTTP_POST_VARS["myName"]; // Make sure both a description and // file have been entered if(empty($strDesc) || $fileUpload == "none"); die("You must enter both a description and file"); // Database connection variables $dbServer = "localhost"; $dbDatabase = "mydb"; $dbUser = "user"; $dbPass = "pass"; $fileHandle = fopen($fileUpload, "r"); $fileContent = fread($fileHandle, $fileUpload_size); $fileContent = addslashes($fileContent); $sConn = mysql_connect($dbServer, $dbUser, $dbPass) or die("Couldn't connect to database server"); $dConn = mysql_select_db($dbDatabase, $sConn) or die("Couldn't connect to database $dbDatabase"); ?> |
|
#2
|
|||
|
|||
|
Which line of the code is line 17? Since you took out the DB connection lines, I don't know which line you're referring to.
__________________
____________________________________________ Developer Shed Weekly Writer | DevArticles Forum Moderator Build Your Own KlipFolio Klip With PHP FrankManno.com - Under Construction Design Interactive Group - Under Construction |
|
#3
|
||||
|
||||
|
FrankieShakes, I think he means he changed the values. The lines are still there.
One thing that stands out to me is that you've got an if statement that executes no code, has no brackets, and ends with a semi-colon. I think you probably meant to have that semi-colon be an opening bracket, indent the die() statement following it, and add a closing bracket after the die() statement. Fixing this might not make the code work as you intend, but I believe it'll solve the syntax error at least. |
|
#4
|
||||
|
||||
|
Code:
<input type="text" name="myName" value="Mitchell Harper"> PHP Code:
And this: Code:
if(empty($strDesc) || $fileUpload == "none");
die("You must enter both a description and file");
needs to be PHP Code:
Last edited by nicat23 : August 22nd, 2003 at 10:08 PM. |
|
#5
|
|||
|
|||
|
Sorry I have not answered back.
Thanks for the help though, you guys are great! But instead of doing this I am having the MySQL db call the file from a directory, It's easier. Someone should have a talk with the guy from "Blobbing Data With PHP and MySQL" tutorial though. I copied the code the exact way he shows it on the site. I do not know enough about php yet (new to it, just started it two weeks ago) to tell them where the mistakes are. Anyway thanks again I'm stuck on formatting tables (been on one table for four days) with php so if anyone knows a good tutorial please post it here. Thanks again!! Last edited by lobos34 : August 25th, 2003 at 07:39 PM. |
|
#6
|
|||
|
|||
|
Lobos34,
What do you mean by "formatting tables"? Do you mean HTML tables of MySQL tables? |
|
#7
|
|||
|
|||
|
????
I have the MySQL tables and fields working fine now I am trying to get the PHP to pull the info from the database and print them to the browser in columns. This is what I have working Title Company Title Company Title Company This is the way I want it to work: Title Company | Title Company |Title Company laidback was trying to help (see thread "Creating columns in a PHP page", the code is there.) but I guess I am too new to PHP. I don't understand how to make the PHP code he gave me work? ![]() |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > Parse error? can't find where it is |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|