<?php
include "config.php";
include "connect_database.php";
function shortenText($input,$size){
if(strlen($input) > $size){
return substr($input,0,$size).'...';
} else {
return $input;
}
}
if (isset($_GET['id'])) {
$id = $_GET['id'];
}
else{
$result = mysql_query("SELECT * FROM communitynews") or die(mysql_error());
while($row = mysql_fetch_array( $result ))
{
echo "This shows just a part of the news. (click to read more)";
}
}
$result = mysql_query("SELECT * FROM communitynews WHERE id='$id' ") or die(mysql_error());
while($row = mysql_fetch_array( $result ))
{
echo "This shows the whole news.";
}
if (strlen(intval($_GET['edit'])) > 0) {
$id = (integer) $_GET['edit'];
}else{
echo "This is edit part. // This part never shows.";
}
?>
Cant get this to work. Everything works fine but not the navigation part for ?edit=id-goes-here.
I've just learned some basic php but i need the edit function -.-
I changed the echo's instead of mysql query's to text to display what i've gotten.
