Jump to content

Very wierd display


rofl90

Recommended Posts

OK I know its probably bad coding but heres my code:

 

	<?php
$userid = $_SESSION["id"];
$title = $_GET['title'];
$tox = $_GET['tox'];

$sqlread = "SELECT * FROM messages where tox='$userid' AND title='$title'";
$resultanin = mysql_query($sqlread) or die(mysql_error());
$myrow = mysql_fetch_array($resultanin);


if($tox != $userid) {
die("This message is not to you!");
}	

$sqlformessage = "SELECT * FROM messages WHERE title='$title' AND tox='$tox'";
$infox = mysql_query($sqlformessage);
$resultex = mysql_fetch_array($infox);

$querya = "SELECT * FROM messages where tox='$tox'";
$resulta = mysql_query($querya) or die(mysql_error());



$row = mysql_fetch_array($resulta);

$from = $row['fromx'];
$queryas = "SELECT * FROM users WHERE id='$from'";
$resultas = mysql_query($queryas) or die(mysql_error());
$fetcher = mysql_fetch_array($resultas);


$time = $resultex['time'];
$fromuser = ucwords(strtolower($fetcher['user']));
$fromonline = $fetcher['online'];
$time = $resultex['message'];
?>
<table align="center" border="0" cellpadding="6" cellspacing="1" width="100%">
  <tbody>
    <tr>
      <td colspan="2">Private Message: <?php echo $title; ?> </td>
    </tr>
  </tbody>
</table>
<!-- post # -->
<table id="post" align="center" border="0" cellpadding="6" cellspacing="1" width="100%">
  <tbody>
    <tr>
      <td><div>   </div>
          <div>
            <!-- status icon and date -->
            <?php echo $time; ?><!-- / status icon and date -->
        </div></td>
    </tr>
    <tr>
      <td><!-- user info -->
          <table border="0" cellpadding="0" cellspacing="6" width="100%">
            <tbody>
              <tr>
                <td>
			<img src="http://codeetech.com/backend/images/charliesavatar.gif" alt="<?php echo $fromuser; ?>'s Avatar" border="0" />
			</td>
                <td nowrap="nowrap"><div id="postmenu_"> <strong><?php echo $fromuser; ?> </strong>  
			<?php
			if($fromonline == '1') {
			?>
			<img title="<?php echo $fromuser; ?> is online now" src="http://codeetech.com/backend/images/user_online.gif" alt="<?php echo $fromuser; ?> is online now" border="0" />
			<?php
			}
			if($fromonline == '0') {
			?>
			<img src="http://www.codeetech.com/backend/images/user_offline.gif" alt="<?php echo $fromuser; ?> is offline" border="0" />
			<?php } ?>
			</div>
                    <div><strong><?php echo $fromslogan; ?></strong></div>
                    <div><img src="http://www.codeetech.com/backend/images/sitemanager.gif" border="0" /></div></td>
                <td width="100%"> </td>
                <td nowrap="nowrap" valign="top"><div>
                    <div></div>
                  <div></div>
                  <div> </div>
                </div></td>
              </tr>
            </tbody>
          </table>
        <!-- / user info -->
      </td>
    </tr>
    <tr>
      <td id="td_post_"><!-- message, attachments, sig -->
          <!-- icon and title -->
          <div> <strong>Title</strong> </div>
          <hr size="1" />
<br /><br />
<?php echo $message; ?>lol
          <div>
	  

        </div>

<div align="right">
            <!-- controls -->
<a href="http://codeetech.com/backend/privatemessages.php?to=<?php echo $fromuser; ?>&subject=<?php echo $title; ?>"><em><strong>Reply!</strong></em></a></div></td>
    </tr>
  </tbody>
</table>

 

as you can see the message is CLEARLY below the title and heres the output

 

Private Message: lol

 

loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest

 

Andreas's Avatar

Andreas  Andreas is online now

 

Title

 

 

lol

 

Reply!

 

If you look just after the echo i put lol and the lol has come out below the title, what have i done wrong ;S

Link to comment
Share on other sites

<tbody>, do you really need those? try removing them

 

	<?php
$userid = $_SESSION["id"];
$title = $_GET['title'];
$tox = $_GET['tox'];

$sqlread = "SELECT * FROM messages where tox='$userid' AND title='$title'";
$resultanin = mysql_query($sqlread) or die(mysql_error());
$myrow = mysql_fetch_array($resultanin);


if($tox != $userid) {
die("This message is not to you!");
}	

$sqlformessage = "SELECT * FROM messages WHERE title='$title' AND tox='$tox'";
$infox = mysql_query($sqlformessage);
$resultex = mysql_fetch_array($infox);

$querya = "SELECT * FROM messages where tox='$tox'";
$resulta = mysql_query($querya) or die(mysql_error());



$row = mysql_fetch_array($resulta);

$from = $row['fromx'];
$queryas = "SELECT * FROM users WHERE id='$from'";
$resultas = mysql_query($queryas) or die(mysql_error());
$fetcher = mysql_fetch_array($resultas);


