PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

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 December 18th, 2003, 01:31 AM
velocityX velocityX is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 72 velocityX User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 m 36 sec
Reputation Power: 6
Send a message via AIM to velocityX
Too Long Php Line

this line in my code is too long!!! can anyone help me fix it???

PHP Code:
 $insert_tut_pics_db="insert into $csvsite_tutpicstable (tut_id,pic1_exist,pic1_data,pic1_name,pic1_size,p  ic1_type,pic2_exist,pic2_data,pic2_name,pic2_size,  pic2_type,pic3_exist,pic3_data,pic3_name,pic3_size  ,pic3_type,pic4_exist,pic4_data,pic4_name,pic4_siz  e,pic4_type,pic5_exist,pic5_data,pic5_name,pic5_si  ze,pic5_type,pic6_exist,pic6_data,pic6_name,pic6_s  ize,pic6_type,pic7_exist,pic7_data,pic7_name,pic7_  size,pic7_type,pic8_exist,pic8_data,pic8_name,pic8  _size,pic8_type,pic9_exist,pic9_data,pic9_name,pic  9_size,pic9_type,pic10_exist,pic10_data,pic10_name  ,pic10_size,pic10_type,pic11_exist,pic11_data,pic1  1_name,pic11_size,pic11_type,pic12_exist,pic12_dat  a,pic12_name,pic12_size,pic12_type,pic13_exist,pic  13_data,pic13_name,pic13_size,pic13_type,pic14_exi  st,pic14_data,pic14_name,pic14_size,pic14_type,pic  15_exist,pic15_data,pic15_name,pic15_size,pic15_ty  pe) ".
"values ('".$gettutid."','".$img1_exist."','".$tut_img1."','".$tut_img1_name."','".$tut_img1_size."','".$tut_img1_type."','".$img2_exist."','".$tut_img2."','".$tut_img2_name."','".$tut_img2_size."','".$tut_img2_type."','".$img3_exist."','".$tut_img3."','".$tut_img3_name."','".$tut_img3_size."','".$tut_img3_type."','".$img4_exist."','".$tut_img4."','".$tut_img4_name."','".$tut_img4_size."','".$tut_img4_type."','".$img5_exist."','".$tut_img5."','".$tut_img5_name."','".$tut_img5_size."','".$tut_img5_type."','".$img6_exist."','".$tut_img6."','".$tut_img6_name."','".$tut_img6_size."','".$tut_img6_type."','".$img7_exist."','".$tut_img7."','".$tut_img7_name."','".$tut_img7_size."','".$tut_img7_type."','".$img8_exist."','".$tut_img8."','".$tut_img8_name."','".$tut_img8_size."','".$tut_img8_type."','".$img9_exist."','".$tut_img9."','".$tut_img9_name."','".$tut_img9_size."','".$tut_img9_type."','".$img10_exist."','".$tut_img10."','".$tut_img10_name."','".$tut_img10_size."','".$tut_img10_type."', ".
"'".$img11_exist."','".$tut_img11."','".$tut_img11_name."','".$tut_img11_size."','".$tut_img11_type."','".$img12_exist."','".$tut_img12."','".$tut_img12_name."','".$tut_img12_size."','".$tut_img12_type."','".$img13_exist."','".$tut_img13."','".$tut_img13_name."','".$tut_img13_size."','".$tut_img13_type."','".$img14_exist."','".$tut_img14."','".$tut_img14_name."','".$tut_img14_size."','".$tut_img14_type."','".$img15_exist."','".$tut_img15."','".$tut_img15_name."','".$tut_img15_size."','".$tut_img15_type."');

mysql_query($insert_tut_pics_db); 

Reply With Quote
  #2  
Old December 18th, 2003, 08:09 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
What do you mean it's too long? Are you getting an error or does it just trample your sense of aesthetics? PHP shouldn't care about line length.

Reply With Quote
  #3  
Old December 18th, 2003, 03:06 PM
assemblage assemblage is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2003
Location: North Augusta, SC
Posts: 13 assemblage User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
It kinda looks like the problem lies with your database design.

Add another table for the pics.

Table 1: Table_tut
tut_id
tut_name

Table 2: Table_pic
pic_id
pic_name
tut_id

If you added one tut and 15 pics, Table_tut would have one entry, and Table_pic would have 15 entries. The tut_id would be the same for all tut_id fields and the pic_id would be numbered 1-15.

If you added another tut and 10 pics, Table_tut would have 2 entries and Table_pic would have 25 entries. The first 15 entries in Table_pic would have tut_id of 1 and the last 10 would have tut_id of 2.

To see the tut_name and the associated pic_names where tut_id=2, I beleive the SQL would be:

PHP Code:
"SELECT Table_tut.tut_name, Table_pic.picname FROM Table_tut, Table_pic WHERE Table_tut.tut_id=2 AND Table_Pic.tut_id=2" 


I'm not a pro at SQL statements and often have to mess around with them to get them to work right, so that one above may not be exactly right.

It might be helpful to explain what you are applying this code to.

Reply With Quote
  #4  
Old December 18th, 2003, 04:37 PM
Mike_r Mike_r is offline
ExoCrew
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 68 Mike_r User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Please post any specific errors you are getting.

Reply With Quote
  #5  
Old December 18th, 2003, 08:30 PM
velocityX velocityX is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 72 velocityX User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 m 36 sec
Reputation Power: 6
Send a message via AIM to velocityX
no the database is not a problem.....I'm sure about that....

The problem im getting is


Parse error: parse error, unexpected T_STRING in /home/coldxice/public_html/csvmodules/pages/processtutorial.php on line 677

