# PHP/MYSQL syntax question

**URL:** <https://forum.kirupa.com/t/php-mysql-syntax-question/285363>\
**Category:** Uncategorized\
**Created:** [March 30, 2009, 11:45pm UTC](https://forum.kirupa.com/t/php-mysql-syntax-question/285363 "2009-03-30T23:45:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![eyebum](https://avatars.discourse-cdn.com/v4/letter/e/e495f1/32.png) [@eyebum](https://forum.kirupa.com/u/eyebum)\
**Post date:** [March 30, 2009, 11:45pm UTC](https://forum.kirupa.com/t/php-mysql-syntax-question/285363/1 "2009-03-30T23:45:39Z")

</div>

Hey there…  
I am tearing my hair out over a problem with displaying some data from a MYSQL database. The data is not stored in nice, convenient rows. That would be too easy.

So my question is, is it possible to use a WHERE statement in a variable? Something like this:

```auto

$sql = mysql_query ("SELECT value, fid, uid FROM $table2 WHERE uid=1") or die (mysql_error ());
$row = mysql_fetch_assoc ($sql);
$info = $row['value'] WHERE ['fid']=1;

```

I know that isn’t it, but is it possible at all? This is a limited, shortened piece of what I am working on, and it will eventually be looped…

Thanks!

Chris
