Koozali.org: home of the SME Server
Legacy Forums => General Discussion (Legacy) => Topic started by: Mal on May 19, 2003, 03:01:36 AM
-
Hello Forum,
If the SELECT command fails I would like to link to a webpage rather than just have a blank screen with "Unable to select database"
I cannot find anything in the manual to help me here and I have tried various guesses putting the url in the brackets (don't laugh!).
Any ideas?
Thanks in advance,
Mal.
-
What language, your provided almost no details in your question? I'm going to assume PHP.
$db = mysql_connect("localhost", "mysql_user", "mysql_password");
$result = mysql_query($db,"SELECT * FROM MY TABLE ORDER BY MYVALUE;");
if($result){
//Do your record enumeration or code here.
}else{
echo ("Select failed\n");
//Do select failed code here
}
Not to be a butt, but RTFM: http://www.php.net/manual/en/function.mysql-db-query.php