SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Jan 2003
    Posts
    143
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    dynamic file_get_contents issue - loads entire database

    This script is meant to insert the text file, which corresponds to the $id.the text file is located in ../archive/sum/. this element all works well - too well, the problem is it includes all the summary files that are on the database, and not just the one that corresponds to the $id that is being requested.
    any help would be much appreciated.

    PHP Code:
      <?php 
             $id 
    $_GET['id'];
        
    $result = @mysql_query('SELECT summary FROM v');
        if (!
    $result) {
          exit(
    '<p>Error performing query: ' mysql_error() . '
     '
    );
        }
            
         while (
    $row mysql_fetch_array($result)) {
         
    $id $row['id'];
         
    $summary $row['summary'];
         
    $myFile file_get_contents("archive/sum/$summary");
         print 
    nl2br($myFile); 
          }
          
    ?>
    Thanks Again.

  2. #2
    SitePoint Zealot
    Join Date
    Aug 2004
    Location
    Madison, WI
    Posts
    191
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try changing your query to
    PHP Code:
    $result=@mysql_query("SELECT summary FROM v WHERE id=$id"); 

  3. #3
    SitePoint Zealot
    Join Date
    Jan 2003
    Posts
    143
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks that worked - whats weird is i know i tried that. i must have missed a speech mark or something.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •