Jump to content

dannyb785

Members
  • Posts

    544
  • Joined

  • Last visited

Posts posted by dannyb785

  1. its correct code.

    just change file name to read.php.

    dats all.

    <?php
    $file = 'read.php';
    $handler = fopen($file, 'r');
    $contents = fread($handler, filesize($file));
    print $contents;
    fclose($handler);
    ?>

     

     

     

    uhhh... have you tested your code? He's saying he wants the code(I believe), not the output. Or I may have misread. He wasn't clear anyways when he said he wants the content of the file. Since php has code, and then changes to show html, if you to that with .php, if will give you the html that would otherwise be shown if you viewed the file

  2. <?php
    $file = 'somefile.txt';
    $handler = fopen($file, 'r');
    $contents = fread($handler, filesize($file));
    print $contents;
    fclose($handler);
    ?>
    

    I think that's what you're looking for.

     

    he's looking to read a .php file. not a .txt(or any other) file.

  3. Every C, Java, etc teacher I had have told me that goto is built into most languages, but you should never never never ever ever ever use goto. And that it has been proven that anything you can do with goto, you can do with if else statements. And they've said you can get yourself very confused and in a lotta trouble using thrm. I suggest taking the time to learn loops and if else statements. You'll love them after a little time learning them.

  4. But if you're getting one news article, why would you need to loop? For that matter, what could possibly be looped through? If you're only grabbing one row, you do the mysql_fetch_array and then you're done. Right? What more is there to do?

     

     

    fake edit: oh I think I see what you're doing. You're going about it the wrong way though. your while loop needs to be like this

    $query = "SELECT * FROM News WHERE ***insert range of id's desired, such as id > '1' AND id < '10' or something *** ";
    $result = mysql_query($query);
    while($row = mysql_fetch_array))
    {
      echo "$row[article_name]<br>\n
              $row[article_description]<br>\n
              ";
    // and so on... variables made up bc I dont know what yours are called
    
    }
    

     

    oh, and if you're only trying to get one id(instead of a range of id's) just do the query like you have it, but then use the code I provided. The way I have it setup, it will automatically step through all rows selected, whether it's just one or 10 or however many

  5. So you there to be a php file, we'll call it test.php. You want to be able to do a function that will read its php code(not the resulting html it outputs) and display it in some form? Ummm... if there's a way, then facebook and other big sites that run in php would be easily hacked. I don't know of a way to do that.. unless there are some hacker tools out there.

  6. Are you talking about 1) on a webpage popup? Or 2) to be done automatically when viewing your page? Or are you talking about 3) just your browser when navigating the web?

     

     

    If it's the first one, use the following code in a link so the popup shows nothing but content

    onClick="window.open('viewimage.php?id=64','mywindow','scrollbars=yes,width=WIDTH,height=HEIGHT')">
    // ps you need to specify a WIDTH and HEIGHT
    

     

    If it's the second, I don't think you can do it(but maybe).

     

    If it's the last one, why on earth post in a php forum? You could google that(or rightclick the area and unselect things. or click the drag the stuff away)

  7. Firstly, I always like to put strings in double quotes, that way I can just easily insert variables as needed. For a piece of your code, I would do

    If (file_exists("http://thejsf.com/roster/images/members/$name_01.jpg"))
    

     

    lol and in typing that, I believe I found your error. In my experience, most of the time, when attempting to access or modify a file, it is case-sensitive. And it is likely that the images you are testing for end in ".jpg" instead of ".JPG" if they are, in fact, .JPG, then reply here and I'll give another suggestion(but that's probably it).

     

    p.s. quick note. You are able to display the image in html bc as far as I know, html isn't case-sensitive, whereas file functions in most cases are.

  8. if you want different colored links for different paragraphs, do something like the following:

     

    <style type="text/css">
    p.bluestuff {
    color:blue;
    }
    p.bluestuff a {
    color:blue;
    }
    p.whitestuff {
    color:white;
    }
    p.whitestuff a {
    color:white;
    }
    </style>
    ...
    <body>
    <p class="bluestuff">text and links here will be blue</p>
    <p class="whitestuff">same here except they will all be white</p>
    

     

    you'll need to add "text-decoration:none;" in the link modifier if you want the links to blend in perfectly with text.

     

    I will end this by saying I highly recommend against coloring the text the same as the links. Unless you have a special reason.

  9. if i understand you correctly you can use sum in mysql query.

    for exmaple:

    select sum(ammo) from cf_users

     

    Edit: TheBigRedStapler, you won.

     

    To refine this guy's post just a bit, do the following:

    select sum(ammo) as total from cf_users
    

     

     

    then, after you do mysql_fetch_array on the result of the query(for example, $row = mysql_fetch_array($result)), you'll have the sum in a the variable $row['total']. Basically whatever you do something as, is how you will reference it from then on(whether you need to restate the name in the query or need to use it as a variable after being "fetched"

  10. Its basically a basic forum and i was just doing some debuging and if i enter that javascript script into the text area and submit it, when i open the thread it opens an alert box. I figured php would have a function, is there anything that parses html in php or do i need to write one myself? basically just get it to ignore everything between the <> before i add it to a database.

     

     

     

    strip_tags("<  b>< i >< hr>..etc", $string); will do that for ya(without the spaces within the tags). But I read somewhere that there are ways around it... not sure what those ways are though

  11. Ok so the little bit of looking around that I did, I couldn't figure out how to start anything. I tries to buy a crew but it said i dont have enough money. And I don't know how much money I have. Nor do I know how to get money. I also clicked a race link and it said I have to get in my car.... which I have no idea how to do. I don't even know if I have a car.

     

    There are a bunch of links on the side. I'd say condense them, and also have a few quick start links at the home page(once logged in) to get new users going so they know what to do.

     

    Neat idea, but since I don't think this is very common(if at all), most people won't know what to do or how to get started.

  12. Look at the values you're trying to enter into the database.

     

    $form_description, $data, $form_data_name, $form_data_size, $form_data_type

     

    where are these values coming from?

     

     

    Also, you're adding slashes to the blank value of the resource returned by fopen. You're supposed to open the file, and then go line by line through it. Your code simply doesn't do what you want it to do.

     

    php, like C and every other language, unfortunately do what you tell them to do, not what you want them to do.

  13. Someone correct me if I'm wrong... this requires the .htaccess file to be modified

     

    I have a similar setup with my page. Are you going to be making a form for you to submit the google map url? If so, you just submit the url(the part after '.com'), you just insert that into a table. The index of that database entry will be your "domain.com/index". Then you'd modify your .htaccess to convert "domain.com/something" into "domain.com/viewmap.php?id=something" and then on your viewmap.php page, you'd take in the $_GET['id'] variable and do a query for that row in your table. Then just use an iframe, or redirect or whatever to show the user the map.

  14. A few basic web design things..

     

    1) we don't need javascript telling us exactly the second, minute, hour of the day. All windows and mac computers have times already, and if we scrolled about 100 pixels down, we wouldnt be able to see it anyway. Keep just the date, if that(and even that's not necessary).

     

    2)The side nav links(I'm in FF) when you hover over the, you have to move the mouse quickly to get the pop out menu to stay. It shouldnt require a quick movement to stay. I'd say either move the popout menu close the the original link or get a new script to perform that operation.

     

    3)The site tells me nothing about what ev5unleash.com is. At this point, after skimming around, I can see that you are the host of a construction company. And a poorly designed site at that. Why not just grab and modify a few nice looking free templates?

     

    4) the tom and evan show page... horrible color scheme... burns the eyes. Change the bright red to something else. Like white.

     

    5) the page hit counter. Those went out of style in 1996... you really should remove it.. it makes your site look like it was made in '95 and never updated after.

  15. youtube has insane servers. They're, at any second, playing millions of videos(and hosting many more than what are currently playing). But yea, they have a Video table and a Video_Comment table, with a video key that references the video it's commenting on. Not hard to design. Very simple actually

  16. I'm not the greatest at reading code and knowing what you're trying to do. And it's especially hard if i don't know what you're trying to do and you don't explain what your problem is. Because we don't know what errors to look for.

     

    Can you give us

     

    a) What you wish to accomplish(by explaining what you mean by shortening the url code)

     

    b) what problems you are having with your code

×
×
  • 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.