Jump to content

Search the Community

Showing results for tags 'mysqli_connect'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 2 results

  1. Hi, Please can someone suggest if I need to connect to the database again and again if my main program calls subroutines which also need to connect to the SAME database or is there an alternative method by which I don't have to do this again and again. I read somewhere that connecting to the database time and again is a big waste of time resource. I'll also try and illustrate my problem ///////////////////////////// main.php ////////////// <?php mysqli_connect(host, user, pass, db) // makes a connection to a database DB get_field_1(); // a function in another file say functions.php ?> //////////////////// functions.php //////////// <? function get_field_1() { mysqli_connect(host, user, pass, db) mysqli_connect(...) get_field_2(); // calls another fucntion in functions.php return val1; } function get_field_2() { mysqli_connect(host, user, pass, db) mysqli_connect(...) return val2; } ?> //////////////// END /////////////////// Is there a way by which I can avoid calling the following two lines within each function? mysqli_connect(host, user, pass, db) mysqli_connect(...) In fact I would like to call it just once in main and not have to call it again and again. Thanks.
  2. Hello, I want to switch from mysql to mysqli. but i have some questions. Are there an advantage to use object oriented style:$mysqli=new mysqli(...) or procedural style : $link=mysqli_connect(.....) ? My actual website, use mysql and all are procedural style : mysql_connect, mysql_query, mysql_num_rows.......... after doing a query, i close the connection mysql_close($link)... and reopen it if i have another query, such as in a function or further in the same script.... so it means that i can open and close the connection a lot in a same script...... I read that i can create an object like ::$mysqli=new mysqli(...) and nerver close it, and if i call a function, i just send $mysqli to the function: callThisFunction($mysqli) and the connection will be automaticly close when the script finish Is that better to open,close,open,close........ and so??? or open once and never close it I want to use the best way for the persomance of entire website! Thanks for your help!!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.