Php Vs Ie

Discussion in 'PHP' started by izlik, Apr 10, 2007.

  1. #1
    Hello, i have a page where people can upload picture and so on and my php code loads the picture from /img/ folder from an uniqe ID the picture was given in the database and saved with. now when i view the uploaded pictures in firefox they are shown just fine

    firefox Example:
    [photo 1] [photo 2] [photo 3]

    but when i view them in internet explorer they are on the other hand shown as bellow and i wonder why, and if anyone know how to solve this :/

    IE example:
    [photo 1]
    [photo 2]
    [photo 3]
     
    izlik, Apr 10, 2007 IP
  2. deques

    deques Peon

    Messages:
    206
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #2
    how does the code look like when you view the source code in explorer?

    do you have the images in table or something?
     
    deques, Apr 10, 2007 IP
  3. Felu

    Felu Peon

    Messages:
    1,680
    Likes Received:
    124
    Best Answers:
    0
    Trophy Points:
    0
    #3
    PHP would have nothing to do with it. Its a server side language and not a client side language. There must be some problems with your layout.
     
    Felu, Apr 10, 2007 IP
  4. KlearConcepts

    KlearConcepts Peon

    Messages:
    349
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I agree, It would be something your browser does and possibly not having IE support it.
     
    KlearConcepts, Apr 10, 2007 IP
  5. Eran-s

    Eran-s Peon

    Messages:
    50
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    He's right, show us the html+css code
     
    Eran-s, Apr 10, 2007 IP
  6. izlik

    izlik Well-Known Member

    Messages:
    2,399
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    185
    #6
    this is the only code i use


    
    <?
    $MYSQL_HOST = 'test';
    $MYSQL_USER = 'test';
    $MYSQL_PASSWORD = 'test';
    $MYSQL_DATABASE = 'test';
    
    mysql_connect($MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD);
    mysql_select_db($MYSQL_DATABASE);
    
    $res = mysql_query('SELECT *,unix_timestamp(tstamp) as utstamp FROM img
        ORDER BY tstamp DESC LIMIT 6');
    
    echo '<table cellspacing="3" cellpadding="1" border="2"><tr>';
    
    while ($row = mysql_fetch_assoc($res)) {
    
        $row['message'] = substr($row['message'],strpos($row['message'],' '));
    
        // $row['message'] = substr($row['message'],strpos($row['message'],' '));
        
    
        if ( file_exists('img/' . $row['id'] . '.jpeg') ) {
            $row['picture'] = 'img/' . $row['id'] . '.jpeg';
        } else $row['picture'] = '';
        
    
        if ( $row['picture'] != '' ) {
            echo '<a href="show.php?id=' . $row['id'] . '">';
            echo '<img width="125" src="' . $row['picture'] . '"></a>';
        }
        
        echo '</td>';
        echo '</tr>';
    }
    
    echo '</table>';
    ?>
    </p>
    
    Code (markup):
     
    izlik, Apr 10, 2007 IP
  7. clancey

    clancey Peon

    Messages:
    1,099
    Likes Received:
    63
    Best Answers:
    0
    Trophy Points:
    0
    #7
    You really should run HTML through a checker before putting it up on your website. Your code is not generating valid HTML. It should probably read:
    
    echo '<table cellspacing="3" cellpadding="1" border="2"><tr>';
    
    while ($row = mysql_fetch_assoc($res)) {
    
        $row['message'] = substr($row['message'],strpos($row['message'],' '));
    
        // $row['message'] = substr($row['message'],strpos($row['message'],' '));
        
    
        if ( file_exists('img/' . $row['id'] . '.jpeg') ) {
            $row['picture'] = 'img/' . $row['id'] . '.jpeg';
        } else $row['picture'] = '';
        
    
        if ( $row['picture'] != '' ) {
            echo '<td><a href="show.php?id=' . $row['id'] . '">';
            echo '<img width="125" src="' . $row['picture'] . '"></a></td>';
        }
    }
    
    echo '</tr></table>';
    ?>
    Code (markup):
    You were not starting and ending the table data segments of the HTML mark up and you were ending the table row on every loop. You only want to end it once to hope get the effect you seek.
     
    clancey, Apr 10, 2007 IP
  8. tinkerbox

    tinkerbox Peon

    Messages:
    55
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #8
    try this
    
    echo "<table cellspacing=\"3\" cellpadding=\"1\" border=\"2\"><tr>";
    
    while ($row = mysql_fetch_assoc($res)) {
    
        echo "<td>";
        $row['message'] = substr($row['message'],strpos($row['message'],' '));
    
        if ( file_exists('img/' . $row['id'] . '.jpeg') ) {
            $row['picture'] = 'img/' . $row['id'] . '.jpeg';
        } else $row['picture'] = '';
    
        if ( $row['picture'] != '' ) {
            echo '<a href="show.php?id=' . $row['id'] . '">';
            echo '<img width="125" src="' . $row['picture'] . '"></a>';
        }
        
        echo "</td>";
    }
        echo "</tr></table>";
    
    PHP:
    i think u miss add <td>
     
    tinkerbox, Apr 10, 2007 IP
  9. izlik

    izlik Well-Known Member

    Messages:
    2,399
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    185
    #9

    thanks :) that fixed the imiage problem with IE... but now every "background="img/meny.jpg" i had on the page stoped loading in IE insteed but works in firefox :(

    example, when i added the code above, the code bellow wont show up in IE but shows in Firefox. it's placed both at the end and before the php code.

    </p>
    
    <div align="center">
    
    <table border="0" ">
      <table id="table3" border="0" background="img/meny.jpg" cellpadding="0" cellspacing="0" height="62" width="863" id="table2">
        <tr>
          <td align="center">
            <b><font size="2" color="#FFFFFF">&nbsp;&nbsp;&nbsp; test <br>&nbsp;&nbsp;&nbsp; Beta 1.0 | <?php
    
    $mtime = explode(' ', microtime());
    $totaltime = $mtime[0] + $mtime[1] - $starttime;
    printf('Page loaded in %.3f seconds.', $totaltime);
    
    ?></font></b></td>
    	  </tr>
      </table>
    </div>
    Code (markup):
     
    izlik, Apr 10, 2007 IP