# Php+mysql problems

**URL:** <https://forum.kirupa.com/t/php-mysql-problems/258382>\
**Category:** Uncategorized\
**Created:** [April 23, 2008, 3:34pm UTC](https://forum.kirupa.com/t/php-mysql-problems/258382 "2008-04-23T15:34:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![zomby\_pengy](https://avatars.discourse-cdn.com/v4/letter/z/c77e96/32.png) [@zomby\_pengy](https://forum.kirupa.com/u/zomby_pengy)\
**Post date:** [April 23, 2008, 3:34pm UTC](https://forum.kirupa.com/t/php-mysql-problems/258382/1 "2008-04-23T15:34:39Z")

</div>

```php
<?php
$dbhost = 'mysql';
$dbuser = 'username';
$dbpass = 'password';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die('Error connecting to mysql');
mysql_select_db("cms", $conn);
$query = "SELECT * FROM news";
$result = mysql_query($query, $conn);
$result_ar = mysql_fetch_assoc($result);
print_r($result_ar);
?>

```

Im having some problems with this script… instead of getting me all the information from the “news” table like I am trying to tell it to do, I am only getting back one of the rows from the table… I have three rows on the table right now, and when I do the print\_r(); on the array, i only get this:

Array  
(  
[id] =\> 1  
[title] =\> Testing  
[author] =\> Rob Carrillo  
[date] =\> 4/23/08  
[content] =\> this is just a test!!!  
)
