|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Too Long Php Line
this line in my code is too long!!! can anyone help me fix it???
PHP Code:
|
|
#2
|
||||
|
||||
|
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.
|
|
#3
|
|||
|
|||
|
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:
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. |
|
#4
|
|||
|
|||
|
Please post any specific errors you are getting.
|
|
#5
|
|||
|
|||
|
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 |
|
#6
|
||||
|
||||
|
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? |
|
#7
|
|||
|
|||
|
Try replacing this fragment:
PHP Code:
with PHP Code:
L |
|
#8
|
||||
|
||||
|
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:
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. |
|
#9
|
|||
|
|||
|
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. |
|
#10
|
|||
|
|||
|
Although i think the table is way to limited by being so big, i think i have the solution:
PHP Code:
__________________
regards, Fulton |
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > Too Long Php Line |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|