# \[PHP & MYSQL\] NULL query string value

**URL:** <https://forum.kirupa.com/t/php-mysql-null-query-string-value/225735>\
**Category:** programming\
**Created:** [May 15, 2007, 9:08am UTC](https://forum.kirupa.com/t/php-mysql-null-query-string-value/225735 "2007-05-15T09:08:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![thatguythatsme](https://avatars.discourse-cdn.com/v4/letter/t/c0e974/32.png) [@thatguythatsme](https://forum.kirupa.com/u/thatguythatsme)\
**Post date:** [May 15, 2007, 9:08am UTC](https://forum.kirupa.com/t/php-mysql-null-query-string-value/225735/1 "2007-05-15T09:08:29Z")

</div>

Hi I’m using this code to generate an image from a database, Now I 've got a basic knowledge of PHP and it’s been a while since I’ve done much with it. I have a list of links being generated on one part of my site and when the user clicks these links it changes the project being displayed using a url query string.

My trouble is when the user gets to the page the first time there is no string. All I can understand is I will need to somehow detect a NULL value and send it to the last item in the database. I just cant seem to get this to work?

If anyone knows how I’d be very great full.

```php

$result = mysql_query('SELECT * FROM tblProjects WHERE id = '.$_GET['project'].'') or die('<p>error querying projects database</p>');
$i = 0;
while($result_ar = mysql_fetch_assoc($result)){
?>
 
<img src="<?php echo $result_ar['largeImage']; ?>" alt="Latest Project" title="Latest Project" />
                        <p><?php echo $result_ar['name']; ?></p>
                        <div class="details">
                            DATE: <?php echo $result_ar['date']; ?> | CLIENT: <?php echo $result_ar['client']; ?> <br />ROLE: <?php echo $result_ar['role']; ?> | TECH: <?php echo $result_ar['tech']; ?><br /><a href="<?php echo $result_ar['link']; ?>">(view site)</a>
                        </div>
<?php
$i+=1;
}
?>

```

David