$time = $resultex['time'];
$fromuser = ucwords(strtolower($fetcher['user']));
$fromonline = $fetcher['online'];
$time = $resultex['message'];
?>
<table align="center" border="0" cellpadding="6" cellspacing="1" width="100%">
    <tr>
      <td colspan="2">Private Message: <?php echo $title; ?> </td>
    </tr>
</table>
<!-- post # -->
<table id="post" align="center" border="0" cellpadding="6" cellspacing="1" width="100%">
    <tr>
      <td><div>   </div>
          <div>
            <!-- status icon and date -->
            <?php echo $time; ?><!-- / status icon and date -->
        </div></td>
    </tr>
    <tr>
      <td><!-- user info -->
          <table border="0" cellpadding="0" cellspacing="6" width="100%">
              <tr>
                <td>
			<img src="http://codeetech.com/backend/images/charliesavatar.gif" alt="<?php echo $fromuser; ?>'s Avatar" border="0" />
			</td>
                <td nowrap="nowrap"><div id="postmenu_"> <strong><?php echo $fromuser; ?> </strong>  
			<?php
			if($fromonline == '1') {
			?>
			<img title="<?php echo $fromuser; ?> is online now" src="http://codeetech.com/backend/images/user_online.gif" alt="<?php echo $fromuser; ?> is online now" border="0" />
			<?php
			}
			if($fromonline == '0') {
			?>
			<img src="http://www.codeetech.com/backend/images/user_offline.gif" alt="<?php echo $fromuser; ?> is offline" border="0" />
			<?php } ?>
			</div>
                    <div><strong><?php echo $fromslogan; ?></strong></div>
                    <div><img src="http://www.codeetech.com/backend/images/sitemanager.gif" border="0" /></div></td>
                <td width="100%"> </td>
                <td nowrap="nowrap" valign="top"><div>
                    <div></div>
                  <div></div>
                  <div> </div>
                </div></td>
              </tr>
          </table>
        <!-- / user info -->
      </td>
    </tr>
    <tr>
      <td id="td_post_"><!-- message, attachments, sig -->
          <!-- icon and title -->
          <div> <strong>Title</strong> </div>
          <hr size="1" />
<br /><br />
<?php echo $message; ?>lol
          <div>
	  

        </div>

<div align="right">
            <!-- controls -->
<a href="http://codeetech.com/backend/privatemessages.php?to=<?php echo $fromuser; ?>&subject=<?php echo $title; ?>"><em><strong>Reply!</strong></em></a></div></td>
    </tr>
</table>

 

post the html output from the page and we can confirm if the php code is -somehow- the culprit or not :)

 

hope this helps,

Link to comment
Share on other sites

Ok, your code didn't fix it but heres the output:

 

	<table align="center" border="0" cellpadding="6" cellspacing="1" width="100%">
    <tr>
      <td colspan="2">Private Message: lol </td>
    </tr>
</table>
<!-- post # -->

<table id="post" align="center" border="0" cellpadding="6" cellspacing="1" width="100%">
    <tr>
      <td><div>   </div>
          <div>
            <!-- status icon and date -->
            loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest loooooltest <!-- / status icon and date -->
        </div></td>
    </tr>

    <tr>
      <td><!-- user info -->
          <table border="0" cellpadding="0" cellspacing="6" width="100%">
              <tr>
                <td>
			<img src="http://codeetech.com/backend/images/charliesavatar.gif" alt="Andreas's Avatar" border="0" />
			</td>
                <td nowrap="nowrap"><div id="postmenu_"> <strong>Andreas </strong>  

							<img src="http://www.codeetech.com/backend/images/user_offline.gif" alt="Andreas is offline" border="0" />
							</div>
                    <div><strong></strong></div>
                    <div><img src="http://www.codeetech.com/backend/images/sitemanager.gif" border="0" /></div></td>
                <td width="100%"> </td>
                <td nowrap="nowrap" valign="top"><div>
                    <div></div>
                  <div></div>
                  <div> </div>

                </div></td>
              </tr>
          </table>
        <!-- / user info -->
      </td>
    </tr>
    <tr>
      <td id="td_post_"><!-- message, attachments, sig -->
          <!-- icon and title -->

          <div> <strong>Title</strong> </div>
          <hr size="1" />
<br /><br />
lol
          <div>
	  

        </div>

<div align="right">
            <!-- controls -->
<a href="http://codeetech.com/backend/privatemessages.php?to=Andreas&subject=lol"><em><strong>Reply!</strong></em></a></div></td>

    </tr>
</table>

Link to comment
Share on other sites

<?php
$time = $resultex['time'];
$fromuser = ucwords(strtolower($fetcher['user']));
$fromonline = $fetcher['online'];
$time = $resultex['message'];
?>

 

Why are you putting the message into the time variable., you've already set the time, but now $message isn't defined. I think you want

<?php
$time = $resultex['time'];
$fromuser = ucwords(strtolower($fetcher['user']));
$fromonline = $fetcher['online'];
$message = $resultex['message'];
?>

 

So you echo the time, then echo an empty variable (ie echo nothing) then lol, so lol appears after your message.

 

The reason you didn't find it is because the message IS displayed, but where $time should be displayed.

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.