Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jan 24th, 2008, 10:22 PM   #1
kishou
Programmer
 
Join Date: May 2007
Posts: 52
Rep Power: 2 kishou is on a distinguished road
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.
kishou is offline   Reply With Quote
Old Jan 25th, 2008, 1:40 AM   #2
Jimbo
Battle Programmer
 
Jimbo's Avatar
 
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 763
Rep Power: 3 Jimbo is on a distinguished road
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>
Jimbo is offline   Reply With Quote
Old Jan 25th, 2008, 2:22 AM   #3
kishou
Programmer
 
Join Date: May 2007
Posts: 52
Rep Power: 2 kishou is on a distinguished road
Re: efficient

Quote:
Originally Posted by Jimbo View Post
For those of us who don't have your project specs, what tables? What pictures? What comments? What are you doing?
lo siento . 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.
kishou is offline   Reply With Quote
Old Jan 25th, 2008, 6:06 AM   #4
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Location: Waterloo, Ontario
Posts: 1,886
Rep Power: 5 Sane will become famous soon enough
Send a message via MSN to Sane
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?
Sane is online now   Reply With Quote
Old Jan 25th, 2008, 8:30 AM   #5
kruptof
Professional Programmer
 
kruptof's Avatar
 
Join Date: May 2006
Location: UK - London
Posts: 330
Rep Power: 3 kruptof is on a distinguished road
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:
When I was young it seemed that life was so wonderful,a miracle, oh it was beautiful, magical.
Now watch what you say or they'll be calling you a radical,a liberal, oh fanatical, criminal. Oh won't you sign up your name,we'd like to feel you're acceptable, respectable, oh presentable, a vegetable
kruptof is offline   Reply With Quote
Old Jan 25th, 2008, 3:02 PM   #6
kishou
Programmer
 
Join Date: May 2007
Posts: 52
Rep Power: 2 kishou is on a distinguished road
Re: efficient

Quote:
Originally Posted by kruptof View Post
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.
thanks! but would there still be able to be a field like name,email,comment? cause thats what i aiming for. and thx for all of your help so far!
my script is just an insert select. here's an example:
http://pspstuff.elementfx.com/comment.html
kishou is offline   Reply With Quote
Old Jan 25th, 2008, 7:34 PM   #7
Jimbo
Battle Programmer
 
Jimbo's Avatar
 
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 763
Rep Power: 3 Jimbo is on a distinguished road
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>
Jimbo is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 5:21 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC