Question: .i have the following code:

```
$task_id = mysql_query("SELECT MAX(task_id) from it_task");
echo $task_id;

```

.what I want to do is to get the highest value from a field named task\_id on the table it\_task. Instead of getting a result which is an integer I get "Resource id #5". how do i get around this?

Answer: 
mysql\_query generates a resource which you then have to read using another mysql\_ function. In this case you'll need a 2nd line to read from the query's result:

```
$result = mysql_query("SELECT MAX(task_id) from it_task");
$task_id = mysql_result($result, 0, 0); // get the first row, first column
echo $task_id;

```
Yes, `mysql_query` always returns a resource (unless it returns `false`), which you have to work on using one of the `mysql_` functions like [`mysql_fetch_assoc`](http://www.php.net/manual/en/function.mysql-fetch-assoc.php).