i made a php script (i know this is html, but it is an html problem) it will display the news for my site, and i want it to align the date to left most part of its table (the whole table is based off of kerms news table, but mod'ed to make it a little simpiler and thinner) i have in the code to "<td align="right">" but it doesn't make it align right, im really confused, it comes out alright when you view the html sorce of the page Question you can see it at http://mikwit.com/list3.php

Thanks for the help
You have to make the table be right-aligned.

<table align="right" valign="top">...stuff</table>
thanks Kerm, I saw on the front page that you were trying to make an automated news system, and i just finished mine (php and mysql) if you want it just pm me, if not its fine (im adding a simple comment system too(maybe, some annyoing kids from my gradeschool will probably spam it(like my old shoutbox)))
mike wrote:
(im adding a simple comment system too(maybe, some annyoing kids from my gradeschool will probably spam it(like my old shoutbox)))

Laughing Tell me about it.

I'll probably have it look exactly as it does now, with the discuss link etc, but have the backend make it easier for me to add articles. I then won't have to edit index.html and news.html every time I add an article.
It consists of 3 main parts

1. Mysql data base (news)
| num (auto inc) | name (title) | date | text |

2. Adding news script
Newnews.html

Code:
<html>
<body>
<form action="newsform.php" method="post"><br>
<input type="text" name="name" value="title"><br>
<input type="text" name="date" value="date & time"><br>
<textarea type="textarea" name="text" value="text" ROWS="10" COLS="100"></textarea><br><br>
password:<input type="password" name="pass" value="DB password"><br>
<input type="submit" value="Add"><br>
</form>


newsform.php

Code:
<?php
$username="URSERNAME";
$password=$_POST['pass'];
$database="DATABASE";
$host="localhost";
$text=$_POST['text'];
$date=$_POST['date'];
$name=$_POST['name'];

mysql_connect($host,$username,$password);
@mysql_select_db($database);


$sqlstring="Insert into news (name, date, text) values('$name', '$date', '$text')";
mysql_query($sqlstring);

?>


3. Drawing Up News (news.php)

Code:

ALL YOUR NORMAL HTML CODE OUT HERE

<?php
$username="USERNAME";
$password="PASSWORD";
$database="DATABASE";
$host="localhost";
   mysql_connect($host,$username,$password);


@mysql_select_db($database) or die( "Unable to select database");


$query = 'SELECT `name`, `date`, `text` FROM `news` ORDER BY `num` DESC';
$result = mysql_query($query) or die('query:<br />'.mysql_error());

while ($row = mysql_fetch_assoc($result)){
print ' ALL YOUR PRE ARTICAL NAME STUFF HERE';
echo "{$row['name']}";
print 'ALL PRE DATE STUFF HERE';
echo "{$row['date']}";
print ' HERE WOULD BE LINK TO DISCUSS STUFF';
print ' I THINK YOU GET IT BY NOW';
echo "{$row['text']}";
print '  ';
}
?>
ALL YOUR FOOTER STUFF CAN GO HERE


that will display all the news in the data base, to make it display a limited number (say 5) just replace

Code:
$query = 'SELECT `name`, `date`, `text` FROM `news` ORDER BY `num` DESC';

with

Code:
$query = 'SELECT `name`, `date`, `text` FROM `news` ORDER BY `num` DESC LIMIT 0, 5';


Should work well

Spring break sucks when everyone else in you family has school or is working
lol, that looks cool, but right now I am determined not to over complicate my site, since most of it doesn't work yet anyways. One of these days I will figure out what is plaguing the archive code...
Good idea. Mike - I meant "tell me about it" figuratively Laughing
Looks good, though.
im just to lazy to write up a explanation of how it works. I suck at descriptions, and it was a lot easier just to copy and paste

My sever lack of sleep is getting to me

EDIT: I would like it (an atempt to gain a good page rank(backlinks)) if you could put a little link to mikwit.com on any page that has the script on it, where its placed doesn't really matter, as long as its there
Sure, I definitely will if I use that. I don't know if I will though Very Happy
I found a simple and easy way to get news on the main page on my site, phpbb and ssi. I found a mod that all I have to do is make a forum called news with limited access (Only mods can start threads) and then in my index.php say
Code:
include('http://acesclan.info/forum/ssi/include.php?forum_id=2&post_count=7');
You can use shtml too, just say
Code:
<!--#include file="/forum/ssi/include.php?forum_id=2&post_count=7" -->
It is nice and you can make the news formated anyway you like. I don't have a link (I'm too lazy to find it Very Happy ) But you can just google "Bizzar.SSI" and you will find it.
That's cool. I think I'll start from the ground up though. Smile
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement