MySQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMySQL Help
Receive the tools necessary to be the rock star of your field. Our 12-month program teaches you the evolving world of multi-channel marketing as well as the complex issues and opportunities found in the industry.

ASP Free and Iron Speed Designer are giving away $5,500+ in FREE licenses. Iron Speed's RAD CASE toolset can save up to 80% of your coding time. One free license per week, one perpetual license per month!
Download and Activate to enter!

Web development can be a daunting task, even for specialists. There is a lot of information to absorb and a lot of technologies to learn in order to manage a superior website. When trying to learn the ropes, developers need a reliable source to introduce new ideas that can be easily implemented. When working on large projects, even web veterans may run into a technology or an aspect of a technology that they are unfamiliar with.

Learn More!


Download to Enter
| Contest Rules

Tutorials | Forums

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 4th, 2012, 09:37 PM
DaAvatar DaAvatar is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2012
Posts: 2 DaAvatar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 m 51 sec
Reputation Power: 0
Exclamation Images gallery with links

Hello,
I'd really need some help.
I created a gallery with links on each thumbnail.
All my links are written down in a .txt file like this
Code:
<div class="gallery">
 <a href="http://www.website.com">
  <img src="http://tc16.easythumbhost.com/image.jpg" onerror="ImgError(this)"/>
 </a>
</div>
#enddiv


Then, my pages are separated with a php script to get links from the txt

PHP Code:
<?php
 $links 
"links/links.txt";
 
$fd fopen ($links"r");
 
$content fread ($fd,filesize ($links));
 
fclose ($fd);
 
$delimiter "#enddiv";
 
$splitcontent explode($delimiter$content);
 
$output array_slice($splitcontent0160);
?>

<?php
 
foreach ( $output as $divs )
{
 echo 
"$divs";
}
?>


My script works very well, but I got another problem : dead links.
After days of searches, work and some help, I got a php script which deletes all the div section of a broken link. But php has to rewrite the whole file each time, so when I got many broken links from the same file, it corrupts because It doesnt have time to rewrite file many times in a few seconds.

I never tried SQL and someone told me to go with it, cause it would be easier to manage the dead links. I don't have any idea how to use it and I'm so tired of all these days of work for nothing.
Would need some help so I could work with Database.
Thanks.

Reply With Quote
  #2  
Old February 5th, 2012, 06:08 AM
SimonJM SimonJM is offline
Contributing User
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Mar 2006
Posts: 1,914 SimonJM User rank is General 5th Grade (Above 100000 Reputation Level)SimonJM User rank is General 5th Grade (Above 100000 Reputation Level)SimonJM User rank is General 5th Grade (Above 100000 Reputation Level)SimonJM User rank is General 5th Grade (Above 100000 Reputation Level)SimonJM User rank is General 5th Grade (Above 100000 Reputation Level)SimonJM User rank is General 5th Grade (Above 100000 Reputation Level)SimonJM User rank is General 5th Grade (Above 100000 Reputation Level)SimonJM User rank is General 5th Grade (Above 100000 Reputation Level)SimonJM User rank is General 5th Grade (Above 100000 Reputation Level)SimonJM User rank is General 5th Grade (Above 100000 Reputation Level)SimonJM User rank is General 5th Grade (Above 100000 Reputation Level)SimonJM User rank is General 5th Grade (Above 100000 Reputation Level)SimonJM User rank is General 5th Grade (Above 100000 Reputation Level)SimonJM User rank is General 5th Grade (Above 100000 Reputation Level)SimonJM User rank is General 5th Grade (Above 100000 Reputation Level)SimonJM User rank is General 5th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 5 Days 11 h 34 sec
Reputation Power: 1297
mySQL has no9 facility to 'handle' dead link in and of itself. However, your scripts (page build and link checking) could make use of data from a database, and the updating of the underlying rows in the table of your database would be better suited to the process than 'hacking' at a file.
The order in which the data came from the database would not be guaranteed (unlike the linear form of the file) unless you sorted the returned rows.
__________________
The moon on the one hand, the dawn on the other:
The moon is my sister, the dawn is my brother.
The moon on my left and the dawn on my right.
My brother, good morning: my sister, good night.
-- Hilaire Belloc

Reply With Quote
  #3  
Old February 5th, 2012, 06:21 AM
DaAvatar DaAvatar is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2012
Posts: 2 DaAvatar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 m 51 sec
Reputation Power: 0
There's no problem with the returned rows. I was wondering if it would be possible to remove the dead links from database with the "onerror" of the img without having to rewrite the whole file for each dead link.
I'm currently using it with php but it rewrites completely the file multiple times in few seconds so memory doesn't take it all.

Reply With Quote
  #4  
Old February 5th, 2012, 08:54 AM
SimonJM SimonJM is offline
Contributing User
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Mar 2006
Posts: 1,914 SimonJM User rank is General 5th Grade (Above 100000 Reputation Level)SimonJM User rank is General 5th Grade (Above 100000 Reputation Level)SimonJM User rank is General 5th Grade (Above 100000 Reputation Level)SimonJM User rank is General 5th Grade (Above 100000 Reputation Level)SimonJM User rank is General 5th Grade (Above 100000 Reputation Level)SimonJM User rank is General 5th Grade (Above 100000 Reputation Level)SimonJM User rank is General 5th Grade (Above 100000 Reputation Level)SimonJM User rank is General 5th Grade (Above 100000 Reputation Level)SimonJM User rank is General 5th Grade (Above 100000 Reputation Level)SimonJM User rank is General 5th Grade (Above 100000 Reputation Level)SimonJM User rank is General 5th Grade (Above 100000 Reputation Level)SimonJM User rank is General 5th Grade (Above 100000 Reputation Level)SimonJM User rank is General 5th Grade (Above 100000 Reputation Level)SimonJM User rank is General 5th Grade (Above 100000 Reputation Level)SimonJM User rank is General 5th Grade (Above 100000 Reputation Level)SimonJM User rank is General 5th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 5 Days 11 h 34 sec
Reputation Power: 1297
If you have a way to uniquely identify the link in question, from within the onerror code, within the database then the simple answer is 'yes'

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > Images gallery with links


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

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.

© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 2 - Follow our Sitemap