madspof Posted June 28, 2007 Share Posted June 28, 2007 this is a script that i use to display files for a specific acount on my website i wanted to add a link from each file so that they could delete a file if they wanted. But when i add the extra href to the end of the echo the script does not display thing i have provided the original script and the one i have edited This is the original: <?php include "../status.php"; $cookie_info = explode("-", $_COOKIE['cookie_info']); $namecookie = $cookie_info[0]; $files = array(); $dir=opendir("./$namecookie"); while(($file = readdir($dir)) !== false) { if($file !== '.' && $file !== '..' && !is_dir($file)) { $files[] = $file; } } closedir($dir); natcasesort($files); echo "<ul>\n"; for($i=0; $i<count($files); $i++) { if($files[$i] != "index.php") echo "<li><a href=\"$namecookie/".$files[$i]."\">".$files[$i]."</a></li>\n"; } echo "</ul>\n"; ?> This is the edited script: <?php include "../status.php"; $cookie_info = explode("-", $_COOKIE['cookie_info']); $namecookie = $cookie_info[0]; $files = array(); $dir=opendir("./$namecookie"); while(($file = readdir($dir)) !== false) { if($file !== '.' && $file !== '..' && !is_dir($file)) { $files[] = $file; } } closedir($dir); natcasesort($files); echo "<ul>\n"; for($i=0; $i<count($files); $i++) { if($files[$i] != "index.php") echo "<li><a href=\"$namecookie/".$files[$i]."\">".$files[$i]."</a><a href="delete.php?del=$namecookie">delete </a></li>\n"; } echo "</ul>\n"; ?> Quote Link to comment Share on other sites More sharing options...
r-it Posted June 28, 2007 Share Posted June 28, 2007 i do not see the end of th a tag, that mite be your problem Quote Link to comment Share on other sites More sharing options...
madspof Posted June 28, 2007 Author Share Posted June 28, 2007 it is there but when i post the srcipt on the site it gets rid of it Quote Link to comment Share on other sites More sharing options...
per1os Posted June 28, 2007 Share Posted June 28, 2007 it is there but when i post the srcipt on the site it gets rid of it Which is exactly why you should always post code between the [ code ] and [ /code ] tags (without spaces of course) Quote Link to comment Share on other sites More sharing options...
madspof Posted June 28, 2007 Author Share Posted June 28, 2007 where is the button to enclose the script in thoses tags i cannot see it Quote Link to comment Share on other sites More sharing options...
per1os Posted June 28, 2007 Share Posted June 28, 2007 No button you manually write it in. IE: [ code ] <?php // your code pasted here ?> [ /code ] (without the extra spaces) Quote Link to comment Share on other sites More sharing options...
madspof Posted June 28, 2007 Author Share Posted June 28, 2007 orite okay wel here is the orignal code : <?php include "../status.php"; $cookie_info = explode("-", $_COOKIE['cookie_info']); $namecookie = $cookie_info[0]; $files = array(); $dir=opendir("./$namecookie"); while(($file = readdir($dir)) !== false) { if($file !== '.' && $file !== '..' && !is_dir($file)) { $files[] = $file; } } closedir($dir); natcasesort($files); echo "<ul>\n"; for($i=0; $i<count($files); $i++) { if($files[$i] != "index.php") echo "<li><a href=\"$namecookie/".$files[$i]."\">".$files[$i]."</a></li>\n"; } echo "</ul>\n"; ?> and here is the altered code: <?php include "../status.php"; $cookie_info = explode("-", $_COOKIE['cookie_info']); $namecookie = $cookie_info[0]; $files = array(); $dir=opendir("./$namecookie"); while(($file = readdir($dir)) !== false) { if($file !== '.' && $file !== '..' && !is_dir($file)) { $files[] = $file; } } closedir($dir); natcasesort($files); echo "<ul>\n"; for($i=0; $i<count($files); $i++) { if($files[$i] != "index.php") echo "<li><a href=\"$namecookie/".$files[$i]."\">".$files[$i]."</a><a href="delete.php?del=$namecookie">Delete</a></li>\n"; } echo "</ul>\n"; ?> Quote Link to comment Share on other sites More sharing options...
per1os Posted June 28, 2007 Share Posted June 28, 2007 parse error "</a><a href="helloi.php">hello </a></li>\n"; should be "</a><a href=\"helloi.php\">hello </a></li>\n"; Quote Link to comment Share on other sites More sharing options...
madspof Posted June 28, 2007 Author Share Posted June 28, 2007 Thanks for that couldnt of done it with out you anyway i have heard about parsing wt the hell is it i tihkn it has been cuasing quite al lot of my scripts to nt run correctly could u please give me a quick explanation Quote Link to comment Share on other sites More sharing options...
per1os Posted June 28, 2007 Share Posted June 28, 2007 Parse or Syntax errors are errors in code that causes the script to not compile. http://en.wikipedia.org/wiki/Parsing So basically every language has certain characteristics that you use to make it run, since the compiler does not have a human brain it has to have certain rules, like a variable in PHP is denoted by a $ and literal data is encapsulated in " " or ' ' So it is sort of like the grammar for programming. When you are reading someones paper you take in the information, if they missed a period somewhere or have a fragmented sentence that does not make sense it generally causes you to pause and or stop. Same with compilers. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.