Twentyoneth Posted April 5, 2006 Share Posted April 5, 2006 *solved*add the directory infront of files, simple error...[code]<?php$dir = "items/";if(is_dir($dir)) { $dh = opendir($dir); while (($items = readdir($dh)) !== false) { if (!preg_match('|-|', $items) && $items !== '.' && $items !== '..') { echo "<tr><td align='left'>$items</td><td align='center'>$items-bprice.php</td></tr>"; } } closedir($dh); } else { echo "no files."; }?>[/code]This code will read the "items/" directory and put the file names in "$items", but for "$items-bprice.php" part of the code, I would to include what is inside "items/$items-bprice.php", which would be something like "$1.94". If I include("$item-bprice.php"); nothing shows up (using include outside of the echo, not in the statement). Is there a way to go about including "$items-bprice.php"? Link to comment https://forums.phpfreaks.com/topic/6629-including-readdir/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.