|
|
Why it's hard to use a database inside a page
Posted under Development by Twyst on Sunday October 08 2000 @ 01:26PM EDT
|
Well, I've just realized why it's such a pain to use my own database routines in phpweblog, without causing errors in the script itself.
$db = mysql_connect($G_HOST,$G_USER,$G_PASS);
@mysql_select_db($G_DB) or die("Unable to connect to database $G_DB. Be sure to edit include/common.inc.php.");
$result = mysql_query($sql,$db);
While that is valid, it causes errors, because the database isn't selected for each query. So if I use a database, I _have_ to redo your database connections before I use an include file, which is more work than necessary.
Removing the @mysql_select_db($G_DB) or die("Unable to connect to database $G_DB. Be sure to edit include/common.inc.php."); line, and replacing mysql_query($sql,$db); with mysql_db_query($G_DB,$sql,$db); will solve this perfectly.
|
|
|
|
jason writes on Monday October 09 2000 @ 10:34AM EDT: [ reply | parent ]
Thanks, and I agree.
|
|
Titus Jonathan writes on Friday February 23 2001 @ 05:46AM EST: [ reply | parent ]
How to make connection with Sybase NT?
As we know, the syntax is:
sybase_connect("servername","user","password")
Where I must define "servername" ?
Is it in c:\sybase\bin\sql.ini ?
I have done, but not success. What is the problem?
thanks
|
|
ampere writes on Tuesday August 07 2001 @ 03:19AM EDT: [ reply | parent ]
While refresh the page that connect to sybase -window by using php script must be show message
"Warning Sybase:Unabled to connect to: .../../.. online..." and can not connect to database.
But sometime able to connect to sybase.
Any idea to solve this problem?
|
|
|
|
|