Forum Moderators: coopster
what I want to do is add a table to output the DATE without it being included in the link.
$counter = $range + 1;
while($row = mysql_fetch_row($result)) {
$fullURL = "ftp://".$row[2].":".$row[3]."@".$row[1].":".$row[4].$row[0];
$linkURL = htmlentities(str_replace(" ", "%20", $fullURL));
echo "$counter. <a href=$linkURL>$fullURL</a><br>";
How do I add the table to the end of the file to generate dynamically with the results?
Thank You,
disabled person
did you just want to output it onto the page? I ma not really sure what you want to do.
Have you got the date included in the sql statement already? Or, if not, maybe give us a look at the query, add it to that and then you can just add an extra element to your ech statement.
$query = "SELECT files.filename, ftps.hostname, ftps.username, ftps.password, ftps.port FROM files INNER JOIN ftps ON ftps.Code=files.Code WHERE files.Filename like '%$search%' LIMIT $range, $ResultsPerPage";
$result = mysql_query($query);
$counter = $range + 1; if ($numFound) { } I would mlike a table to the right of the results that says when it was last indexed. can ya help? Thank You [1][edited by: jatar_k at 12:02 am (utc) on Dec. 31, 2003]
while($row = mysql_fetch_row($result)) {
$fullURL = "ftp://".$row[2].":".$row[3]."@".$row.":".$row[4].$row[0];
$linkURL = htmlentities(str_replace(" ", "%20", $fullURL));
echo "$counter. <a href=$linkURL>$fullURL</a><br>";
$counter++;
}
echo "<br><br><p align=center>";
if ($range!=0) echo "<a href=?rn=".($range-50)."&search=$search><< PREV $ResultsPerPage</a>";
echo " ";
if (($counter-1)!=$numFound) echo "<a href=?rn=".($range+50)."&search=$search>NEXT $ResultsPerPage >></a>";
echo "</p>";
echo "<br><HR><b>Total number of matches found: $numFound</b>";
} else {
echo "<br><br><HR><b>Sorry, your search returned no results.</b>";
}
?>
Disabled
[edit reason] no personal urls thanks [/edit]
date(this is not a name you should use for a table or column [mysql.com], by the way) which probably has the
Codefield as the PRIMARY KEY. First off, why not just ALTER [mysql.com] your current table to add the new field, date_last_indexed? Then write a one-time script to populate the field with the correct date for each file...? Just curious.
Otherwise, you'll probably want to LEFT JOIN the
date_table table in your SQL statement and handle the output accordingly:
$query = "SELECT
files.filename,
ftps.hostname,
ftps.username,
ftps.password,
ftps.port,
date_table.date_last_indexed
FROM files
INNER JOIN ftps ON ftps.Code=files.Code
LEFT JOIN date_table ON files.Code=date_table.Code
WHERE files.Filename like '%$search%' LIMIT $range, $ResultsPerPage";
echo "$counter. <a href=$linkURL>$fullURL</a> " . $row[6] . "<br>";
I have the table 'ftps' with the column 'Indexed'. It is in the timestamp form. I have got it to echo the results on the page to display the last indexing but it reads like so...:
"" 1. *************/sur/drivers/modem/at&t/Lucent modem driver for Compaq laptops.zip
20040104190522 -- Last Indexed
2. *************/sur/drivers/modem/at&t/Lucent V.90 Modem Drivers.exe
20040104190522 -- Last Indexed
3. *************/sur/drivers/modem/at&t/lucent-v92.zip
20040104190522 -- Last Indexed
4. *************/sur/drivers/modem/Lucent
20040104190522 -- Last Indexed """"
and this is what produces it....
echo "$counter. <a href=$linkURL>$fullURL</a><br>". $row[5] ." -- Last Indexed<br>";
WHAT AND WHERE do I put code to make it more readable?
I just cant get it right.
Thanks for any code you might add into it for me.
Disabled
I'm assuming you want to format the timestamp? You can format it as you pull it from MySQL [mysql.com] or you can format it using the PHP date [php.net] function. Personally, I would use the MySQL DATE_FORMAT() [mysql.com] function as it is being pulled from the database:
$query = "SELECT
files.filename,
ftps.hostname,
ftps.username,
ftps.password,
ftps.port,
DATE_FORMAT(ftps.Indexed, '%W %M %Y') AS date_formatted
FROM ...
You will want to change the formatting to your liking -- coopster