PHP: Connect Mysql Database Using PDO

<!– <?php $user=’root’; $pass=’’; $dbh = new PDO(‘mysql:host=localhost;dbname=yzmedu’, $user, $pass); ?> –> <?php try { $dbh = new PDO(‘mysql:host=localhost;dbname=yzmedu’, $user, $pass); // var_dump($dbh); foreach($dbh->query(‘SELECT * from message’) as $row) { echo “<pre>”; print_r($row); echo “</pre>”; } $dbh = null; } catch (PDOException $e) { print “Error!: ” . $e->getMessage() . “<br/>”; die(); } $dbh = […]

Login before Review of Advanced Customer Reviews!

By default, anybody can write a review, how to only allow the customer who has placed an order and has logged in to write a review? Enable Advanced Customer Reviews and click configure, besides “Who must be allowed to add reviews”, choose “Customer who bought product”, clicks “Apply Change”, done! If only let registered customer […]

X-cart Product Image Is too Wide under Mobile!

If we set “Maximum product image width” and “Maximum product image height” too big, say set “Maximum product image width” to 500, and set “Maximum product image height” to 250. We can visit the product image at product page properly via pc, but the product image will be too wide under mobile phones.

Laravel 5.2 Post: TokenMismatchException in VerifyCsrfToken.php line 67:

// Route::post($uri, $callback); Route::post(‘/eyeglasses’, function () { echo ‘post’; }); When running the code under postman, the errors are: Whoops, looks like something went wrong. 1/1 TokenMismatchException in VerifyCsrfToken.php line 67: in VerifyCsrfToken.php line 67 at VerifyCsrfToken->handle(object(Request), object(Closure)) at call_user_func_array(array(object(VerifyCsrfToken), ‘handle’), array(object(Request), object(Closure))) in Pipeline.php line 136 at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line […]

How to Install Symfony 2.8 under Ubuntu 16.04?

$ sudo curl -LsS -o /usr/local/bin/symfony $ sudo chmod a+x /usr/local/bin/symfony This will create a global symfony command in your system. — $ symfony new my_project_name // $ symfony new blog use the most recent version in any Symfony branch $ symfony new my_project_name 2.8 $ symfony new my_project_name 3.1 use a specific Symfony […]

How to Install Symfony 3 under Window 10?

Use composter to install symphony: Install Composer: download composer at and setup it. First install wamp at your computer, say you have installed wamp at D:/wamp, and have run it. Create a fold, named symfony, and install symfony under it, run windows command cmd, and run: composer create-project symfony/framework-standard-edition my_project_name After you have successfully […]

HostGator Page Not Found for Zen-Cart

We all know that HostGator has set custom 404 error page for all hosted websites, the visitor leaves your website and reaches to HostGator website. It is really very bad for your site, and SEO. Can we keep the visitor on our site even after 404 error comes? The answer is Yes! How to create […]

How to let X-cart redirect to product page directly?

At ,  several categories only have one product. The default category will only display one product, that make the category looks very ugly, I think if a category only has one product, we can hide the category, when a visitor click the category, the category url will redirect the detailed product page directly. How […]

How to display 3 latest articles at homepage of x-cart v4.7.4?

First step, edit postauth.php which is under root folder. Find $pages_menu = func_query(“SELECT * FROM ” . $sql_tbl[‘pages’] . ” WHERE language=’” . $store_language . “‘ AND active=’Y’ AND level=’E’ AND show_in_menu=’Y’ ORDER BY orderby, title”); $smarty->assign(‘pages_menu’, $pages_menu); Add the following codes below them: //dental loupes faq begin $pulled_articles= func_query(“SELECT * FROM ” . $sql_tbl[‘pages’] […]

Add Different Resource for EmpireCMS

Sometimes it is very difficut for us to publish an article if all the articles have 2 or more different articles resources from other sites. In this cases, we can not copy directly. We can use PHP code: