Skip to content

Tag: mysql

In PHP, what happens in memory when we use mysql_query

I used to fetch large amount of data using mysql_query then iterating through the result one by one to process the data. Ex: Recently I looked at a few framework and realized that they fetched all data to an array in memory and returning the array. I would like to know the pros/cons of each method. It appears…

IMDB to MySQL: Insert IMDB data into MySQL database

I’m looking for a solution to import all the IMDB data into my own MySQL database. I’ve downloaded all the IMDB data files from their homepage which are all in the file format *.list (in Windows). I want to retrieve and that information and insert it correctly into my MySQL database so I can do some test and …

jQuery .post won’t read PHP include

I built my website from bunch of php include files that work like a template. When I change something in one file whole website changes. When I click on a radio button, ajax should activate and it should try to communicate with the other php file which should connect to the database and to send information ba…

PHP & MySQL: How can I use “SET @rank=0;” in $query=

In my PHP file, I use this line to pull data from my mySQL database: If I check the SELECT statement in phpMyAdmin’s SQL window (without $query= ) it works fine. But, if I use it in PHP, then I get an error. It doesn’t like the “SET @rank=0;” bit. Is there a way to use “SET @rank…

How to optimize a query with MySQL multi-query?

I need to optimize a script for high performance so the question is how can I add MySQL multi-query to this code? Answer If you’re using mysqli or PDO already, you should be using prepared statements for your queries since they are supported. This will also have a slight increase in performance since th…