Each line like different array element

Status
Not open for further replies.

QuiGloriam

Member
7
2011
0
0
Have this problem:

I want to check multiple URLs at the same time. All URLs are inside a mysql table like this:
Code:
megaupload/hsudhusdf
rapidshare/sdjfsdfsd
fileserve/dsjofsjdfsfsd
uploading/asjdasdas as dasd

Each URL in different lines. So what I want to do is to put each URL in a new array value like this:

Code:
$array[0]=megaupload/hsudhusdf
$array[1]=rapidshare/sdjfsdfsd
...
Any way to do that?

Right now i'm not using database, just manually like this:
Code:
$urls=array("url1","url2","url")
$i=0;
while ($i< count($urls)) {
//Check if url works or not
if($urls[$i]=works)
echo "<font-colior="green">$urls[0]</font><br>;
else "<font-colior="red">$urls[0]</font><br>;
$i++;
}

But now I want to create a form (created) and insert into database all links (created) now all links are in database but don't know how to separate them :(

Another issue
Also each piece of code checks if for example megaupload links are working, then another piece of code checks for fileserve links are working... If I put all types of urls at the database, same table, how to separate each file host to pass each piece of code??

Thanks, when all done want to share with you the result...
 
2 comments
first issue:

PHP:
<?php
// Make a MySQL Connection
$query = "SELECT * FROM links"; 
$result = mysql_query($query) or die(mysql_error());
$links  = array();
while($row = mysql_fetch_array($result)){
	$links[] = $row['link'];
}
?>
change these values to match your database
$query = "SELECT * FROM links";
and
$links[] = $row['link'];
 
Another issue
Also each piece of code checks if for example megaupload links are working, then another piece of code checks for fileserve links are working... If I put all types of urls at the database, same table, how to separate each file host to pass each piece of code??

Are each links a distinct record? If yes than you should add a second field for host name only.
example would be
record 1
field 1 fileserve field 2 www.fileserve.com/files/aididpisdpid

record 2
field 1 filesonic field 2 www.filesonic.com/files/xyzeeeda

This way you can order the select by field 1 keeping hosts together so you can do the checks as a batch (api or curl).
 
Status
Not open for further replies.
Back
Top