Jump to content

prototype18

Members
  • Posts

    17
  • Joined

  • Last visited

    Never

Everything posted by prototype18

  1. Is there a way I can make the LEGACY (or oringinal) file float to the bottom, while keeping the numerical values from the substr in a high to low order?
  2. Output is... File (Printable) Printable - yyyymmdd VIEW File (Printable) Printable - LEGACY VIEW File (Printable) Printable - 20101020 VIEW File (Printable) Printable - 20100920 VIEW Legacy need to be on the bottom. $codate is just a substr function to grab the date embedded in the file name for display and sorting.
  3. I have a situation where I need to sort files on a screen based on the date that is embedded into the file name. The problem is that I am sorting based off the file name, and when I get my output the LEGACY file always comes out on top of the sort because it starts with a 0 meanwhile the rest have dates appended the the filename so I don't have a problem sorting those. Please help me if you can. <?//Special case for extra files IF($Recordmyrow['App'] == "(Printable)") { $display = false; $column3 = "Printable VER"; IF($securityvalue == "P") { if(substr($path, 0, 5) == "file:") { $filename = substr($path, 5); if(file_exists($filename)) { $basename = substr($filename, 0, strrpos($filename, '.')); $ext = ".pdf"; $allfiles = glob("{$basename}*.pdf"); rsort($allfiles, SORT_NUMERIC); foreach($allfiles as $file) { if($ext == ".pdf") { $column4 = "<a href=\"pdf.php?src={$file}\">VIEW</a><br />\n"; $codate = substr($file, 70, ; $co = substr($file, 59, 1); if ($codate != "pdf") { $column3 = "Printable File - ".$codate; } elseif ($codate == "pdf") { $column3 = "Printable File - LEGACY"; } IF($lastGroup != $Recordmyrow['Grouping']) { $lastGroup = $Recordmyrow['Grouping']; ?> <TR> <TD colspan="4" align="center" bgcolor="#418765"><B><FONT color="white"><? echo $Recordmyrow['Grouping'] ?></FONT></B></TD> </TR> <? } ?> <TR> <TD class="display" align="center" bgcolor="<?=changeColor($rowcount)?>"><B><? echo $column1 ?></B></TD> <TD class="display" bgcolor="<?=changeColor($rowcount)?>"><B><? echo $column2 ?></B></TD> <TD class="display" bgcolor="<?=changeColor($rowcount)?>"><B><? echo $column3 ?></B></TD> <TD class="display" bgcolor="<?=changeColor($rowcount)?>" align="center"><B><? echo $column4 ?></B></TD> </TR> <? $rowcount++; } } } else { $column4 = "Not Available"; ?> <TR> <TD class="display" align="center" bgcolor="<?=changeColor($rowcount)?>"><B><? echo $column1 ?></B></TD> <TD class="display" bgcolor="<?=changeColor($rowcount)?>"><B><? echo $column2 ?></B></TD> <TD class="display" bgcolor="<?=changeColor($rowcount)?>"><B><? echo $column3 ?></B></TD> <TD class="display" bgcolor="<?=changeColor($rowcount)?>" align="center"><B><? echo $column4 ?></B></TD> </TR> <? $rowcount++; } }} }
  4. Okay, this is the code that builds the $path variable. Your code did kind of work, just didn't give the desired result. The path variable is looking at a SQL table for these UNC paths to folders on the network. //Replace variables in path $path = $Recordmyrow['Path']; $path = str_replace("['XXX']",$item,$path); $path = str_replace("['XXX']",$sqlmyrow['XXX''],$path); $path = str_replace("['XXX']",$sqlmyrow['XXX''],$path); $path = str_replace("['XXX']",$sqlmyrow['XXX''],$path); $path = str_replace("['XXX']",$sqlmyrow['XXX''],$path); $path = str_replace("['SESSIONID']",session_id(),$path); $path = str_replace("['APPLICATIO']",$applicatio,$path); $path = str_replace("['APPLICATIO3']",substr($applicatio,3),$path); $path = str_replace("['YEAR24']",substr($applicatio,2,4),$path); $path = str_replace("['YEAR34']",substr($applicatio,3,4),$path); $path = str_replace("['YEAR44']",substr($applicatio,4,4),$path); $path = str_replace("['YEAR54']",substr($applicatio,5,4),$path); $path = str_replace("['LATITUDE']",$sqlmyrow['LAT'],$path); $path = str_replace("['LONGITUDE']",$sqlmyrow['LON'],$path); // ELSEIF($Recordmyrow['Applicatio'] == "CO") { IF($securityvalue == "P"){$display = false;} IF(file_exists(substr($path, 5))){} ELSE{$column4 = "<A href='javascript:mbox();'>UNAVAILABLE</A>";} } // ELSEIF($Recordmyrow['Applicatio'] == "CO (Printable)") { IF($securityvalue != "P"){$display = false;} IF(file_exists(substr($path, 5))){} ELSE{$column4 = "<A href='javascript:mbox();'>UNAVAILABLE</A>";} } //Check display value and print row IF($display) { if(substr($path, 0, 5) == "file:") { $filename = substr($path, 5); if(file_exists($filename)) { $basename = substr($filename, 0, strrpos($filename, '.')); $ext = strtolower(substr(strrchr($filename, '.'))); $files = glob("{$basename}.*.pdf"); foreach($files as $file) { if($ext == ".pdf") { $column4 = "{$file} <a href=\"pdf.php?src={$file}\">VIEW</a><br />\n"; } if($ext == ".jpg") { $column4 = "{$file} <a href=\"jpg.php?src={$file}\">VIEW</a><br />\n"; } } } else { $column4 = "Not Available"; } } }
  5. I don't think the glob function is working because the files that need to be accessed are on a shared network drive. Would that screw things up?
  6. When I try to change or apply the glob function to the code here, it doesn't work right. Please help.
  7. Okay, I screwed up somehow, because the code I put up before isn't where the path is being built... I guess... Here is the code that has an effect on the actual path... //Check display value and print row IF($display) { //Check if file exists IF(substr($path, 0, 5) == "file:") { IF(file_exists(substr($path, 5))) { IF(strtolower(substr($path, -4, 4)) == ".pdf") { $column4 = "<A HREF=pdf.php?src=".substr($path,5).">VIEW</A>"; } IF(strtolower(substr($path, -4, 4)) == ".jpg") { $column4 = "<A HREF=jpg.php?src=".substr($path,5).">VIEW</A>"; } } ELSE{$column4 = "Not Available";} } So can I throw the glob function somewhere in here...?
  8. yes $path brings you right to the file, but now were adding new files that have the same name but just have a timestamp added to the end of the file right before the file extension type.
  9. I need to display multiple files that have a similar file name, but there are timestamps added to the filename once its been modified. What could I use in PHP to display all these files? Right now I use a $path variable that looks into a SQL table to build the path to the folder that the files reside in.. ELSEIF($Recordmyrow['Applicatio'] == "pdf file") { IF($securityvalue != "P"){$display = false;} IF(file_exists(substr($path, 5))){} ELSE{$column4 = "<A href='javascript:mbox();'>UNAVAILABLE</A>";} } So there is a file called file1.pdf then another one called file1.mmddyyyy.pdf My code shows file1.pdf but not file1.mmddyyyy.pdf Is there some kind of wildcard I can use to get it to show all the files if they exist?
  10. Okay, I have a problem. I need to display multilple output of a file with a similar file name I.E. file1: 6002010.pdf file2: 6002010.mmddyyyy.pdf Now the first part of the file stays the same, but there is a time stamp on modified versions of the file. But in my output I need to display all the files with the 6002010. Could I use a wildcard such as 6002010* to get all the files to output on the screen? Or do I need to use a regular expression?
  11. Nevermind! I fixed it, it was because I had left the previous while{} statement there. THANK YOU VERY MUCH FOR YOU HELP! YOU SAVED MY BRAIN!
  12. Thanks litebearer, you got it to show seperate records in the same row, but now its only showing two records and not looping through the rest of the table
  13. Thanks, I will change the PHP tags. But I still need help on getting two different records in the same row...
  14. Now it only shows one column repeating, I wanted two records to show in the same row.
  15. Hey everyone, I've just undertaken my first PHP project and I'm trying to build an HTML table that lists businesses by category. The problem I am having is that the output of the PHP shows the first record in the first row both columns and this happens with every record after that. The Code: <?php // Set the error(s) reporting level error_reporting(E_ALL); ini_set("display_errors", 1); $category = "Professional Services"; // Open a connection link to your Database Engine $link = mysql_connect('localhost', 'liecon63_bizdir', 'pass') or die("Connection Error : " . mysql_error()); // Select the database to work with mysql_select_db('liecon63_bizdir') or die("Database Selection Error : " . mysql_error()); // Define your query $sqlquery = "SELECT * FROM bizdir WHERE bizcategory = '".$category."'"; // Execute the query (returning a result set in this case $sqlresult = mysql_query($sqlquery) or die("Query Error : " . $sqlquery . "<br /> Error: " . mysql_error()); // Validate that the query returned records if (mysql_num_rows($sqlresult) > 0) { // Start display of the records echo "Business Category : " . $category . "<BR />"; echo "<table>"; // Loop through your result set to process the results while ($row = mysql_fetch_array($sqlresult, MYSQL_ASSOC)) // here you can simply use mysql_fetch_assoc() instead { // Process your records here... like ?><table border="0" width="100%" id="table3"> <td width="400"><tr> <td><?php echo $row['bizname']; ?> <br> <?php echo $row['bizaddress']; ?> <br> <?php echo $row['bizcity']; ?>, <?php echo $row['bizstate']; ?> <?php echo $row['bizzip']; ?> <br> <?php echo $row['bizphone']; ?></td> <td><?php echo $row['bizname']; ?> <br> <?php echo $row['bizaddress']; ?> <br> <?php echo $row['bizcity']; ?>, <?php echo $row['bizstate']; ?> <?php echo $row['bizzip']; ?> <br> <?php echo $row['bizphone']; ?></td> </tr> </table> <? } echo "</table>"; } else { echo "No records have been found for the category " . $category; } // Close your Db Engine Link mysql_close($link); ?> The Output: <BODY onLoad="changeBkg()" id="body" TEXT="#000000" LINK="#FF0000" ALINK="#FF0000" VLINK="#FF0000"> Business Category : Professional Services<BR /><table><table border="0" width="100%" id="table3"> <td width="400"><tr> <td>Blumstein Accounting <br> 1476 Blue Spruce Lane <br> Wantagh, New York 11793 <br> (516) 221-6161</td> <td>Blumstein Accounting <br> 1476 Blue Spruce Lane <br> Wantagh, New York 11793 <br> (516) 221-6161</td> </tr> </table> <table border="0" width="100%" id="table3"> <td width="400"><tr> <td>Sachem Dental Group <br> 470 Patchogue Holbrook Rd <br> Holbrook, New York 11741 <br> (631) 589-8485</td> <td>Sachem Dental Group <br> 470 Patchogue Holbrook Rd <br> Holbrook, New York 11741 <br> (631) 589-8485</td> </tr> </table> <table border="0" width="100%" id="table3"> <td width="400"><tr> <td>Care Plus Chiropractic <br> 1150 Sunrise Highway <br> Bayshore, New York 11706 <br> (631) 665-1150</td> <td>Care Plus Chiropractic <br> 1150 Sunrise Highway <br> Bayshore, New York 11706 <br> (631) 665-1150</td> </tr> </table> </table></html> Please HELP!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.