Skip to content

Count number of columns in a CSV file, using PHP?

Is it possible to validate a text file before I dump its data into a MYSQL database? I want to check if it contains, say, 5 columns (of data). If so, then i go ahead with the following query: LOAD …

What is data serialization?

First of all, I couldn’t get clear definition of it from WikiPedia or even from serialize function in the PHP manual. I need to know some cases where we need the term serialization and how things are …

Validate Mobile number in php form

I want to validate mobile number of 10 digits and also add a prefix of 0 when I enter into the database. <?php include ('database_connection.php'); $citystate = $_POST['citystate']; $…

Predis is giving ‘Error while reading line from server’

I am using predis, it’s subscribed to a channel and listening. It throws the following error (below) and dies after 60 secs exactly. It’s surely not my web servers error or its timeout. There is a similar issue being discussed here. Could not get much of it. I tried setting connection_timeout in p…

Unset post variables after form submission

Is there a way to do the above? Basically, I don’t want the form to be submitted again if someone presses refresh after already submitting the form once. In which case the browser asks, do you want to …