Go to Post Being rude is easy. Being a compassionate human being takes work. - Joe Johnson [more]
Home
Go Back   Chief Delphi > Technical > IT / Communications > Website Design/Showcase
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 17-01-2003, 15:00
HFWang's Avatar
HFWang HFWang is offline
Registered User
AKA: DarkWulf
#0115
Team Role: Webmaster
 
Join Date: Jan 2003
Location: Cupertino
Posts: 177
HFWang will become famous soon enough
Send a message via ICQ to HFWang Send a message via AIM to HFWang
PHP Code:
#----------------------------------------#
#               Functions:               #
#              DB Functions              #
#----------------------------------------#

function dbcon() { #Obviously, this connects to the SQL server, using the values from qzconfig.php
 
global $dbhost$dbuser$dbpass$db;
 
$sql_server = @mysql_connect($dbhost,$dbuser,$dbpass)
  or die(
"<b>Fatal Error:</b><br /><b>MYSQL:</b> Unable to connect to mySQL server.");

  
mysql_select_db($db,$sql_server)
   or die(
"<b>Fatal Error:</b><br /><b>MYSQL:</b> Unable to query mySQL server.");
}

function 
dbquery($sql) { #For custom queries
 
global $result$querycount;
     
$result mysql_query($sql) or die("Your SQL query: <br />$sql<br /><br />MySQL said:<br />".mysql_error());
    
$querycount++;

Is what I use to make DB connections and queries. Its a tad shorter than Steve's but you are shorting yourself of the ordering and such. (Which IMO is actually better, because I'd rather be able to control the exact DB Query.... but thats just me)

Call dbcon(); then dbquery('SQL QUERY');

I also have an additional config file to insert the variables, but I don't think you want my password.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
XML Parsing Jack FIRST Scouting Network 1 12-10-2003 13:36
XML And Link Raven_Writer Website Design/Showcase 13 26-09-2003 17:24
xml Jack FIRST Scouting Network 0 01-09-2003 16:23
Message Boards w/o MySQL iBob Website Design/Showcase 7 13-07-2003 02:00
MySQL query question Jack Website Design/Showcase 9 02-02-2003 00:11


All times are GMT -5. The time now is 00:24.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi