Jump to content

[SOLVED] White space :(


jrws

Recommended Posts

Hey guys,

I don't know how to fix this problem, I have tried trim and everything. Please have a look at the picture included to see what I mean by white space:

whitespaceo.th.png

Its annoying because as I have said, I can't figure it out. Its not the database I have checked it, anyway here is the code to go along with it.

<?php
//View News
$title = 'News';
require_once ('libary/header.php');
if (isset($_GET['id']) && is_numeric($_GET['id']) 
&& isset($_GET['edit']) &&is_numeric($_GET['id']))
{
$id = $_GET['id'];
$sql = "SELECT * FROM news WHERE id = '$id'";
$result = mysql_query($sql)or die(mysql_error());
$row = mysql_fetch_array($result);
$u_id = $row['u_id'];
if ($_SESSION['u_id'] == $u_id || $_SESSION['u_level'] == 6){
	if(!isset($_POST['submit'])){
    ?><form action="<? echo $PHP_SELF; ?>" method = "post">
Title:<input type="text" name = "title" value="<?=$row['title'];?>" size="32"><br>
Author:<input type = "text" name = "author" disabled = "true" value = "<?=$row['author'];?>"><br>
    <textarea name = "data" id = "textbox">
    <?=trim($row['data']);?>
</textarea>
<br>
<input type = "submit" value = "Submit" name = "submit">
</form><?
}else{
$error = array();
$title = clean($_POST['title']);
$data = clean($_POST['data']);
$update = "UPDATE news SET title = '$title', data = '$data' WHERE id='$id'";
$update_result = mysql_query($update)or die(mysql_error());
if($update_result){
	echo 'Successfully updated article!<a href="'.$siteURL.'view_news.php?id='.$id.'"> View the updated post</a>';
}else{
	echo '<div class="error">Did not update article successfully. Please try <a href="'.$siteURL.'view_news.php?id='.$id.'&edit='.$id.'">again</a></div>';
}
}
    }else{
	echo 'Not authorised to view this page!';
}
    
} elseif (isset($_GET['id']) && is_numeric($_GET['id']))
{
    $id = clean($_GET['id']);
    $sql2 = mysql_query("SELECT * FROM `news` WHERE id='$id'") or die(mysql_error());
    $row = mysql_fetch_array($sql2);
    $u_id = $row['u_id'];
    $title = $row['title'];
    $data = trim(nl2br($row['data']));
    $author = $row['author'];
    echo '<h1>' . strtoupper($title) . '</h1>';
    echo '<small>By :<a href="' . $siteURL . 'profile.php?id=' . $row['u_id'] . '">' .
        $author . '</a><br></small>';
    echo '<p>' . $data . '</p>';
    if ($_SESSION['u_id'] == $u_id || $_SESSION['u_level'] == 6)
    {
        echo '<br> <a href="?id=' . $id . '&edit=' . $id . '">Edit this post</a>';
    } else
    {

    }
} else
{
    //Pagination
    $table = 'news';
    $rowsPerPage = 3;
    $data1 = 'title';
    $data2 = 'data';
    $link = 'post';
    include_once ('Pagnation.php');
    pagnation($table, $rowsPerPage, $data1, $data2, $link);
    /*Pagination*/
}
require_once ('libary/footer.php');
?>

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.