Hi!
Still a noob at this whole php-thingy but I think I´m learning more and more. 😉
Now I really need some help. I´m trying to make a newsscript (sort of) and now I´m stuck...
I have a html-page with a form with 3 fields. title, ingress and article. When I hit the "publish" button the data from the three formfields is sent to a file that I have named addnews.php and this file sends the data to my mysql database. I works like I want it to. I checked the db-table and the data is there.
Now my problem is how to display the data on a page. I have looked on a lot of places but not found a solution. I know this is probably the most basic and easiest thing to do...but where can I learn it?
Here is the code for a file called "view.php". I cant see what is wrong with it. Note that I do not get any errors on the page.
<?
mysql_pconnect("my-db","user","pass");
mysql_select_db("the_db");
$result = mysql_query("SELECT title, ingress, article FROM news WHERE title='$title' AND ingress='$ingress' AND article='$article'");
while($r=mysql_fetch_array($result))
{
$title=$r["title"];
$ingress=$r["ingress"];
$article=$r["article"];
echo "$title, $ingress, $article";
}
?>
Would be grateful if I could get some help on this one.