General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old August 20th, 2003, 08:23 PM
lobos34 lobos34 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: San Francisco
Posts: 17 lobos34 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Parse error? can't find where it is

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");
?>

Reply With Quote
  #2  
Old August 21st, 2003, 05:20 PM
FrankieShakes FrankieShakes is offline
Frank The Tank!
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: Jun 2002
Location: Toronto, Canada
Posts: 1,246 FrankieShakes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to FrankieShakes Send a message via MSN to FrankieShakes
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

Reply With Quote
  #3  
Old August 22nd, 2003, 07:29 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
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.

Reply With Quote
  #4  
Old August 22nd, 2003, 10:05 PM
nicat23's Avatar
nicat23 nicat23 is offline
Addicted to Chaos..
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jan 2003
Location: Ft. Worth, TX
Posts: 653 nicat23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 47 m 52 sec
Reputation Power: 0
Send a message via AIM to nicat23 Send a message via Yahoo to nicat23
Code:
<input type="text" name="myName" value="Mitchell Harper"> 
Needs to either be echoed or printed to put the propper value in... IE:
PHP Code:
echo "<input type=\"text\" name=\"myName\" value=\"Mitchell Harper\">"


And this:
Code:
if(empty($strDesc) || $fileUpload == "none"); 
die("You must enter both a description and file"); 


needs to be
PHP Code:
if(empty($strDesc) || $fileUpload == "none"

    die(
"You must enter both a description and file"); 


Last edited by nicat23 : August 22nd, 2003 at 10:08 PM.

Reply With Quote
  #5  
Old August 25th, 2003, 06:35 PM
lobos34 lobos34 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: San Francisco
Posts: 17 lobos34 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #6  
Old August 28th, 2003, 08:55 PM
FrankieShakes FrankieShakes is offline
Frank The Tank!
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: Jun 2002
Location: Toronto, Canada
Posts: 1,246 FrankieShakes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to FrankieShakes Send a message via MSN to FrankieShakes
Lobos34,

What do you mean by "formatting tables"? Do you mean HTML tables of MySQL tables?

Reply With Quote
  #7  
Old August 28th, 2003, 09:45 PM
lobos34 lobos34 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: San Francisco
Posts: 17 lobos34 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Post

????

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?

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Parse error? can't find where it is


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway