witam wszystkich,jako ze phpa to ja za bardzo nie znam,ale chce sie go nauczyc..oczywiscie naciolem sie na problem
minowicie .napisalem takie cos (nizej kod) i za cholere nie chci mi pluc danych zawartych w bazie,a w bazie mam pare rzecz
szukalem sam bledu,ale niesty nie znalazlem,czy byli byscie uprzejmi zajrzec ..i pokierowac mnie w odpowiednia strone...?
thx
<html>
<head>
<body>
<title>pobieranie z bazy</title>
</head>
<h1>wiadomosci</h1>
uporzadkuj wiadomosci wedlug <a href="data_out.php?orderby=date">dat</a>
<a href="data_out.php?orderby=heading">naglowkow</a> lub
<a href="data_out.php?orderby=autohr">autorow</a>
<p>
<form action="data_out.php" method="POST">
lub zobacz tylko artykuly napisane przez (<i>wpisz nazwisko autora</i>) ;
<input type="text" name="author">
<input type="submit" name="submit" value="wyslij">
</form>
<table border="1" cellspacing="3">
<?php
//pobieranie z bazy danych
$db = mysql_connect("localhost","aaa","aaa") ;
mysql_select_db("ja",$db);
if ($orderby == 'date') :
$sql = "select * from news order by 'date'";
elseif ($orderby == 'author'):
$sql = "select * from news order by 'author'";
elseif ($orderby == 'heading') :
$sql = "select * from news order by 'heading'";
elseif (isset($submit)) :
$sql = "select * from news where by 'author' = '$author'" ;
else:
$sql = "select * from news" ;
endif ;
$result = mysql_query($sql) ; {
print ("<tr><td bgcolor="#003399"><b>");
printf ("<font color=white">%s</font></b></td></tr>n",
$row["heading"]);
printf ("<td>Autor: <a href="mailto:%s"></a>n",
$row["author_email"], $row["author_name"]);
printf("<br>Nadeslano: %s<hr>n",
$row["date"]);
printf("%s</td><tr>n",
$row ["body"]);
}
?>
</table>
</body>
</html>