473,246 Members | 1,703 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,246 software developers and data experts.

displaying <DIR> in opening text files with table

22
hello guys.. how can i display the <DIR> in my opened files from my text file with table?.. htmlspecialchars is useless.. it always "Warning: file_get_contents() expects parameter 1 to be string, resource given" here's my code for you to see the problem..

<?php

$fc = fopen("Check.txt","r");

echo "<table border=\"5\" cellpadding=\"0\" cellspacing=\"2\">\n";

while($handle = fgets($fc,1024)) {

$content =split("[ ]+",$handle);

list($w1,$w2,$w3,$w4,$w5,$w6,$w7,$w8) = $content;
$v = $content[8];
for ($i=5; $i<count($content); $i++) {
$v = $content[$i];
$cont = htmlspecialchars(file_get_contents($fc));
}
echo "<tr><td><pre>".$w1."</td>
<td><pre>".$w2."</td>
<td><pre>".$w3."</td>
<td><pre>".$w4."</td>
<td><pre>".$w5."</td>
<td><pre>".$w6."</td>
<td><pre>".$w7."</td>
<td><pre>".$w8."</td></tr>";
}
echo "</table>";

?>

hope anyone can help plz... thank you guys
Dec 4 '07 #1
1 1886
code green
1,726 Expert 1GB
htmlspecialchars is useless.. it always "Warning: file_get_contents() expects parameter 1 to be string, resource given
This is nothing to do with htmlspecialchars, it is a file error[PHP]$fc = fopen("Check.txt","r");..
..
..
$cont = htmlspecialchars(file_get_contents($fc));[/PHP]Hopefully you can see the error now.
fopen() returns a file resource handle.
file_get_contents() expects a string of a filename.
If using fopen() then use fread to get the contents.
file_get_contents() opens the file, reads the contents then closes the file
Dec 4 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Michael Hamm | last post by:
Hi, I'm trying to write a <form> whihc will retrieve a Web page on another server. I have (essentially) this: <form action="http://cgi.cs.indiana.edu/~oracle/digest.cgi"> <input...
6
by: Matt Adams | last post by:
I want define for a couple of words inside a longer text with different font specifications. I declared it like: ....text before.... <FONT class=aaa> these text should get other attributes...
0
by: Daimy | last post by:
I meet the same problem below, please help me! Thanks! //written by some one I have developed a windows forms user control, which I am going to host in Internet Explorer.. I am familiar...
13
by: onetitfemme | last post by:
I think browsers do it pretty much by default. How can you avoid that? It just doesn't look right/pretty for short definitions and also how can you not indent the whole <dd> so that in stead of...
19
by: ashkaan57 | last post by:
Hi, I have a page in a right-to-left language and I am trying to make some bulleted lists using <ul>, but it puts the bullets to the left. Is there any way I can set the bullets to be on the...
8
by: ehcy | last post by:
hello guys.. i'ts me again i have something to know.. i have a little problem in my program.. i have now open my file called Check.txt.. but it is not exactly the output.. because the original is......
12
by: Pablo Suarez | last post by:
When I code #include "myheader.h" then this header file is searched in the current directory. But where does the compiler search the header file when I write #include <myheader.h>
24
by: Chris F.A. Johnson | last post by:
On 2008-07-09, Denis McMahon wrote: If the left-hand column contains any text, use em rather than px to size it. In CSS, less is more. Most problems are caused by specifying too much rather...
2
by: Shahid | last post by:
Hi, I am parsing an .HTML file that contains following example code: <div> <p class="html_preformatted" awml:style="HTML Preformatted" dir="ltr" style="text-align:left"><span...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.