Jump to content

Internet Explorer 7 hates my simple PHP code


anthonydamasco

Recommended Posts

Hey everyone.

 

I have a simple php script that was working fine until my company upgraded to IE7. IE7 just shows the background and nothing else.

 

It works on EI6, and firefox

 

	          <?php

$conn = mysql_connect("localhost","user","user") or die ( mysql_error() );
$db = mysql_select_db("ACCU") or die ( mysql_error() );


$search=$_POST["search"];
$result = mysql_query("SELECT * FROM phonelist");
$num = mysql_num_rows($result);
if ($num == "0"){
echo "Please revise your search.";
}else{
while($r=mysql_fetch_array($result))
{	
  
   $phoneid=$r["idphonelist"];
   $name=$r["name"];
   $ext=$r["ext"];
   $dept=$r["department"];
   $cell=$r["cellphone"];

   echo "
  <table width=\"515\" border=\"1\" cellpadding=\"0\" cellspacing=\"0\" bordercolor=\"#FFFFFF\">
  <tr>
    <td><table width=\"515\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
      <tr>
        <td width=\"178\">$name</td>
        <td width=\"40\">$ext</td>
        <td width=\"212\">$dept </td>
        <td width=\"85\">$cell</td>
      </tr>
    </table></td>
  </tr>
</table>
   ";
}
}
?>

 

any ideas.

Link to comment
Share on other sites

Try this,

 

I always escape from php when im ouputting alot of information. and then just echo the values.

 

		          <?php

$conn = mysql_connect("localhost","user","user") or die ( mysql_error() );
$db = mysql_select_db("ACCU") or die ( mysql_error() );


$search=$_POST["search"];
$result = mysql_query("SELECT * FROM phonelist");
$num = mysql_num_rows($result);
if ($num == "0"){
echo "Please revise your search.";
}else{
while($r=mysql_fetch_array($result))
{	
 
  $phoneid=$r["idphonelist"];
  $name=$r["name"];
  $ext=$r["ext"];
  $dept=$r["department"];
  $cell=$r["cellphone"];

?>
 <table width="515" border="1" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF">
 <tr>
   <td><table width="515" border="0" cellpadding="0" cellspacing="0">
     <tr>
       <td width="178"><?php echo $name; ?></td>
       <td width="40"><?php echo $ext; ?></td>
       <td width="212"><?php echo $dept; ?> </td>
       <td width="85"><?php echo $cell; ?></td>
     </tr>
   </table></td>
 </tr>
</table>
<?php
   }
}
?>

Link to comment
Share on other sites

Try this,

 

I always escape from php when im ouputting alot of information. and then just echo the values.

 

		          <?php

$conn = mysql_connect("localhost","user","user") or die ( mysql_error() );
$db = mysql_select_db("ACCU") or die ( mysql_error() );


$search=$_POST["search"];
$result = mysql_query("SELECT * FROM phonelist");
$num = mysql_num_rows($result);
if ($num == "0"){
echo "Please revise your search.";
}else{
while($r=mysql_fetch_array($result))
{	
  
   $phoneid=$r["idphonelist"];
   $name=$r["name"];
   $ext=$r["ext"];
   $dept=$r["department"];
   $cell=$r["cellphone"];

?>
  <table width="515" border="1" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF">
  <tr>
    <td><table width="515" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="178"><?php echo $name; ?></td>
        <td width="40"><?php echo $ext; ?></td>
        <td width="212"><?php echo $dept; ?> </td>
        <td width="85"><?php echo $cell; ?></td>
      </tr>
    </table></td>
  </tr>
</table>
<?php
    }
}
?>

You wouldn't actually have to echo them, you could use

<?= $cell; ?> 

instead of

<?php echo $cell; ?>

Link to comment
Share on other sites

It's still doing the same thing to me after I tried escaping from php

 

       <?php

$conn = mysql_connect("localhost","www2","accuoffice") or die ( mysql_error() );
$db = mysql_select_db("ACCU") or die ( mysql_error() );


$search=$_POST["search"];
$result = mysql_query("SELECT * FROM phonelist");
$num = mysql_num_rows($result);
if ($num == "0"){
echo "Please revise your search.";
}else{
while($r=mysql_fetch_array($result))
{	
  
   $phoneid=$r["idphonelist"];
   $name=$r["name"];
   $ext=$r["ext"];
   $dept=$r["department"];
   $cell=$r["cellphone"];

   ?>
  <table width="515" border="1" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF">
  <tr>
    <td><table width="515" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="178"><?php print $name; ?></td>
        <td width="40"><?php print $ext; ?></td>
        <td width="212"><?php print $dept; ?></td>
        <td width="85"><?php print $cell; ?></td>
      </tr>
    </table></td>
  </tr>
</table>
  <?php
}
}
?>

Link to comment
Share on other sites

You're code works fine for me in IE7, so there may be something else in other parts of you script that is causing the problems.

 

Here's some code that does what you're nested tables do, without the tables:

<div style="width:526px;border:1px solid black;display:block;clear:both;">
	<span style="width:178px;float:left;border:1px solid red"><?php echo $name; ?></span>
	<span style="width:40px;float:left"><?php echo $ext; ?></span>
	<span style="width:212px;float:left"><?php echo $dept; ?> </span>
	<span style="float:left"><?php echo $cell; ?></span>
	<div style="clear:both;line-height:0.01"> </div>
</div>

 

Try it and see if the problem still occurs.

 

Ken

Link to comment
Share on other sites

  • 3 months later...

hello my first post here :)

 

i think i have the exact same problem. No matter what script i'm puting into a page...it simply doesn't work in ie7. But it works like a charm in firefox. And i'm just wondering what's going on?

 

i use wamp.

 

any help?

Link to comment
Share on other sites

OMG! I just solved my problem... I feel so stupid :)

 

i was doing this...

 

in firefox i have a link button in favorities that loads the site with the correct test server url http://localhost/... etc.

 

BUT when  i was trying to view the same site with ie7 i was just doing a right click in index.php of my site and then open with -> internet explorer. That makes the url being sth like C:\wamp\www\... so test server wasn't working.

 

All fine now... :)

 

   

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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