# Flash & PHP news system: query error

**URL:** <https://forum.kirupa.com/t/flash-php-news-system-query-error/80741>\
**Category:** programming\
**Created:** [February 24, 2005, 12:11pm UTC](https://forum.kirupa.com/t/flash-php-news-system-query-error/80741 "2005-02-24T12:11:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![free\_mojo](https://avatars.discourse-cdn.com/v4/letter/f/e99b99/32.png) [@free\_mojo](https://forum.kirupa.com/u/free_mojo)\
**Post date:** [February 24, 2005, 12:11pm UTC](https://forum.kirupa.com/t/flash-php-news-system-query-error/80741/1 "2005-02-24T12:11:49Z")

</div>

Hello, I have been following this tutorial:  
[http://sephiroth.it/tutorials/flashPHP/news/index.php](http://sephiroth.it/tutorials/flashPHP/news/index.php)

I keep recieving a query error everytime i try to test it. I am a PHP beginner. I do not know for sure how i should be connecting to my server/host. I have been trying to do this kind of thing for about 6 months and i can’t work out how to connect etc. I really would be grateful of some help.

Here’s my code: (NB. My database is called “freemojo\_news”, my table “news” and my fields “id”, “news” and “date”)

```php
<? 	 
    $database = "freemojo_news";

	$connection = mysql_connect ("localhost","","") or die ("Sorry, server error!");
	
	mysql_select_db($database);
	
	$query = "SELECT * FROM news ORDER BY date ASC";
	
	$result = mysql_query($query) or die ("Sorry, query error!");
	$num_rows = mysql_num_rows($result);
	
	for($i=0;$i<$num_rows;$i++){
	$row = mysql_fetch_array($result);
	
    $news = "news$i";
    $news = $row['news'];
	
    $date = "date$i";
    $date = $row['date'];
	
    print("&news$i=$news");
    print("&date$i=$date");

}
    mysql_close($connection);

?>

```

If anyone can help i would appreciate it.  
I am using phpmyadmin to create the database.

Thanks!  
Andrew
