Page 1 of 1

Need help figuring out error

Posted: Tue Apr 24, 2007 12:58 am
by recycled
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


I keep getting errors on my page and can not seem to figure out the reason.
The error im getting is:
Parse error: parse error, unexpected T_ECHO in index.php on line 11

Ive gone through and commented out parts to see if I can get around the error but every time a new error.
It's like nothing on this page will work.  Could it be an issue with the php versions or the permissions?

Here is my code:

Code: Select all

<?php
  include_once('db_fns.php');
  include_once('header.php');

  $handle = db_connect();

  $pages_sql = 'select * from pages order by code';
  $pages_result = $handle->query($pages_sql);
  print_r($db_connection)

  echo '<table border="0" width="400">';
     
  while ($pages = $pages_result->fetch_assoc()); 
  {
    $story_sql = "select * from stories
                  where page = '{$pages['code']}'
                  and published is not null
                  order by published desc";
   
    $story_result = $handle->query($story_sql);
    
    if ($story_result->num_rows) 
    {
      $story = $story_result->fetch_assoc();
      echo "<tr>
            <td>
              <h2>{$pages['description']}</h2>
              <p>{$story['headline']}</p>
              <p align='right' class='morelink'>
                <a href='page.php?page={$pages['code']}'>
                Read more {$pages['code']} ...
                </a>
              </p>
            </td>
            <td width='100'>";
      if ($story['picture'])
      {
        echo '<img src="resize_image.php?image=';
        echo urlencode($story[picture]);
        echo '&max_width=80&max_height=60"  />';
      }
      echo '</td></tr>';
    }
  }
  echo '</table>';

  include_once('footer.php');
?>
Thanks,
Everett


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Tue Apr 24, 2007 1:51 am
by evilchris2003
your missing a line end ";" on the preceding line (10)

also you should use the tags when posting code

Posted: Tue Apr 24, 2007 5:54 am
by Mohit_Prog
you [s]r[/s] are missing ";" on statement : print_r(...)

also [s]u[/s] you have put ";" at the end of the while statement. Remove that.

Need help with error

Posted: Wed Apr 25, 2007 6:24 pm
by recycled
Sorry about not including the tags in my post, won't happen again.

So I included the ";" after print_r() and removed the ";" after the while statement and now I get the following error:

Fatal error: Call to a member function on a non-object in /home/content/l/c/h/lchiaravallo1/html/test/admin/admin2/index.php on line 8

Any ideas?

Here is my code again:

Code: Select all

<?php
  include_once('db_fns.php');
  include_once('header.php');

  $handle = db_connect();

  $pages_sql = 'select * from pages order by code';
  $pages_result = $handle->query($pages_sql);
  print_r($db_connection);

  echo '<table border="0" width="400">';
     
  while ($pages = $pages_result->fetch_assoc())
  {
    $story_sql = "select * from stories
                  where page = '{$pages['code']}'
                  and published is not null
                  order by published desc";
   
    $story_result = $handle->query($story_sql);
    
    if ($story_result->num_rows) 
    {
      $story = $story_result->fetch_assoc();
      echo "<tr>
            <td>
              <h2>{$pages['description']}</h2>
              <p>{$story['headline']}</p>
              <p align='right' class='morelink'>
                <a href='page.php?page={$pages['code']}'>
                Read more {$pages['code']} ...
                </a>
              </p>
            </td>
            <td width='100'>";
      if ($story['picture'])
      {
        echo '<img src="resize_image.php?image=';
        echo urlencode($story[picture]);
        echo '&max_width=80&max_height=60"  />';
      }
      echo '</td></tr>';
    }
  }
  echo '</table>';

  include_once('footer.php');
?>
Everett

Posted: Thu Apr 26, 2007 2:06 am
by Mohit_Prog
print_r is generally used for printing an array.

and ypu have not define what is $db_connection?