Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 1 of 1
  1. #1
    Senior Member mikeycorn's Avatar
    Join Date
    Mar 2003
    Posts
    272
    Member #
    891
    Here's how my book has me connecting to my database:



    PHP Code:
      define ('DB_USER''user'); 
      
    define ('DB_PASSWORD''pword'); 
      
    define ('DB_HOST''localhost'); 
      
    define ('DB_NAME''user_test'); 
       
      
    $dbc mysql_connect (DB_HOSTDB_USERDB_PASSWORD
        or die (
    'Could not connect to MySQL: '.mysql_error()); 
       
      
    mysql_select_db (DB_NAME
        or die (
    'Could not select the database: '.mysql_error()); 

    It's working fine, but now I need to check my table to see if a specific primary key exists.

    I stumbled upon the dba_exists function (not covered in my book) but the online php manuals I've seen only mention that it's used in conjunction with dba_open and don't give any examples.

    dba_open is described as



    resource dba_open ( string path, string mode, string handler [, ...] )

    dba_open() establishes a database instance for path with mode using handler.

    How do I reconcile the mysql_connect & mysql_select_db method that I've been taught in my book with the dba_exists? Is dba_open just another way of doing the same thing that mysql_connect & mysql_select_db do?

    And what the heck is a string handler?
    ~ mikeycorn
    With over 72,000 questions worth of user submitted quizzes, it's the world's most popular quiz creation software:
    PEST - The Personal Exam Self-Tester

  2.  


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 04:21 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com