Returning a result from a db function not allowed?
Hey everybody,
Can anybody see what is wrong here? I can't get any error messages to get a clue where to start. The "new part" is the function select_result(). Can you not pass back a result? Why don't I get at least some error message? I don't even see Hello World (HTML at the bottom). Very frustrating indeed.
Thanks,
Trey
<?
require_once("/home/mysite/db/dbDefinitions.inc"); // ;)
function db_connect()
{
global $db_host, $db_user, $db_pwd, $db_name;
$link_id = mysql_connect($db_host,$db_user,$db_pwd);
mysql_select_db($db_name,$link_id);
return $link_id;
}
function select_result($strSQL){
$link = db_connect();
$result = mysql_query($strSQL, $link);
return $result;
}
function UID_inuse($uid){
$result = select_result("SELECT COUNT(*) AS count FROM parent WHERE user_name='$uid'");
$fetch = mysql_fetch_array($result,$link);
return ($fetch['count'] == 0)?false:true;;
}
if(UID_inuse("treyc"){
echo "User ID is in use";
}
else{
echo "User ID not in use";
}
?>
Hello world
---------------
Trey Carroll
|