I have set up my own news submission system, basically you write an article and it is 
posted into a mysql database and then anyone can use a couple of lines of java script 
to access the various news articles.

I have noticed a bug though, in that when I put in particularly long articles and then 
click to view them only part of the article is shown. Now firstly I thought it might 
be the formatting of my show article page but its not and then I changed field in my 
database that stores the article from a text data type to a longtext which can handle 
a ridiculous amount of characters.

So I'm not sure why this is happening, when I perform a select query in mysql the 
article is displayed but I can't see at what point it finishes, plus after text 
flashes up it is followed by the character - mulitple times. I'm not sure if this is 
normal.

Not sure either if it has anything to do with my submission form. Think it must be 
something to do with storing it in the database because the show file would show all 
of what is in that field in the database.

Here are the two files.

add form:
<html>
<head>
<title> Upload a News Article </title>
</head>
<body bgcolor="#FFFFFF">
<a href="http://www.testhouse.org.uk";>
<img border="0" src="testhouse.gif">
</a>

<form action="submitnews.php" name="post">
<input type="hidden" name="articleId" value="NOT NULL">

<table border="0" cellpadding="0" cellspacing="0" bordercolor="#111111" width="100%">

<tr>
<td width="100%" bgcolor="#999999" height="22" colspan="2">
<p style="margin-left: 10"><b><font face="Verdana" size="2" color="#FFFFFF">
Upload a News Article</font></b></td>

</tr>

<tr>
<td width="100%" bgcolor="#FFE300" height="22" colspan="2">
<br>
<p style="margin-left: 10"><b><font face="Verdana" size="2" color="#FFFFFF">
</font></b></td>

</tr>


<tr>
<td width="15%" bgcolor="#FFE300">
<p style="margin-left: 10"><font face="Verdana" size="2">
Article Title:</font></td>
<td width="85%" bgcolor="#FFE300">
<input type="text" name="title" size="20" maxlength="20"></td>
</tr>

<tr>
<td width="100%" bgcolor="#FFE300" height="22" colspan="2">
<br>
<p style="margin-left: 10"><b><font face="Verdana" size="2" color="#FFFFFF">
</font></b></td>

</tr>

               
<tr>
<td width="15%" bgcolor="#FFE300">
<p style="margin-left: 10"><font face="Verdana" size="2">
Article Body:</font></td>
<td width="85%" bgcolor="#FFE300">
<textarea name ="content" rows=16 cols=60 input type="text" 
name="content"></textarea></td>
</tr>
              

<tr>
<td width="15%" bgcolor="#FFE300">
<p style="margin-left: 10"><font face="Verdana" size="2">
</font></td>
<td width="85%" bgcolor="#FFE300">
<br>
<input type="submit" name="submit" value="Publish"></td>
</tr>

<tr>
<td width="100%" bgcolor="#FFE300" height="22" colspan="2">
<br>
<p style="margin-left: 10"><b><font face="Verdana" size="2" color="#FFFFFF">
</font></b></td>
</tr>


<tr>
<td width="100%" bgcolor="#999999" height="22" colspan="2">
<br>
<p style="margin-left: 10"><b><font face="Verdana" size="2" color="#FFFFFF">
</font></b></td>

</tr>

        </table>
        </form>


</body>
</html>

This is the show part, very simple.

<?php

mysql_connect ("localhost");

mysql_select_db ("content");



$result = mysql_query ("select * FROM articles WHERE articleId='$articleId'");


while ($row = mysql_fetch_row($result))

{

printf ("<tr><td>%s</td></tr>",nl2br($row[2])); 



}


?>
<a href="getfile.php">back </a>

Probably something very simple but thanks in advance as usual.





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to