I’m migrating my web application from MySQL to SQLite database. I found out there are two PHP extensions for communicating with sqlite: php_sqlite3.dll and php_pdo_sqlite.dll. What extension is better? Or another question: what are the basic differences between these extensions? Answer PDO is a wrapper …
Tag: php
Get the last word of a string
I have tried a few things to get a last part out I done this: The first one won’t work and the second returns an array but a realy need string. Answer If you’re after the last word in a sentence, why not just do something like this? I wouldn’t recommend using regular expressions as it’…
Header not redirecting if __DIR__ is used
If I use above header in index.php file it just shows a blank page with “localhost” URL. It works if I use include instead of header though. Is this an issue with DIR magic constant? It seems you can’t use it in headers, or do I have a problem with my code? Answer __DIR__ is a file-system pa…
Having trouble optimizing MySQL query with GROUP BY … HAVING
I’m trying to optimize quickly optimize the search functionality of some outdated forum software written in PHP. I’ve got my work down to a query that looks like this: word1 and word2 are examples; there could be any number of words. The number at the very end of the query is the total number of w…
Check for duplicate emails before querying
I’ve searched and look at other examples but as i’m new i’m having trouble translating over to my code. What I want to do is have it check the database to see if that email has already been entered. If it has I want it to tell them it has and that there is only one entry per person. Any
How to delete cookie on codeigniter
I don’t know how to delete a cookie. I want is when I submit a form. The cookie is also delete. I try the delete_cookie(“name”) but is not working. I think because the cookie I created by javascript. Please check my code to fix this problem. This is my sample text field: and this is the java…
How to call a function in a string using PHP
I wrote a function to dynamically insert the default date in a drop down option tag. In my function called pickDate I echo out the string at the end with double quotes. Then later in my code I have a for loop that produces a new string and inside the string I am trying to call my function. My problem
AJAX function in the widget class
I created a WordPress Widget which get the recent posts, first get a specific number of posts, then there is a button to get more posts by AJAX. The full Widget code And this is the AJAX code to get ajaxloadMore function output and append to the ul tag How to get $catid and $number variables from the function…
Fastest way to extract a specific frame from a video (PHP/ffmpeg/anything)
I have a web page, which (among other things) needs to extract a specific frame from a user-uploaded video. The user seeks to a particular part of a .mp4 in the player, then clicks a button, and an ajax call gets fired off to a php script which takes the .mp4, and the exact time from the video, and uses
Insert and Update data into two tables (Transactions) using Zend framework 2
I need to insert data into one table and references data into another table in ZF2 using tableGateway. For example, when I am registering a user, I have to insert user data into one table and this user hobbies data(Multiple rows) into another table with the references of the inserted user id and Update data a…