Jump to content

Search the Community

Showing results for tags 'classes'.

  • 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 13 results

  1. Good morning Freaks, I hope you're all having a productive week. I've a question about an issue I'm having accessing static properties. I've been doing some reading on them but haven't yet deployed one successfully. I have a bunch of classes and I want to make the database query tables all static so they can be used cross-class, so to speak. Here's a sample attempt -> class Post { private $conn; private $user_obj; public static $table = "posts"; public function __construct($conn, $username) { $this->conn = $conn; $this->user_obj = new User($conn, $username); // $this->table = "posts"; } and accessing it here -> public function getBreakingNews() { $query = mysqli_query($this->conn, "SELECT * FROM self::$table WHERE type='breaking' ORDER BY RAND()"); This gets me an error that $table doesn't exist as does using Post::$table. When I assign $this->table = 'posts' (the commented out line in __construct) and access it by $this->table all works great. What am I doing wrong that it won't find that public static property? In the manual there's this example, which I feel like I've stayed true to -> class Foo { public static $my_static = 'foo'; public function staticValue() { return self::$my_static; } } ..... print Foo::$my_static . "\n"; The only difference I see is that they're printing the value and I'm trying to use it in a database query. Can anyone guide me through this mistake I'm apparently making and can't see? I've tried both self::$table and Post::$table, self::table and Post::table, every permutation I can think of but still the variable is saying it's unassigned. Share your knowledge please
  2. Hi Freaks, I'm looking for advice if someones willing to give it. Here's the situation -> I've been working on a project, I started to learn PHP specifically to complete this idea I had. My code has evolved a lot over time as I've started understanding more. Up until today I've been working on it with just the registration functionality, no login. I had my username hardcoded into the $user_obj instantiation. I decided I wanted to try to make category subscription functionality and doing that I realized I was better off finishing the login form first so as to get a users subscriptions into a session variable at login. This has brought about the issue of getting an unassigned variable warning from the User class when not logged in. How I made all my other classes was putting a $user in the __construct parameter for each class. I now feel this may have been a rookie error since I'm having problems with error messages especially undefined array keys and variables when there isn't a session started. It's become a bit of a mess. So the advice I'm looking for and hoping to find here is how you folks handle non $_SESSION sessions, when a user is just scrolling the site not logged in. Did I make a mistake requiring $user for each class __construct? should I move the $user parameter to only the methods that require them? Is there a simpler solution that my inexperience causes to elude me? What would you folks do in this situation?
  3. I have this script (and it's working fine) for destryong some classes. How can i make a button to restore those destroyed classes? /* destroy pagination */ $("a.destroy").click(function(){ $("input.destroy").remove(); $("button.destroy").remove(); $("form.destroy").remove(); $("div.destroy").remove(); $("font.des2").remove(); /* destroy jpages */ $("div.holder").jPages("destroy"); /* remove button */ $(this).remove(); }); <!-- destroy jPages button --> <a class="destroy">Destroy Pagination</a> How can i restore those classes? /* restore pagination */ $("a.rest1").click(function(){ ???????????????????????? }); <!-- restore jPages button --> <a class="rest1">Restore</a>
  4. I have been trying to figure out a somewhat complex set of functions to handle some product price calculations and display. I was thinking that building classes may be the best solution, but I don't completely know what I am doing with that either. I was hoping someone may be able to help me figure out the best solution for all this. This site is being built within wordpress. The pages load as follows, 1. Site determines client level: If no user is logged in, it defaults to client_lvl = high, if user is logged in, client_lvl may be set to an alternate value. (high, med, low) This should be loaded just once per site visit. I created this function: function get_client_lvl () {$user_id = get_current_user_id(); global $client_lvl; If ($user_id == 0) {$client_lvl= 'high';} Else {$client_lvl=get_user_meta($user_id, wpcf-client-lvl, true); } }//End function I tried converting it to a class, but I'm not sure I am doing it correctly. class ClientLvl { public $client_lvl ='high'; private $user_id; private function __construct() { $this->user_id= get_current_user_id(); } public function get_client_lvl () //check the client level from user meta- { $this->client_lvl If ($user_id != 0) {return get_user_meta($user_id, wpcf-client-lvl, true); } The rest of the functions are based on the following arrangement. Collections have multiple products which have multiple variations. The Products have a series of multiplier values attached to them. One for each client level. It also has a multiplier type (m_type) The variants then have the item specific details such as cost of goods sold (cogs), Area, sku, and name. 2. This function is used to determine which multiplier value will be used in the calculation. Used on collection and product pages to determine which multiplier value to use for calculation based on client level f unction get_multiplier($client_lvl) { $p_high= get_post_meta(get_the_ID(),'p_high','single'); $p_med= get_post_meta(get_the_ID(),'p_med','single'); $p_low =get_post_meta(get_the_ID(),'p_low','single'); if ($client_lvl == 'med') {$prices=array('high'=>$p_high,'med'=> $p_med);} elseif ($client_lvl == 'low') {$prices=array('high'=>$p_high,'low'=> $p_low);} else {$prices=array('high'=>$p_high);} }//End function I am assuminng that if I made this a class, I should just define the p_high (med, low) values and then display them with another object creation in another function? 3.These values will be used in another function to limit the number of images that a user can select for their product. $img_min= get_post_meta(get_the_ID(),'img_min','single'); $img_max= get_post_meta(get_the_ID(),'img_max','single'); 4. These are the formulas that are used to calculate the displayed price. I am not sure how to handle the image and image+commission options as they use the number of selected images to determine the price. But if no images are selected, I want it to display "This is the price/ image. One idea I thought of was to include the echo statements inside the switch options, but Im not sure how to handle the array. If the client level is High the function will only loop through once and will not have a was now price. but if it is anything else, then it will loop through twice and will have the was now echo statement. If I didnt have the special case in the image based calculations, then the was now function would work just fine. But I'm not sure where to put the conditional echo's for those functions. function calculate_price($m_type) { global $cogs; $cogs= get_post_meta(get_the_ID(),'cogs','single'); $img_cost=10; $prices= get_multiplier(); Foreach($prices as $multiplier) { switch ($m_type) { case 'Area': $area= get_post_meta(get_the_ID(),'area','single'); $total[]= $multiplier * $area; break; case 'Image': if(isset($img_count)) {$total[]= $multiplier * $cogs * $img_count;} else {$total[]= $multiplier * $cogs ;} // Displayed as $price/ Image using $img_count break; case 'Commission': $total[]= $multiplier + $cogs; break; case 'Flat': $total[]= $multiplier; break; case 'Commission+Image': if(isset($img_count)) {$total[]= $multiplier + ($img_cost*$img_count);} else {$total[]= $multiplier; } //Display "Price: ".$multiplier. "+".$img_cost ." /image" break; case 'Price': $total[]= $multiplier * $cogs; break; }}} 5. Function that displays the price result from the previous function. Does not currently account for the image or image+commission statements. I need to create a similar function that finds the lowest calculated price of a particular product group to display on the archive page for products. function was_now($client_lvl,$m_type) { $total=calculate_price($m_type); $p1=number_format($total[0],2,'.',','); If ($client_lvl == "high") { echo "is \${$p1}"; } else { $p2=number_format($total[1],2,'.',','); echo "WAS: \${$p1}<br/>"; echo "NOW: \${$p2}"; }} 6.This is the subloop of the product page that displays the variants for that product. Not fully coded yet. (This code is currently displayed in the template file itself opposed to a function. function uc_list_product($ID,$m_type) { get_page_children($ID); echo "<table> "; while ( have_posts() ) { the_post(); ?> <tr><?php if($m_type=='Image'){ $display= 'Price '. was_now($client_lvl,$m_type); //if images are selected display price*img count } elseif($m_type=='Commission+Image'){ $display= 'Price '. was_now($client_lvl,$m_type);} //display multiplier, img cost, img count else {$display= 'Price '. was_now($client_lvl,$m_type);} echo "<td>". the_title()."</td><td>Price ".$display ."</td><td><a href='#'>Select Product</a></td></tr>" ; } echo "</table>"; wp_reset_query(); } This will probably be doable with classes, but I I'm not entirely sure how to go about that. I hope someone can help me figure this out.
  5. Hi. I haven't done a lot of OOP. Hardly any really. I've had a go at writing a very small class that outputs a greeting depending on what time of day it is. What do the OOP experts here make of it? What do you like, what do you hate? Is there anything I could do to make it more useful? Here is the code; class Greeting { // the __construct didn't do what I originally wanted. Denfine the hour outside the method (I don't know why this is a good/bad idea) /* public function __construct() { $hour_of_day = date('G'); } */ public function callGreetingPhrase() { return $this->getGreetingPhrase(); } // the setter doesn't seem to have a purpose here. I tried using it so that I could pass in a value of my choosing (for testing purposes) can't get it to work though /* public function setGreetingPhrase($value) { $this->hour_of_day = $value; } */ private function getGreetingPhrase() { $hour_of_day = date('G'); if($hour_of_day < 12 ) { // if it's before 12pm $greeting_phrase = "good morning"; } elseif($hour_of_day >= 12 && $hour_of_day < 18 ) { // if it's after 12pm but before 6pm $greeting_phrase = "good afternoon"; } else { // what is left over - after 6pm until midnight $greeting_phrase = "good evening"; } return $greeting_phrase; } } $greeting = new Greeting; echo $greeting->callGreetingPhrase(); It annoyed me that I could 't figure out how to use the __constructor here to store the hour. But should that have bothered me? Can someone maybe explain a bit about the setter that I tried to use setGreetingPhrase. I only put it in because I've seen other Classes with one. Could I use a setter method here for anything useful? Any feedback appreciated!
  6. I have converted an old pagination function I've had for years to a class as I've recently started to learn OOP The problem is that it doesn't display any anything except the <ul></ul> I've tried returning a variable but it comes back empty. I know it's something to do with my variables but I can't see what class Pagination { private $total_pages; private $page; private $webpage; public function __construct() { $this->total_pages; $this->page; $this->webpage; } /** * This function is called whenever the there are several records to be displayed in the table * This saves the page extending further down the page creating a long list of results * when all the results can be spread across multiple pages */ public function pagination_one($total_pages, $page, $webpage) { // Maximum number of links per page. If exceeded, google style pagination is generated $max_links = 6; $h=1; if($this->page>$max_links) { $h=(($h+$this->page)-$max_links); } if($this->page>=1) { $max_links = $max_links+($this->page-1); } if($max_links>$this->total_pages) { $max_links=$this->total_pages+1; } $paging = ''; $paging .= '<div class="page_numbers"> <ul>'; if($this->page > "1") { $paging .= '<li class="current"><a href="/'.$this->webpage.'/1">First</a></li> <li class="current"><a href="/'.$this->webpage.'/'.($this->page-1).'">Prev</a></li> '; } if($this->total_pages != 1) { for ($i=$h;$i<$max_links;$i++) { if($i==$this->page) { $paging .= '<li><a class="current">'.$i.'</a></li>'; } else { $paging .= '<li><a href="/'.$this->webpage.'/'.$i.'">'.$i.'</a> </li>'; } } } if(($this->page >="1")&&($this->page!=$this->total_pages)) { $paging .= '<li class="current"><a href="/'.$this->webpage.'/'.($this->page+1).'">Next</a></li> <li class="current"><a href="/'.$this->webpage.'/'.$this->total_pages.'">Last</a></li>'; } $paging .= '</ul> </div>'; return $this->page; } } $paging = new Pagination(); var_dump( $paging->pagination_one(3, 1, 'news')); <?php class Pagination { private $total_pages; private $page; private $webpage; public function __construct() { $this->total_pages; $this->page; $this->webpage; } /** * This function is called whenever the there are several records to be displayed in the table * This saves the page extending further down the page creating a long list of results * when all the results can be spread across multiple pages */ public function pagination_one($total_pages, $page, $webpage) { // Maximum number of links per page. If exceeded, google style pagination is generated $max_links = 6; $h=1; if($this->page>$max_links) { $h=(($h+$this->page)-$max_links); } if($this->page>=1) { $max_links = $max_links+($this->page-1); } if($max_links>$this->total_pages) { $max_links=$this->total_pages+1; } $paging = ''; $paging .= '<div class="page_numbers"> <ul>'; if($this->page > "1") { $paging .= '<li class="current"><a href="/'.$this->webpage.'/1">First</a></li> <li class="current"><a href="/'.$this->webpage.'/'.($this->page-1).'">Prev</a></li> '; } if($this->total_pages != 1) { for ($i=$h;$i<$max_links;$i++) { if($i==$this->page) { $paging .= '<li><a class="current">'.$i.'</a></li>'; } else { $paging .= '<li><a href="/'.$this->webpage.'/'.$i.'">'.$i.'</a> </li>'; } } } if(($this->page >="1")&&($this->page!=$this->total_pages)) { $paging .= '<li class="current"><a href="/'.$this->webpage.'/'.($this->page+1).'">Next</a></li> <li class="current"><a href="/'.$this->webpage.'/'.$this->total_pages.'">Last</a></li>'; } $paging .= '</ul> </div>'; return $this->page; } } $paging = new Pagination(); var_dump( $paging->pagination_one(3, 1, 'news'));
  7. I have recently started using OOP for my old procedural code and I'm getting the hang of it. The problem I have is with autoloading my class files. I have this code on each of my pages I'm redoing. require("php/classes/dbConstants.php"); function __autoload($className) { $extensions = array(".php", ".class.php", ".inc"); $paths = explode(PATH_SEPARATOR, get_include_path()); $className = str_replace("_" , DIRECTORY_SEPARATOR, $className); foreach ($paths as $path) { $filename = $path . DIRECTORY_SEPARATOR . $className; foreach ($extensions as $ext) { if (is_readable($filename . $ext)) { require_once $filename . $ext; break; } } } } try { $forum = new Database(DBHOST, DBUSER, DBPASS, DBNAME); } catch (Exception $e) { echo $e->getMessage(), "\n"; } but i'm getting this error message The file with the autoloader is in the root and the database class is in a folder called php and in a subfolder called classes. I need to adjust the path of where it's looking for my classes but no idea how Can anyone please help?
  8. So I'm writing an api that my clients can use in their sites. I don't want to give them direct access to the code. I have the script on api.XXXXXX.com index.php contains: <?php require_once('base.php'); require_once('client.php'); class api extends client { function __construct($config = null) { return parent::__construct($config); } } //....Other Code ?> Is it possible for my clients to access the API class by including it in their site? For example: <?php require_once('http://api.XXXXXX.com/index.php'); class service{ private $client; function __construct() { $this->client = new api(); } } //....Other Code ?>
  9. Hi Everyone, I wanted to know if there is anyway to define classes and functions on one site and then have multiple other sites connect. I want to do this so that I can encrypt information on these other sites with a class that I have made on another site. I tried require but the remote script executes and then returns the result - it doesn't allow me to access or use the functions. If you have any ideas/suggestions/solutions I'm open to them but it looks like I'm going to need to reevaluate how I'm going to do this. Thanks for reading!
  10. Good afternoon everyone, and happy holidays! Although my membership might not qualify as "new" to this forum, I've never used my account here before but today I think I finally found a reason to! I'm trying to exclude four (4) values from array, which will then echo the remaining values into a drop-down box on a form. Here is the contents of the array: Array ( [0] => stdClass Object ( [id] => 22 [icao] => CYQM [name] => Greater Moncton International Airport - CHARTER [country] => Canada [lat] => 46.1122 [lng] => -64.6786 [hub] => 0 [fuelprice] => 0 [chartlink] => ) [1] => stdClass Object ( [id] => 19 [icao] => EINN [name] => Shannon International Airport - CHARTER [country] => Ireland [lat] => 52.702 [lng] => -8.92482 [hub] => 0 [fuelprice] => 0 [chartlink] => ) [2] => stdClass Object ( [id] => 16 [icao] => KAUS [name] => Austin-Bergstrom International Airport [country] => United States [lat] => 30.1945 [lng] => -97.6699 [hub] => 0 [fuelprice] => 0 [chartlink] => ) [3] => stdClass Object ( [id] => 9 [icao] => KDEN [name] => Denver International Airport [country] => United States [lat] => 39.8583 [lng] => -104.667 [hub] => 0 [fuelprice] => 0 [chartlink] => ) [4] => stdClass Object ( [id] => 2 [icao] => KLAS [name] => McCarran International Airport [country] => United States [lat] => 36.0827 [lng] => -115.154 [hub] => 1 [fuelprice] => 0 [chartlink] => ) [5] => stdClass Object ( [id] => 5 [icao] => KLGB [name] => Long Beach Airport [country] => United States [lat] => 33.8175 [lng] => -118.152 [hub] => 0 [fuelprice] => 0 [chartlink] => ) [6] => stdClass Object ( [id] => 14 [icao] => KOAK [name] => Metropolitan Oakland International Airport [country] => United States [lat] => 37.721 [lng] => -122.222 [hub] => 0 [fuelprice] => 0 [chartlink] => ) [7] => stdClass Object ( [id] => 10 [icao] => KPDX [name] => Portland International Airport [country] => United States [lat] => 45.5887 [lng] => -122.598 [hub] => 0 [fuelprice] => 0 [chartlink] => ) [8] => stdClass Object ( [id] => 3 [icao] => KPHX [name] => Phoenix Sky Harbor International Airport [country] => United States [lat] => 33.4359 [lng] => -112.01 [hub] => 0 [fuelprice] => 0 [chartlink] => ) [9] => stdClass Object ( [id] => 12 [icao] => KRNO [name] => Reno/Tahoe International Airport [country] => United States [lat] => 39.4991 [lng] => -119.768 [hub] => 0 [fuelprice] => 0 [chartlink] => ) [10] => stdClass Object ( [id] => 4 [icao] => KSAN [name] => San Diego International Airport [country] => United States [lat] => 32.7334 [lng] => -117.188 [hub] => 0 [fuelprice] => 0 [chartlink] => ) [11] => stdClass Object ( [id] => 17 [icao] => KSAT [name] => San Antonio International Airport [country] => United States [lat] => 29.5338 [lng] => -98.47 [hub] => 0 [fuelprice] => 0 [chartlink] => ) [12] => stdClass Object ( [id] => 6 [icao] => KSEA [name] => Seattle-Tacoma International Airport [country] => United States [lat] => 47.449 [lng] => -122.309 [hub] => 0 [fuelprice] => 0 [chartlink] => ) [13] => stdClass Object ( [id] => 8 [icao] => KSFO [name] => San Francisco International Airport [country] => United States [lat] => 37.6188 [lng] => -122.376 [hub] => 0 [fuelprice] => 0 [chartlink] => ) [14] => stdClass Object ( [id] => 15 [icao] => KSJC [name] => San Jose International Airport [country] => United States [lat] => 37.3619 [lng] => -121.929 [hub] => 0 [fuelprice] => 0 [chartlink] => ) [15] => stdClass Object ( [id] => 11 [icao] => KSLC [name] => Salt Lake City International Airport [country] => United States [lat] => 40.7884 [lng] => -111.978 [hub] => 0 [fuelprice] => 0 [chartlink] => ) [16] => stdClass Object ( [id] => 7 [icao] => KSMF [name] => Sacramento International Airport [country] => United States [lat] => 38.6952 [lng] => -121.592 [hub] => 0 [fuelprice] => 0 [chartlink] => ) [17] => stdClass Object ( [id] => 13 [icao] => KTNT [name] => Dade-Collier Training Airport - CHARTER [country] => United States [lat] => 25.862 [lng] => -80.8967 [hub] => 0 [fuelprice] => 0 [chartlink] => ) [18] => stdClass Object ( [id] => 18 [icao] => LTAI [name] => Antalya International Airport - CHARTER [country] => Turkey [lat] => 36.8987 [lng] => 30.8005 [hub] => 0 [fuelprice] => 0 [chartlink] => ) ) 1 As you can see, it's one (1) array that's broken up into a separate stdClass Object() array of some sort. My goal here is to exclude the following [id] values from the set of arrays above: 13, 18, 19, 22 The problem is that each array key (ex. [1], [2], [3]) from the first array will change when the contents of the array is increased over time. Therefore, I cannot simply exclude array keys [1], [2], [17], [18] Here's the code I'm working with now: <div id="depapttab"> <p>Select your departure airport:</p> <select id="depicao" name="depicao"> <option value="">Select All</option> <?php if(!$depairports) $depairports = array(); foreach($depairports as $airport) { if($depairports->id != array(13,18,19,22)) { echo '<option value="'.$airport->icao.'">'.$airport->icao.' - '.$airport->name.'</option>'; } } ?> </select> <input type="submit" name="submit" value="Find Flights" /> </div> I just don't know how to include that darn stdClass Object() in my if() statement. If someone could lend a hand, it'd be much appreciated! Thanks in advance!
  11. Hi Guys, I am getting this error, Parse error: syntax error, unexpected T_VAR in D:\Program Files\XAMPP\htdocs\agg\edit_home_content.php on line 31 (Line 31 is the 2nd line of code) For this code (It is inside a class) public function edit_home_content(){ var $content_file = fopen('home_content.xml','r'); var $previous_content = fgetc(content_file); var $values = $values; var $values .= $previous_content; // add the above to the bottom of the new code // then write below fclose($content_file); var $content_file = fopen('home_content.xml','r+'); fwrite(content_file,$this -> values); fclose(content_file); } Any Suggestions? Thanks in advance Timothy
  12. Hey Everyone, I have been dying to tell someone about this, but I feel that since my friends are not coders they wouldn't fully get how much my teacher aggravates me. So, my minor is college is interactive digital design which is graphic and web design. This semester, my fall senior semester, I decided to take the "Advanced Web Design Class." I took the basic web design class my previous year, which was a breeze because I have been self taught in HTML and CSS for about four years and PHP and MYSQL for about a year. I have this teacher who teaches "Advanced Web Design" and claims to have cooperate clients for web site development. I keep putting "Advanced Web Design" in quotes because this class is a JOKE! My so called teacher has said the following, which has had me banging my head on my keyboard during class: "I don't like to code because I don't like to type." "I don't like to code because I am a bad speller." "Dreamweaver is better than coding." :'( "I buy all of my form validation code." "Spry bars are better." "You shouldn't be using PHP in my class." I asked her to show me some of her work and she showed me this stupid website she made about some female bulldog. I have no idea, Mrs. Something. I started to laugh and she was serious. She used like 20 JPEGS like puzzles pieces, so the site took a solid 5 minutes to load. Here I was thinking I was going to get a class where I could practice PHP and javascript, but instead we are going over the basics of HTML and CSS. Today she taught us how to attach style sheets to our web pages, using Dreamweaver of course. I tried to explain to her that she needs to at least teach her students the basics of coding, so they can debug their Dreamweaver code when it goes wrong. She told me to let her do her job. Then she spent the rest of the class helping everyone debug their Dreamweaver mistakes. Glad I got that out!
  13. I am using parent::__construct() in almost every classes to connect Mysql DB. Example class class secondClass extends dbconnect { public function __construct() { parent::__construct(); dbconnect class class dbconnect { private $mysqli_handler; public function __construct() { try { mysqli_report(MYSQLI_REPORT_STRICT); $this->mysqli_handler = mysqli_connect(DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DBNAME); } catch (mysqli_sql_exception $e) { throw new Exception('Error: Could not make a database link using ' . DB_USERNAME . '@' . DB_HOSTNAME . '!'); } if ($this->mysqli_handler->connect_error) { trigger_error('Error: Could not make a database link (' . $this->mysqli_handler->connect_errno . ') ' . $this->mysqli_handler->connect_error); } $this->mysqli_handler->query("SET NAMES 'utf8'"); $this->mysqli_handler->query("SET CHARACTER SET utf8"); $this->mysqli_handler->query("SET CHARACTER_SET_CONNECTION=utf8"); $this->mysqli_handler->query("SET SQL_MODE = ''"); $this->mysqli_handler->query("SET time_zone = 'Asia/Kolkata'"); } Is this create multiple instance of mysql dbconnection? I am frequently getting mysql connection error on my shared hosting. If so how to avoid? I am using PHP Version 7.4.16, some detailed explanation will be useful for me as I am using like this for many projects. Thank you for your time. Prabakaran
×
×
  • 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.