Skip to content

Tag: php

what is the difference between sqlite3 and pdo_sqlite

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 …

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…

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…