---
title: "connection with sql command"  
description: "connection with sql command"  
author: "Anonymous User"  
published: 2013-07-09  
updated: 2013-07-09  
canonical: https://www.mindstick.com/forum/1275/connection-with-sql-command  
category: "mysql"  
tags: ["mysql"]  
reading_time: 1 minute  

---

# connection with sql command

Hi [Expert](https://www.mindstick.com/articles/13120/an-expert-financial-advice-will-improve-your-finances)!\
How do I [execute](https://www.mindstick.com/interview/49/how-can-i-execute-a-php-script-using-command-line) a command as and when a new [mysql](https://www.mindstick.com/articles/12156/what-is-mysql) [connection](https://www.mindstick.com/articles/13012/what-makes-ethernet-connection-better-than-wifi) is established from php?\
**$con=mysqli_connect("localhost","root","","gts");****\**In the above example, I need to pass set [sql command](https://www.mindstick.com/blog/142/categorize-sql-commands-in-sql-server) :\
sql_log_bin = 0\
This will make sure that the [commands](https://www.mindstick.com/interview/817/what-is-the-use-of-dbcc-commands) executed by this connection will not be written to [binary](https://www.mindstick.com/forum/34709/please-write-a-program-for-decimal-to-binary-conversion-in-c-sharp) log. I have another "normal" connection that will work as usual and write all the commands to binary log.\
In other words I need 2 [connections](https://yourviews.mindstick.com/view/87707/baba-siddique-murder-news-his-connections-with-underworld) to mysql one with disabled binary logging. I should be able to [decide which one](https://answers.mindstick.com/qa/36695/when-two-rivers-meet-how-do-we-decide-which-one-is-the-other-s-tributary) to use. How is it done in PHP?\
Thanks in advance.

## Replies

### Reply by AVADHESH PATEL

Hi,\
First create two connections.\
**$con1=mysqli_connect("localhost","root","","gts");****$con2=mysqli_connect("localhost","root","","gts");**\
Then on one of them disable your binlog\
**mysqli_query($con1, "SET sql_log_bin = 0");****\**I Hope it helpful for you.


---

Original Source: https://www.mindstick.com/forum/1275/connection-with-sql-command

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
