Witam, jestem nowy na forum oraz początkującym programistą. (IMG:
http://forum.php.pl/style_emoticons/default/guitar.gif)
Napisałem prosty system niusów:
<?php
DEFINE ('DB_PASSWORD', '###'); DEFINE ('DB_HOST', 'localhost');
if (isset($_POST['submit'])) {
$text = $_POST['news_text'];
$author = $_POST['news_author'];
$topic = $_POST['news_topic'];
$topic_mini = $_POST['news_topic_mini'];
if ($author && $text) {
$query = "INSERT INTO news (news_text, news_author, news_topic, news_topic_mini)
VALUES
('$text', '$author', '$topic', '$topic_mini')";
if ($result) {
} else {
}
}
}
$query = "SELECT * FROM news ORDER BY news_id DESC";
if ($result) {
echo '<table width="900" align="center" border="1" bordercolor="black" style="border-collapse: collapse;">'."rn"; echo ' <td>Tytul: '.$row['news_topic'].'</td>'."rn"; echo ' <td>Opis: '.$row['news_topic_mini'].'</td>'."rn"; echo ' <td>Autor: '.$row['news_author'].'</td>'."rn"; echo ' <td>'.$row['news_text'].'</td>'."rn"; echo '</table><br />'."rn"; }
}
?>
<br />
<br />
<br />
<br />
<form action="ee.php" method="post">
Topic:<br />
<input type="text" style="width:200px" size="30" maxleght="100" name="news_topic" /><br />
Topic opis:<br />
<input type="text" style="width:200px" size="30" maxleght="100" name="news_topic_mini" /><br />
Nick:<br />
<input type="text" style="width:200px" size="30" maxleght="100" name="news_author" /><br />
Text:<br />
<textarea class="post" name="news_text" maxlength="255" cols="50" rows="10">Text.......</textarea><br />
<input type="submit" name="submit" value="Wyslij" />
</form>
Wszystko , pięknie chodzi . Lecz mam pytanie. Jak zrobić aby po wpisaniu index.php?id=(na przykład 1)
wyskakiwała news którego id jest 1 ?
Proszę o pomoc (IMG:
http://forum.php.pl/style_emoticons/default/smile.gif) .
Ten post edytował Mazur_pl 11.05.2007, 19:07:22