![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: May 2007
Posts: 52
Rep Power: 2
![]() |
efficient
ok i just finished making my comment script for pictures. but i would have to create a new table each time and now its starting to become very tedious
. So i was wondering is there a way to make my script more efficient? like mabye only select some rows? or insert into different parts of 1 table? thanks. |
|
|
|
|
|
#2 |
|
Battle Programmer
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 748
Rep Power: 3
![]() |
Re: efficient
For those of us who don't have your project specs, what tables? What pictures? What comments? What are you doing?
__________________
<insert disclaimer here> <insert shameless plug for Visual Studio here> |
|
|
|
|
|
#3 | |
|
Programmer
Join Date: May 2007
Posts: 52
Rep Power: 2
![]() |
Re: efficient
Quote:
. ok i made a database for comments. and when u add a comment it inserts it into the table. and i have a section called comments on the page with the picture and all that does is just select the table. |
|
|
|
|
|
|
#4 |
|
Programming Guru
![]() Join Date: Apr 2005
Posts: 1,799
Rep Power: 5
![]() |
Re: efficient
You might need to post some code. With your current descriptions, the problem at hand is too ambiguous. I doubt anyone could suggest the necessary code to make it more efficient. Post the script?
|
|
|
|
|
|
#5 | |
|
Professional Programmer
Join Date: May 2006
Location: UK - London
Posts: 329
Rep Power: 3
![]() |
Re: efficient
I'll just take a SWAG.
You have two items a picture and a comment and a comment is associated with a picture. You want to be able to retrieve a given picture and its comment. Have a single table, lets call it TableX, this table will have minimum 2 columns 'Picture' and 'Comment'. When you need to store an image and it's comment just use a INSERT statement or something equivalent to append data to the table and when you want to retrieve something from the table use the SELECT statement or something equivalent. Note the INSERT and SELECT are sql keywords and note php.
__________________
Quote:
|
|
|
|
|
|
|
#6 | |
|
Programmer
Join Date: May 2007
Posts: 52
Rep Power: 2
![]() |
Re: efficient
Quote:
my script is just an insert select. here's an example: http://pspstuff.elementfx.com/comment.html |
|
|
|
|
|
|
#7 |
|
Battle Programmer
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 748
Rep Power: 3
![]() |
Re: efficient
I think you want 2 tables, one for pictures and one for comments. Assign each picture an ID, and use that ID to tell what comments correspond to what pictures. Then you can do something like 'SELECT * FROM Comments WHERE PictureId = <picId>' to get all the comments for that picture. Is this close?
__________________
<insert disclaimer here> <insert shameless plug for Visual Studio here> |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Most efficient byte order switch | Klarre | Software Design and Algorithms | 6 | Feb 12th, 2007 8:27 AM |
| An Efficient Calendar Generation | Sane | PHP | 3 | Sep 5th, 2006 7:36 PM |
| Can PWS be efficient in Internet applications? | sham | Other Web Development Languages | 1 | Nov 19th, 2005 8:12 AM |
| New Efficient Encryption Method | Sane | Coder's Corner Lounge | 30 | Sep 22nd, 2005 5:13 PM |
| Conceptualizing Code | phenofire | Other Programming Languages | 19 | Sep 15th, 2005 4:45 PM |