QuickOldCar
Staff Alumni-
Posts
2,972 -
Joined
-
Last visited
-
Days Won
28
Everything posted by QuickOldCar
-
How to handle a critical exception involving batabases
QuickOldCar replied to ajoo's topic in PHP Coding Help
Do an exit() to stop continuation of the code- 4 replies
-
- exception
- db exception
-
(and 1 more)
Tagged with:
-
I agree, it seems easier to write own code than use it there.
-
Could have done a phpfiddle version.
-
How to handle a critical exception involving batabases
QuickOldCar replied to ajoo's topic in PHP Coding Help
You can use the header() function to do any error handling or redirection.- 4 replies
-
- exception
- db exception
-
(and 1 more)
Tagged with:
-
When it comes to sending mail can be many things to make it not work. using sendmail? own smtp host? your domain being refused? Try phpmailer
-
I would remove any multiple breaks and place it back $string = "<p>example<br /><br /><br /></p><br />"; $string = preg_replace("~<br />+~",'',$string); $string .= "<br />";
-
Dragging the icon is still opening as were. Try http://localhost/your_script_name.php
-
If are just learning may want to check out the php tutorial
-
Is a few ways actually, you have to echo html in quotes if within php or break in and out of php using <?php ?> tags <?php for ($i = 1; $i <= 64; $i++) { ?> <div class="col-xs-3 team_box top-team-border"><?php echo $results->get_team('64', '<?php echo $i; ?>', 'A', 'main'); ?> <span class="badge"><?php echo $results->get_score('64', '<?php echo $i; ?>', 'A', 'main'); ?></span></div> <?php } ?> or <?php for ($i = 1; $i <= 64; $i++) { echo "<div class='col-xs-3 team_box top-team-border'>".$results->get_team('64', '".$i."', 'A', 'main')."<span class='badge'>".$results->get_score('64', '".$i."', 'A', 'main')."</span></div>"; } ?>
-
Is the script saved with a .php extension? If you save as htm or html the server needs to be configured to parse php.
-
Call undefined function mysqli_connect()
QuickOldCar replied to m4u_hoahoctro's topic in PHP Coding Help
Restarting the server is an easy way. -
Call undefined function mysqli_connect()
QuickOldCar replied to m4u_hoahoctro's topic in PHP Coding Help
vertrigo is not apache -
If you want to delete the demo items from opencart.... Go into something like phpmyadmin. prefix_ being whatever you selected upon install Only do this a fresh install or would delete something may not want to. Run this sql command. DELETE FROM prefix_address; DELETE FROM prefix_category; DELETE FROM prefix_category_description; DELETE FROM prefix_category_to_store; DELETE FROM prefix_coupon; DELETE FROM prefix_customer; DELETE FROM prefix_download; DELETE FROM prefix_download_description; DELETE FROM prefix_manufacturer; DELETE FROM prefix_manufacturer_to_store; DELETE FROM prefix_product; DELETE FROM prefix_product_description; DELETE FROM prefix_product_discount; DELETE FROM prefix_product_featured; DELETE FROM prefix_product_image; DELETE FROM prefix_product_option; DELETE FROM prefix_product_option_description; DELETE FROM prefix_product_option_value; DELETE FROM prefix_product_option_value_description; DELETE FROM prefix_product_related; DELETE FROM prefix_product_special; DELETE FROM prefix_product_to_download; DELETE FROM prefix_product_to_store; DELETE FROM prefix_review; DELETE FROM prefix_store; DELETE FROM prefix_store_description; DELETE FROM prefix_product_tags; DELETE FROM prefix_order; Unless you are willing to make your own commerce site I have only ever seen 3 decent ones out there. opencart, prestashop and magneto Each have their quirks.
-
php variables do not parse surrounded by single quotes escape the directory/file paths with quotes
-
Call undefined function mysqli_connect()
QuickOldCar replied to m4u_hoahoctro's topic in PHP Coding Help
What operating system and server packages are you using now? phpinfo(); is to see about server configuration, do you see a mysqli section? if so it's installed. Look at Loaded Configuration File and visit that php.ini file location, ensure is no ; in front of extension=php_mysqli.dll If you made a change and saved the file then restart apache service. The correct way to connect is host,user,password,database $db = mysqli_connect("localhost","user_name","user_password","database_name") or die("Error " . mysqli_error($db)); -
Welcome to the forum.
-
It's not incorrect, all matters what you need to do with the data. For instance you may want to do a single query, then display users and each count, in the loop could show or calculate it different. But if all you need is a simple count then the less you need to do with code the better.
-
I agree with cronix as to having mysql do it for you. For the record your original way would be something as this. Adding post counts to the original total. $total = 0; while($prepare->fetch()) { $total = $total + $post_counts; } print($total);
-
One way is to define a blank array and then add to it, then use count() on the array. $total = array(); while($prepare->fetch()) { $total[] = $post_counts; } echo count($total); if you want to calculate all the values together can use array_sum() echo array_sum($total);
-
Typo? $this->_repsonse->append_body($body); $this->_response->append_body($body);
-
500 Internal Server Error only for some of the users
QuickOldCar replied to NareshYendluri's topic in PHP Coding Help
Look in your servers error logs. -
Help with limiting mysql to unique JOIN row print on php page
QuickOldCar replied to igorek24's topic in MySQL Help
See if this does the trick for you SELECT DISTINCT username, vehicles.veh_id, year, veh_make.make_title, veh_model.model_title, veh_registration.policy_num, cylinder_count, eng_hp, trans, int_color, ext_color, fuel_tank, date_format(veh_services.date,'%m/%d/%Y') as servdate FROM vehicles LEFT JOIN (veh_make, veh_model) ON (vehicles.model_id = veh_model.model_id) AND (vehicles.make_id = veh_make.make_id) LEFT JOIN (veh_registration) ON (vehicles.reg_id = veh_registration.reg_id) JOIN (users) on (vehicles.user_id = users.user_id) left JOIN (veh_services) ON (veh_services.veh_id = vehicles.veh_id) WHERE users.user_id = 2 GROUP BY (veh_id ) -
unable to override php's default exception Messages
QuickOldCar replied to ajoo's topic in PHP Coding Help
Disable all error reporting either with htaccess, php.ini or at the top per php script. htaccess php_flag display_startup_errors off php_flag display_errors off php_flag html_errors off php_value docref_root 0 php_value docref_ext 0 php.ini error_reporting = off php scripts, last line helps remove strict errors error_reporting(E_ALL); ini_set("display_errors", 1); ini_set('error_reporting', 30711); -
The most appropriative way of using data formats
QuickOldCar replied to web_craftsman's topic in PHP Coding Help
To me saving it as it's intended output is the best way to go about it. Which is why I said the editor. If you don't want to save as html you can do the bbcode addon for ckeditor. There is even bbcode parsers made for yii2. Unless you plan on creating everything from scratch and make another yii2 parser like the others. On the topic when need to include js or css into the cms, this is why any mature cms makes plugins or modules. Only cache html that will not be live or user data.