Jump to content

This has the same css but is adifferent size ! o.O


TeddyKiller

Recommended Posts

I have a script that when you post, it uses jquery to update it.

update_data.php

<?php
session_start();
include('inc/config.php');
include("inc/functions.php");
$user = check_user($secret_key);

if(isset($_POST['content']))
{
$content = $_POST['content'];
$time = time();
$query = mysql_query("INSERT INTO `horblewall` (user_id, comment, posted) VALUES ('$user->id', '$content', '$time')") or trigger_error(mysql_error());
$query = mysql_query("SELECT * FROM horblewall order by posted desc");
$r = mysql_fetch_array($query);

$q = mysql_query("SELECT * FROM `users` WHERE `id`=".$r['user_id']."");
$rw = mysql_fetch_array($q);
      
echo '<div style="border-bottom:1px solid #e11919;" class="bar'.$r['id'].'">
        <div style="text-align:left; min-height:90px;">
        <div style="float:right; width:105px;">Posted on<br />'.date("d.m.y H:i", $r['posted']).'<br />
        <br />Msg no. '.$r['id'].'<br />';
        if($user->level == '9'){ echo '<br /><span class="delete_button"><a href="#" id="'.$r['id'].'" class="delete_update">Delete</a></span>'; }
        echo '</div>
        
        <div style="float:left; width:80px; text-align:center;"><img src="resize_image.php?file='.$rw['avatar'].'&size=70" />
        <br /><a href="#">'.ucwords($rw['username']).'</a></div>
        
        <div style="margin-right:120px; margin-left:95px;"><p>'.$r['comment'].'</p></div>
        </div>
        </div>';
}
?>

 

update jquery

    $(".post").click(function() {
       var boxval = $("#message").val();
       var dataString = 'content='+ boxval;

       if(boxval=='') {
           alert("Please Enter Some Text");
       } else {
           $("#flash").show();
           $("#flash").fadeIn(400).html('<span class="loading">Loading Comment...</span>');

           $.ajax({
               type: "POST",
               url: "update_data.php",
               data: dataString,
               cache: false,
               success: function(html){
                   $("ol#update").prepend(html);
                   $("ol#update li:first").slideDown("slow");
                   document.getElementById('content').value='';
                   document.getElementById('content').focus();
                      $("#flash").hide();
               }
           });
       } 
       return false;
    });

 

And the case that displays the comments and stuff.

case "wall":

    if(isset($_POST['submit'])){
        $comment = mysql_real_escape_string($_POST['message']);
        if(empty($comment) || $comment == 'Cannot be empty!' || $comment == 'Posted!'){
            $error = 'Cannot be empty!';
        }
        if(!isset($error)){
            $time = time();
            $query = mysql_query("INSERT INTO `horblewall` (user_id, comment, posted) VALUES ('$user->id', '$comment', '$time')") or trigger_error(mysql_error());
            $error = 'Posted!';
        }
    }
    
    echo '
    <form method="post" action="">
<table><tr>
  <td>
  <textarea name="message" id="message" cols="52" rows="2">'.$error.'</textarea>
  </td><td>
  <input type="submit" name="post" id="post" value="Post" style="width:60px;" class="post"/>
  <br />
  <input type="reset" name="reset" id="reset" value="Clear" style="width:60px;"/></td>
  </tr>
</table>
</form>
    ';
    
    $query = mysql_query("SELECT * FROM `horblewall` ORDER BY `posted` desc");
    echo '<div id="flash"></div>
    <ol id="update" class="timeline" style="width:100%;"></ol>';    
    while($r = mysql_fetch_array($query)){
        $q = mysql_query("SELECT * FROM `users` WHERE `id`=".$r['user_id']."");
        $rw = mysql_fetch_array($q);
        echo '
        <div style="border-bottom:1px solid #e11919;" class="bar'.$r['id'].'">
        <div style="text-align:left; min-height:90px;">
        <div style="float:right; width:105px;">Posted on<br />'.date("d.m.y H:i", $r['posted']).'<br />
        <br />Msg no. '.$r['id'].'<br />';
        if($user->level == '9'){ echo '<br /><span class="delete_button"><a href="#" id="'.$r['id'].'" class="delete_update">Delete</a></span>'; }
        echo '</div>
        
        <div style="float:left; width:80px; text-align:center;"><img src="resize_image.php?file='.$rw['avatar'].'&size=70" />
        <br /><a href="#">'.ucwords($rw['username']).'</a></div>
        
        <div style="margin-right:120px; margin-left:95px;"><p>'.$r['comment'].'</p></div>
        </div>
        </div>';
    }
    echo '<br />';
    
    break;

 

If I post an comment, or whatever.. it displays smaller, than if I refresh it to get the current comments.. if you get me. The css is the same, there is no other css needed for this, (I even copy and pasted the css even though its not being used.. just incase I was missing something but this did not work)

 

To see what I mean.. take a look at the image.

horbletest.png

Archived

This topic is now archived and is closed to further replies.

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