Reply With Quote
  #6  
Old December 18th, 2003, 11:34 PM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
wow... are you sure you need those specific fields?

I think assemblage has some good suggestions to help you cope with some database normalization (its worth looking into, and improves syntax readability)

As for your error, sounds like you forgot to escape a quote or bracket... are you sure the error isn't with the line above 677?

Reply With Quote
  #7  
Old December 19th, 2003, 03:48 AM
osxboy osxboy is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 2 osxboy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Try replacing this fragment:

PHP Code:
 _". " values 

with

PHP Code:
values 


L

Reply With Quote
  #8  
Old December 19th, 2003, 08:21 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
Actually, the database is a problem, whether or not it is the problem at hand. I hadn't even noticed the column names until assemblage spoke up. Any time you wind up having field1... fieldn within a single table, you should consider breaking it out into a separate table.

But back to the stated problem. Check out the end of your line:
PHP Code:
 $tut_img15_type."'); 


You've left off the final quote before the parenthesis.

Do consider normalizing your database. Even if there's no immediately discernable benefit, it tends to make maintenance easier down the road.

Reply With Quote
  #9  
Old December 19th, 2003, 09:44 AM
assemblage assemblage is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2003
Location: North Augusta, SC
Posts: 13 assemblage User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Yea, "normalization" is what's it's called. I think it's a little bit tricky learning about it, but I did by reading online articles. I still have a bit to learn how to write good SQL statements using the different type of JOINs though. The concept is database independent and SQL is an Ansi standard.

Here are a link
http://support.microsoft.com/defaul...kb;EN-US;209534

Although not a good tutorial, it does explain the concept.

If you do add another table, you can add as many pictures as you want to your tutorial or as few as you want.

Reply With Quote
  #10  
Old December 19th, 2003, 09:25 PM
DDDooGGG DDDooGGG is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Location: Melbourne, Australia
Posts: 97 DDDooGGG User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 23 m 33 sec
Reputation Power: 6
Although i think the table is way to limited by being so big, i think i have the solution:
PHP Code:
 $insert_tut_pics_db="insert into $csvsite_tutpicstable  (tut_id,pic1_exist,pic1_data,pic1_name,pic1_size,p  
 ic1_type,pic2_exist,pic2_data,pic2_name,pic2_size,  
 pic2_type,pic3_exist,pic3_data,pic3_name,pic3_size  
,pic3_type,pic4_exist,pic4_data,pic4_name,pic4_siz  
 e,pic4_type,pic5_exist,pic5_data,pic5_name,pic5_si  
 ze,pic5_type,pic6_exist,pic6_data,pic6_name,pic6_s  
 ize,pic6_type,pic7_exist,pic7_data,pic7_name,pic7_  
 size,pic7_type,pic8_exist,pic8_data,pic8_name,pic8  
 _size,pic8_type,pic9_exist,pic9_data,pic9_name,pic  
 9_size,pic9_type,pic10_exist,pic10_data,pic10_name  
,pic10_size,pic10_type,pic11_exist,pic11_data,pic1  
 1_name,pic11_size,pic11_type,pic12_exist,pic12_dat  
 a,pic12_name,pic12_size,pic12_type,pic13_exist,pic  
 13_data,pic13_name,pic13_size,pic13_type,pic14_exi  
 st,pic14_data,pic14_name,pic14_size,pic14_type,pic  
 15_exist,pic15_data,pic15_name,pic15_size,pic15_ty  
pe) values ('"
.$gettutid."','".$img1_exist."','".$tut_img1."','".$tut_img1_name."','".$tut_img1_size."','".$tut_img1_type."','".$img2_exist."','".$tut_img2."','".$tut_img2_name."','".$tut_img2_size."','".$tut_img2_type."','".$img3_exist."','".$tut_img3."','".$tut_img3_name."','".$tut_img3_size."','".$tut_img3_type."','".$img4_exist."','".$tut_img4."','".$tut_img4_name."','".$tut_img4_size."','".$tut_img4_type."','".$img5_exist."','".$tut_img5."','".$tut_img5_name."','".$tut_img5_size."','".$tut_img5_type."','".$img6_exist."','".$tut_img6."','".$tut_img6_name."','".$tut_img6_size."','".$tut_img6_type."','".$img7_exist."','".$tut_img7."','".$tut_img7_name."','".$tut_img7_size."','".$tut_img7_type."','".$img8_exist."','".$tut_img8."','".$tut_img8_name."','".$tut_img8_size."','".$tut_img8_type."','".$img9_exist."','".$tut_img9."','".$tut_img9_name."','".$tut_img9_size."','".$tut_img9_type."','".$img10_exist."','".$tut_img10."','".$tut_img10_name."','".$tut_img10_size."',
'"
.$tut_img10_type."', '".$img11_exist."','".$tut_img11."','".$tut_img11_name."','".$tut_img11_size."','".$tut_img11_type."','".$img12_exist."','".$tut_img12."','".$tut_img12_name."','".$tut_img12_size."','".$tut_img12_type."','".$img13_exist."','".$tut_img13."','".$tut_img13_name."','".$tut_img13_size."','".$tut_img13_type."','".$img14_exist."','".$tut_img14."','".$tut_img14_name."','".$tut_img14_size."','".$tut_img14_type."','".$img15_exist."','".$tut_img15."','".$tut_img15_name."','".$tut_img15_size."','".$tut_img15_type."')"

mysql_query($insert_tut_pics_db); 
__________________
regards,


Fulton

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > Too Long Php Line


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