i am familiar with python and also familiar with mysql and SQL. I am also clear on con, cur and commit, but my problem here is that im trying to make a small program in python (no need for a gui) to insert data into a mysql database, and bring it on my console or file. I'm confused where to start, i tried seeking google but i couldn't find any toturials about my issue, any help? a link or where to start. Also:  i know the python program can be written in an IDE or a text file, but how does it connect to mysql database? if im wrong please correct me.
40022
How do I connect to a MySQL database using a python program?
61452
Is it possible to run a Python script when a file has been added to a folder?  In my scenario I have a folder that contains movies and the Python script gets the details (name, year, plot, rating, etc) from OMDb and puts them into a file, which MySQL uses.   Every time I add a movie I have to run the Python script.  I want to know if it is possible to automatically run the Python script when a file has been added to the folder?  Thanks in advance.
123392
I have a database called foo and a database called bar. I have a table in foo called tblFoobar that I want to move (data and all) to database bar from database foo. What is the SQL statement to do this?
107460
The XAMPP installation is done. XAMPP is up and running.  What about the MySQL console? How is possible to start the MySQL console to run some special SQL statements?
34384
Since MySQL doesn't seem to have any 'boolean' data type, which data type do you 'abuse' for storing true/false information in MySQL?  Especially in the context of writing and reading from/to a PHP script.  Over time I have used and seen several approaches:   tinyint, varchar fields containing the values 0/1, varchar fields containing the strings '0'/'1' or 'true'/'false' and finally enum Fields containing the two options 'true'/'false'.   None of the above seems optimal. I tend to prefer the tinyint 0/1 variant, since automatic type conversion in PHP gives me boolean values rather simply.  So which data type do you use? Is there a type designed for boolean values which I have overlooked? Do you see any advantages/disadvantages by using one type or another?
52772
I know how to map a list to a string:  foostring = ",".join( map(str, list_of_ids) )   And I know that I can use the following to get that string into an IN clause:  cursor.execute("DELETE FROM foo.bar WHERE baz IN ('%s')" % (foostring))   What I need is to accomplish the same thing SAFELY (avoiding SQL injection) using MySQLDB. In the above example because foostring is not passed as an argument to execute, it is vulnerable. I also have to quote and escape outside of the mysql library.   (There is a , but the answers listed there either do not work for MySQLDB or are vulnerable to SQL injection.)
40449
I'm creating an installation script for an application that I'm developing and need to create databases dynamically from within PHP. I've got it to create the database but now I need to load in several .sql files. I had planned to open the file and mysql_query it a line at a time - until I looked at the schema files and realised they aren't just one query per line.  So, how do I load an sql file from within PHP (as phpMyAdmin does with its import command)?
10493
Do you know a good source to learn how to design SQL solutions?  Beyond the basic language syntax, I'm looking for something to help me understand:   What tables to build and how to link them How to design for different scales (small client APP to a huge distributed website) How to write effective / efficient  / elegant SQL queries
74983
I'm writing a php app to access a MySQL database, and on a tutorial, it says something of the form  mysql_connect($host, $user, $pass) or die("could not connect");   How does PHP know that the function failed so that it runs the die part? I guess I'm asking how the "or" part of it works. I don't think I've seen it before.
121103
Is there a GUI IDE for programming python just like java has netbeans?  I wanted one where we could drag &amp; drop test boxes &amp; labels just as we do in swing components using netbeans or eclipse.  Or is there an add-on present in either netbeans or eclipse itself?
60449
I see that within MySQL there are Cast() and Convert() functions to create integers from values, but is there any way to check to see if a value is an integer?  Something like is_int() in PHP is what I am looking for.
84550
I have MySQL password saved on a file foo.php, for example P455w0rd, when I try to use it:  $ cat foo.php | grep '$dbpwd=' | cut -d '"' -f 2 | mysql -U root -p mydb -h friendserver Enter password: (holds)  $ echo P455w0rd | mysql -u root -p mydb -h friendserver Enter password: (holds)   Both option still ask for password, what's the correct way to send password from stdin?
2458
I want to create a text file which will add each command I am going to run on the terminal as a new line entry in the text file. i.e., I need to keep a record of what are the things I'm doing in the terminal. Further if I can keep a record of outputs I'm getting in the terminal, along with the inputs in the terminal, as a text file, it will be much better.   Each time I forget a command I have to search again in the Internet for the command.  Can I can make a file like above?
119372
I am very, very new to MYSQL.I tried to create a table named "option". My SQL Query is :  create table option(   id int not null primary key auto_increment,  choice varchar(30)  )  While executing this query it shows the following error  Error Code : 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'option( id int not null primary key auto_increment, choice varchar(30) )' at line 1 (0 ms taken)  If I try with the table name as "choice" it is working.  can we have the table name as "option" in mysql?   thanks
103134
I have come to the conclusion that my PHP installation and my MySQL installation are not getting along; I’m working on making my first web page that uses MySQL for content, but after two days, man pages, online documentation, and dozens of tutorials, I just can’t get the PHP/MySQL part to work.  I have an established home web server (I am the only admin/user) that runs Apache and hosts my web pages.  I have MySQL installed, and was able to create and query a database through Terminal.  I have PHP installed, and can use echo to print text to the document.  When I work with MySQL however, everything changes…  I have a page that contains initialization stuff in .  contains a few paragraphs of hardcoded HTML and then PHP code to access MySQL.  When I first loaded the page, all that resulted was a blank page.  I commented out the PHP section and reloaded to confirm that the plain HTML still worked, which it did.  Therefore, some part of PHP was keeping any of the page from ever loading.    To begin troubleshooting my code, I left all of the PHP code commented except the following code for the server connection, which is adapted from several different tutorials:  &lt;? echo("&lt;p&gt;PHP is working&lt;/p&gt;");  $ses = mysql_connect("localhost","username","password"); if(!$ses){  echo("&lt;p&gt;Connection to content server failed.&lt;/p&gt;");  exit(); } echo("&lt;p&gt;Database Connected&lt;/p&gt;"); ?&gt;   When the page is loaded, the beginning HTML loads in addition to a paragraph reading “PHP is working” but neither the failure or success message appear.  I removed the If structure from the code - so that only two echos and the mysql_connect remained – and got the same result.    It seems that the mysql_connect feature is causing the server to stop loading the code when it is run, but I’m out of ideas for how to fix it.  For the record: I’ve modified the php.ini file to include the “connection = msql.so” line, and I’m using MySQL 5.5, Apache 2.2.22, PHP 5.3.10, Ubuntu 12.04.  Also, both my router and modem have been configured to forward port 3306 to the server – though I don’t see how that should be necessary – and my MySQL username and password have been triple checked and are identical to the ones that I use successfully in Terminal.  What am I missing?
6943
I have a program that takes input from   stdin and also takes some parameters   from command line. It looks like this:  cat input.txt &gt; myprogram -path "/home/user/work"       I try to debug the code with gdb   inside emacs, by M-x gdb, I try to   load the program with the command:  gdb cat input.txt &gt; myprogram -path "/home/user/work"       However, gdb does not like it.   Question cribbed from . Unfortunately I don't understand the solution and am not sure what to do beyond compiling with the -g option and running the command M-x gdb.
73
If user input is inserted without modification into an SQL query, then the application becomes vulnerable to , like in the following example:  $unsafe_variable = $_POST['user_input'];   mysql_query("INSERT INTO `table` (`column`) VALUES ('$unsafe_variable')");   That's because the user can input something like value'); DROP TABLE table;--, and the query becomes:  INSERT INTO `table` (`column`) VALUES('value'); DROP TABLE table;--')   What can be done to prevent this from happening?