Can't run queries in database console from php - phpstorm

I've just readl the Database Code Completion while working in PHP on your web support. So I've configured the database, I can complete the queries with ctrl+enter but I can't run query on console. I send you some pictures to explain the problem.
I've the database configured, so I can check the tables and all the dates, and run queries directly at the console, but can't send from php the query.
Thanks for all, Manu.

You need to connect to the DB before you run any queries on it (example in MySQL here: http://www.w3schools.com/php/php_mysql_connect.asp, don't forget to close it when you don't need it anymore. )
The result is not plain text, you need to go through it in a loop (example including the connection here: http://www.w3schools.com/php/php_mysql_select.asp ).

Related

No matter what I query, MySQLWorkbench gives me the same response

While I am just learning MySQL and MySQLWorkbench, and have perhaps have done something boneheaded, I cannot find a reference to this.
Suddenly, no matter what line of code or what query I run, it outputs the same response even if I query for tables disconnected to the response. The database tests connected. I have run the use command. I have tried to google hack this and found nothing close to my situation. It was running just fine. I did not change the database. I was just running some very basic SELECT queries.
Any ideas?
Did you check your installation ?

Writing many MySQL (in vsCode) queries in one file. How to avoid writting 'USE DBaseName" constantly?

I'm learning SQL / MySQL using WAMPSERVER and the MySql extension for vsCode, so that I can write, comment and keep the code in the vsCode editor, instead of sending volatile queries with the command line.
This morning I created a database by right-clicking a database / New Query:
After creating it this way, I was able to create code that I run without having to write USE DBaseName before the selected lines, as in the selected three lines you can see below:
Yet, after restarting my laptop at home, the same code will not run. It returns the usual
undefined
Error: ER_NO_DB_ERROR: No database selected
unless I write the USE statement, as in the last group (4 lines) of code. So I have to write that every time I want to try a query...
Why did it work this morning and not now? How can one run queries without having to constantly write USE DBaseName?
(links to explanations to further understand the underlying mechanism are also very welcome...)
EDIT: posting image of server in vsCode to answer comment:
I'm using a local server (pic below) which hasn't changed since this morning...

how to log all the sql queiers are run in server in asp?

I have a classic asp code with access database, and i am new to it. I need to log all the sql queries happen in system since the system seems loosing data. can any one help with with this?
Thanks
Ms-Access does not support transaction logging like the more advanced database servers, the only way to do this would be if you could control the environment whereby any SQL is run, in this case within the front-end application. You could then trigger a routine to save the executed string. However, if people have background access to the database and can run their own queries whenever they like then you have little chance of logging these.

connecting Visual Fox Pro to MySql database

I converted visual foxpro DBF to mysql and I need to connect the vfp code directly to the mysql database.Please help.thanks
There are a number of ways to access data from a server database from VFP, but I'm not sure you'd call any of them connecting directly to the server database. Specifically, you can't use commands like USE and REPLACE directly against a server database, nor can you bind form controls directly to the server data.
Whichever approach you use, you pull some data from the server into a cursor in VFP, operate on the cursor, and then, if appropriate, save changes back to the server.
The three main approaches are:
1) Remote views--with this approach, you store SQL queries in a database. To run the query and pull data from the server, you USE the remote view.
2) SQL Pass-Through (SPT)--with this approach, you use the SQLEXEC() command to send SQL commands to the server, and get results.
3) CursorAdapter class--with this approach, you set up a class that describes how you want to get data from the server, and when you call the CursorFill() method, you get a cursor full of data.
You should choose one of these approaches and use it throughout your application. They each have pros and cons.
To get you started, since you'll probably want to use SPT for testing purposes (like in the Command Window) anyway, here's the basics of that approach:
First, you have to connect to the database. You do that with either the SQLConnect() or SQLStringConnect() function. For example:
You'll need to fill in your userid and password where indicated.
nHandle = SQLStringConnect("driver={MySQL ODBC 5.1 Driver};SERVER=localhost;UID=;pwd=")
A positive value for nHandle indicates success. Once you have a handle, you use it to send additional commands. For example:
nSuccess = SQLEXEC(m.nHandle, "SELECT First, Last FROM Customers WHERE State='PA'", "csrPACustomers")
That tells MySQL to execute the query you pass in and put the results in csrPACustomers. nSuccess indicates success or failure.
When you're done, use SQLDisconnect() to close your connection:
SQLDisconnect(m.nHandle)
You can read about all three approaches to remote data in the VFP Help file and on the VFP Wiki (http://fox.wikis.com). Once you decide which approach you want to use, you can ask specific questions.

From where the Mysql history is coming in Workbench?

i have observed that workbench has an option called history, which is giving all my db operations in day wise, i want to know from where it is getting, i mean is mysql is maintaining any table internally. I need to update the databse everyday to my client so it will be useful to me, Please help
If anyone still needs this the history is stored (at least in Windows 7) in UserFolder\AppData\Roaming\MySQL\Workbench\sql_history in separate XML files for each day.
For mac users, you can find the history files at
/Users/<username>/Library/Application Support/MySQL/Workbench/sql_history
Though the history file stored there only has some dates in it(Seems like Workbench is using it for some indexing.... not sure though). If you need actual history with queries you can check the log files at
/Users/<username>/Library/Application Support/MySQL/Workbench/log/
I think that regarding this http://dev.mysql.com/doc/workbench/en/wb-history-palette.html the Workbench history is kept from what you acctually execute in the workbench and it is not taking this data from the MySQL server.
Is is a log of queries that you have run in Workbench.
Also "Like the mysql command line client utility, MySQL Workbench has a full history panel, which provides complete session history. This makes it very easy for a user to review, re-run and modify previously executed SQL statement(s). Along with that, multiple queries can be executed at the same time while their results can be viewed in individual tabs. You can also have multiple SQL tabs open at the same time."