I have few scripts loaded by cron quite often. Right now I don’t store any logs, so if any script fails to load, I won’t know it till I see results – and even when I notice that results are not correct, I can’t do anything since I don’t know which script failed. I’ve decide…
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…
Don’t reset form values after submit
After giving a preview by php header code, I want to not reset the input boxes? Thanks. This is my simplified code: html Code Answer You have to give all the input boxes a value attribute equal to the previously submitted value.
Database Design For Developing ‘Quiz’ Web Application using PHP and MySQL
So, I’m trying to learn PHP and MySQL (I have a basic understanding of both; I’ve read the first half of both Head First SQL and Head First PHP & MySQL) and I figure the best way to solidify my knowledge is by building something rather than reading. With that in mind, I would like to create a …
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…
Problem with PHP and Mysql UTF-8 (Special Character)
I Have a form with one textbox called(ProductTitle) if I write as example “Étuit” in the textbox and click on Save, I post the data in a table called Product. The result int the database for …
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…
PDO Mysql prepared statement last_insert_id returns wrong value on multi-insert?
I noticed that if I prepare a multi-insert statement and execute it into MySQL via PDO, and then request the last_insert_id, I get the first ID of the multiple inserted rows, not the last one. Specifically: will create these rows on an empty table: But the last_insert_id will return “1”. Is this a…