# Setting image names with php

**URL:** <https://forum.kirupa.com/t/setting-image-names-with-php/138918>\
**Category:** Uncategorized\
**Created:** [February 26, 2005, 5:29pm UTC](https://forum.kirupa.com/t/setting-image-names-with-php/138918 "2005-02-26T17:29:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SlowRoasted](https://avatars.discourse-cdn.com/v4/letter/s/a698b9/32.png) [@SlowRoasted](https://forum.kirupa.com/u/SlowRoasted)\
**Post date:** [February 26, 2005, 5:29pm UTC](https://forum.kirupa.com/t/setting-image-names-with-php/138918/1 "2005-02-26T17:29:56Z")

</div>

Ok im querying the database and doing if statement on the name of a field, if name is this then set variable image to blank.gif. here is my code:

```php

<?php

error_reporting(E_ALL & ~E_NOTICE);

require_once("connect2.php");

$query = "SELECT id, title, description, url, type, tutorial FROM design_main.urls WHERE (type = 'tutorial') OR (type = 'article') ORDER BY id DESC LIMIT 5"; 
$result = mysql_query($query) or die (mysql_error()); 
$num = mysql_num_rows($result);

if($row[5] = 'article'){
$image = 'article.gif';
}
elseif($row[5] = 'photoshop'){
$image = 'ps.gif';
}
elseif($row[5] = 'php'){
$image = 'php.gif';
}

echo"<table width=\"100%\" border=\"0\">";
if($num > 0){
while($row = mysql_fetch_array($result, MYSQL_NUM)){

echo"<tr><td><span class=\"style2\" ><img src=images/$image>&nbsp;<b>$row[1]</b><br>$row[2]<br><i>$row[5]</i><br><br></span></td></tr>";
}
}
else
{
echo'<span class="style1">The calendar is experiencing technical difficulties. We apologize for the inconvenience.</span>'; 
}
echo"</table>";

?>

```

its hanging up on article and all my images are the article.gif. anyone see what im doing wrong?
