rincewind thank you that worked.. Now i'm tryin' to do an update and i can't seem to get that working.
error_reporting(E_ALL);
mysql_connect($dbhost,$dbuser,$dbpass) or die("You broke it");
@mysql_select_db("$dbname") or die("You broke the database");
$query="SELECT * from $table";
echo "<td><table width='100%' border='1'>
<tr><td colspan='7'><center>Edit News</center></td></tr>
<tr>
<th width='7%'>id</th>
<th width='90%'>news</th>
<th width='3%'>edit</th>
</tr>";.
$query = "SELECT * FROM $table ORDER BY id Desc";
$result=mysql_query($query);
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" .$row['id'] . "</td>";
echo "<td><textarea name='news' cols='50' rows='5'>" .$row['news']. "</textarea></td>";
echo "<td><form action='sendedit.php' method='post'>";
echo "<input type='hidden' name='news_id' value='$row[id]' />";
echo "<input type='submit' value='edit' /></form></td>";
echo "</tr>";
}
echo "</table>";
mysql_close();
?>
I get an error here with the $news Parse error: syntax error, unexpected T_VARIABLE.
error_reporting(E_ALL);
$news=_$POST['news'];
mysql_connect($dbhost,$dbuser,$dbpass) or die("You broke it");
@mysql_select_db("$dbname") or die("You broke the database");
$sqlquery = "UPDATE $table SET 'news' = $news WHERE 'id' = 'id'";
$results = mysql_query($sqlquery);
mysql_close();
print "It was sent"
?>
The line is where i got $sqlquery.. only thing i want to change is the news that is being changed.. the time/date and poster can stay the same even if someone else does the edit