www.webdeveloper.com
Results 1 to 5 of 5

Thread: best way to execute SQL?

  1. #1
    Join Date
    May 2006
    Posts
    43

    best way to execute SQL?

    I've read several php books and I've run across multiple ways of executing SQL for a MySQL database. What should I use? Do I have to use PEAR? Is PEAR better just because its written in C? Why do you not close a mysql_pconnect connection?
    I guess I'm completely confused. please someone tell me the best code

  2. #2
    Join Date
    Feb 2006
    Location
    Where I live, people get shot. I need to move.
    Posts
    634
    Theirs NO best way, its what way suits your needs, programming requirements, style, etc.

    Another way of putting it is its your choice.
    If life gives you a hard knock once in a while, your lucky. All I keep getting is a savage beating... everyday!
    AJAX! - Javascript Sha1 & MD5 - ASCII tables - Zend DevZone - My Space
    Stop Badware - Create "TEXT FILE" in Javascript - . - wikipedia on PHP -

  3. #3
    Join Date
    Aug 2005
    Location
    The Garden State
    Posts
    5,634
    most libraries for PHP are written in C.

    path to follow would be dependent on your overall development style. most, if not all, companies want object oriented development, and in this case if you are going to be using MySQL, you should use the MySQLi API with a MySQL server > 4.1.

    If you develop in a object oriented way, I would recommend a completely separate layer for database access, and have other items access that only. Will using a pconnect improve your site? probably not. it's more costly.
    Acceptable Use | SQL Forum FAQ | celery is tasteless | twitter

    celery is tasteless - currently needing some UI time

  4. #4
    Join Date
    May 2006
    Posts
    43
    thank you for your advise. I guess I'll then stick to what I have been using for now.

  5. #5
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,175
    Another consideration is portability, in that the mysqli_* functions are only available in PHP5. Therefore, if your software needs to be compatible with PHP4, then you'll need to stick with the mysql_* functions.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles