Jump to content

[PHP+Mysql] Help with webpage not displaying


Warraven

Recommended Posts

Hi there, I recently posted on help with a PHP game and I have just run into another error. When I was making my site in Dreamweaver I put the code in, the background ect. And when I tested it the background was just a plain color with the buttons just as the alternate text and no images, I think it has something to do with the code;

<style type="text/css">
<!--
body {
background-color: #1F1E26;
background-image: url(images/Site.jpg);
background-repeat: no-repeat;
}
body,td,th {
color: #0F0;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
-->
</style>
<script type="text/javascript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<body onLoad="MM_preloadImages('images/Home Over.jpg','images/Login Over.jpg')"><table width="490" height="821" border="0">
  <tr>
    <td width="118" height="60"> </td>
    <td width="30"> </td>
    <td width="328"> </td>
  </tr>
  <tr>
    <td height="240"><table width="127" border="0">
      <tr>
        <td width="121" height="52"><a href="index.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Home','','images/Home Over.jpg',1)"><img src="images/Home Normal.jpg" alt="Home" name="Home" width="140" height="37" border="0" id="Home" /></a></td>
      </tr>
      <tr>
        <td height="41"><a href="main_login.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Login','','images/Login Over.jpg',1)"><img src="images/Login Normal.jpg" alt="Login" name="Login" width="140" height="37" border="0" id="Login" /></a></td>
      </tr>
      <tr>
        <td height="40"> </td>
      </tr>
      <tr>
        <td height="42"> </td>
      </tr>
    </table></td>
    <td> </td>
    <td><?php
session_start();
include($_SERVER['DOCUMENT_ROOT'] . '/connection.php');

$ID = $_SESSION["ID"];

$selected = mysql_query("SELECT * FROM members WHERE id='$ID'") or die(mysql_error());
if (mysql_num_rows($selected) > 0) {
while ($user = mysql_fetch_array($selected)) {

echo "Welcome ".$user["username"]."<br />";
echo "Evo State: ".$user["class_armor"]."<br />";
echo "E-Level: ".$user["level"]."<br />";
echo "E-XP: ".$user["exp"]."<br />";

echo "Health: ".$user["health"]."<br />";
echo "Strength: ".$user["strength"]."<br />";
echo "Agility: ".$user["agility"]."<br />";
echo "Intellect: ".$user["intellect"]."<br />";
}

}else {
echo "<p>Sorry there are no results for this person</p>";
}
?></td>
  </tr>
  <tr>
    <td height="513"> </td>
    <td> </td>
    <td> </td>
  </tr>
</table>

Please and Thankyou!

Link to comment
Share on other sites

sounds to me like your test file isn't in the same folder as all the supporting files (IE the pictures, any external files like a style sheet, a php include, js include, etc.)

 

I would make sure that the in the page's directory, all the image sources actually lead to he images. themselves

Link to comment
Share on other sites

No, that wouldn't be it but thanks. That is because it all worked untill I pasted in the Mysql+PHP bit into the page like images would show ect. Then when I pasted that into the code it didn't work. And I have the images in a folder above the page called "Images".

Link to comment
Share on other sites

Okay, I did that and put the starting session to the top yet it does the same error, here is my code now;

<?php
session_start();
?>
<style type="text/css">
<!--
body {
background-color: #1F1E26;
background-image: url(images/Site.jpg);
background-repeat: no-repeat;
}
body,td,th {
color: #0F0;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
-->
</style>
<script type="text/javascript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<body onLoad="MM_preloadImages('images/Home Over.jpg','images/Login Over.jpg')"><table width="490" height="821" border="0">
  <tr>
    <td width="118" height="60"> </td>
    <td width="30"> </td>
    <td width="328"> </td>
  </tr>
  <tr>
    <td height="240"><table width="127" border="0">
      <tr>
        <td width="121" height="52"><a href="index.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Home','','images/Home Over.jpg',1)"><img src="images/Home Normal.jpg" alt="Home" name="Home" width="140" height="37" border="0" id="Home" /></a></td>
      </tr>
      <tr>
        <td height="41"><a href="main_login.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Login','','images/Login Over.jpg',1)"><img src="images/Login Normal.jpg" alt="Login" name="Login" width="140" height="37" border="0" id="Login" /></a></td>
      </tr>
      <tr>
        <td height="40"> </td>
      </tr>
      <tr>
        <td height="42"> </td>
      </tr>
    </table></td>
    <td> </td>
    <td><?php
include($_SERVER['DOCUMENT_ROOT'] . '/connection.php');

$ID = $_SESSION["ID"];

$selected = mysql_query("SELECT * FROM members WHERE id='$ID'") or die(mysql_error());
if (mysql_num_rows($selected) > 0) {
while ($user = mysql_fetch_array($selected)) {

echo "Welcome ".$user["username"]."<br />";
echo "Evo State: ".$user["class_armor"]."<br />";
echo "E-Level: ".$user["level"]."<br />";
echo "E-XP: ".$user["exp"]."<br />";

echo "Health: ".$user["health"]."<br />";
echo "Strength: ".$user["strength"]."<br />";
echo "Agility: ".$user["agility"]."<br />";
echo "Intellect: ".$user["intellect"]."<br />";
}

}else {
echo "<p>Sorry there are no results for this person</p>";
}
?></td>
  </tr>
  <tr>
    <td height="513"> </td>
    <td> </td>
    <td> </td>
  </tr>
</table>

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.