•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 425,819 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,015 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 386 | Replies: 3 | Solved
•
•
Join Date: Apr 2008
Posts: 21
Reputation:
Rep Power: 1
Solved Threads: 1
Hi There
I have a very simple web gallery in php and mysql. I have noticed upon creating it, that I have several fields in my database contacting the same information (to a certain extent) and I wondered whether this would eventually put a strain on my server. Would it be possible to marry two or more of the columns together in the php coding to produce the same result?
It also seems daft spending time putting the same info into the database over and over again.
My database currently looks like this: http://www.equinefocus.co.uk/sampledatabase.jpg - however, this has not yet had the main image url included, which would look like the thumb field, but without the /thumbs/ directory included.
For example:
Each photo has a reference number, which consists of:
COLOR="red"]date[/color] and an image number
i.e. 2008-04-13-001
Each thumbnail consists of:
directory path + date + /thumbs/ + image number + file extension
i.e. /photos/eventing/2007-09-01/thumbs/001 .jpg
For the thumbnail, would it be possible to pull the directory path, date, image number from the database, have the file extension and /thumb/ section in the php code, and have all elements join together to form the link to the image? It would mean that some of the content is being used more than once (date appears in the url to the image and the reference number displayed underneath).
My current code to produce the image is:
Bit complex, sorry! Any assistance would be appreciated.
I have a very simple web gallery in php and mysql. I have noticed upon creating it, that I have several fields in my database contacting the same information (to a certain extent) and I wondered whether this would eventually put a strain on my server. Would it be possible to marry two or more of the columns together in the php coding to produce the same result?
It also seems daft spending time putting the same info into the database over and over again.
My database currently looks like this: http://www.equinefocus.co.uk/sampledatabase.jpg - however, this has not yet had the main image url included, which would look like the thumb field, but without the /thumbs/ directory included.
For example:
Each photo has a reference number, which consists of:
COLOR="red"]date[/color] and an image number
i.e. 2008-04-13-001
Each thumbnail consists of:
directory path + date + /thumbs/ + image number + file extension
i.e. /photos/eventing/2007-09-01/thumbs/001 .jpg
For the thumbnail, would it be possible to pull the directory path, date, image number from the database, have the file extension and /thumb/ section in the php code, and have all elements join together to form the link to the image? It would mean that some of the content is being used more than once (date appears in the url to the image and the reference number displayed underneath).
My current code to produce the image is:
<?php
// Connects to your Database
mysql_connect("*****", "*****", "*****") or die(mysql_error());
mysql_select_db("*****")
or die ("Unable to connect to MySQL");
$data = mysql_query("SELECT * FROM `others` WHERE date = '2008-04-27' AND ref ='2008-04-27-001'")
or die ("No data available, please contact the site admin describing where you found this error message.");
?>
<table cellpadding="2" width="65%">
<?php
while($info = mysql_fetch_array($data)) {
?>
<tr><td> <img src="<?php echo $info['full'];?>" border="0"</a></td></tr>
<tr><td> <span class="refno">Photo Reference: <?php echo $info['ref']; ?></span></td></tr>
<tr><td> <?php echo $info['info']; ?></td></tr>
</table>Bit complex, sorry! Any assistance would be appreciated.
Last edited by Borderline : May 16th, 2008 at 5:31 pm.
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- memory management in wndows 2000 (Windows NT / 2000 / XP / 2003)
Other Threads in the PHP Forum
- Previous Thread: Updating required 2 Clicks of the same button
- Next Thread: creating dynamic columns and rows with data



Threaded Mode