I've made it so it's just array('field' => 'value') not normal, it'll save time in the long run if you ever need to add anything. This should be near enough what you're looking for, took me a few minutes to whip it up.
PHP Code:
<?php
function selectSql( $what, $from, $where = null )
{
$what = ( $what === '*' ) ? '*' : '`' . $what . '`';
$query = 'SELECT ' . $what . ' FROM `' . $from . '` ';
if( is_array( $where ) )
{
foreach( $where as $key => $value )
{
$query .= '`' . $key . '` = \'' . $value . '\'';
}
}
return mysql_query( $query );
}
?>
You'll have to clean the input yourself.