How to connect with MongoDB via CodeIgniter

I am upgrading my Ubuntu server and installing latest version of PHP i.e PHP 7.0.18, MongoDB 3.2.14, CodeIgniter v 2.2. Now when I am trying to connect with Mongo through CodeIgniter I am getting error as: The MongoDB PECL extension has not been inst

AWS increases iops

I have never used AWS before and have created a php application hosted on an EC2 instance. The application inserts records into a RDS after processing them. On the free tier it is inserting them at a rate of around 10 records per second. How would I

Best practice for printing barcodes in dompdf

I want to create a label sticker with barcode in PDF. Please give me the suggestion to create this things. Now , I use CI3 and dompdf. I have tried googling a lot of time, but I am not found the best practice to realized this thing. I followed your s

remove blockquote from Wordpress post

I have the following function which puts just the content on the page (images were removed) <?php $content = preg_replace('/(<img [^>]*>)/', '', get_the_content()); $content = wpautop($content); // Add paragraph-tags $content = str_replace('&l

PHP - reset the password program

I am making a php program for users to reset their password if they forget it and I am wondering how I should send the user the url to their email to click. I thought about encrypting their user id and decrypt it to know which user to update the pass

Drupal 7: Database query file

In page.tpl.php of Drupal, the following code has variable $page which contains the html codes that are required to render part of the webpage. <?php if ($page['content']): ?> I'm trying to retrieve the updated content from DB at an interval and upd

Mysqli query and select db warnings

So I have this code and my browser is giving me warnings. The code is here: 47 mysqli_select_db($database_connHotel, $connHotel); 48 $Result1 = mysqli_query($insertSQL, $connHotel) or die(mysqli_error($connHotel)); The warnings are here: Warning: mys

Select2 in a complex form as an abstract class

I need to use the select2 object in my form. This is my form http://i.stack.imgur.com/jVILq.jpg There are many select html objects. For instance If I would like to change the Customers select box into a Select2 object I have written this little snipp

PHP redirection to the selected page after login

I'm trying to find a way to redirect a user to the page they selected if they have been forced to log in again after a session timeout. Right now, after the user logs in, they are redirected to index.php. But, if a user received a link in an email to

simple connection function using PDO

im still in the early learning stages, banging my head against walls looking for clues. Iv been reading the manual to no avail. im building a user log in system based on the phpAcadamy tutorial 'Register & Login'. They use mysql_connect in the tutori

switch isset triggered when the case is -not- set

--Let me add this. This code works for me the way it is. I just do not know why it works.-- I can't figure this out. switch ($_SERVER['QUERY_STRING']) { case isset($_GET['test0']): echo "test0<br>"; break; case isset($_GET['test1']): echo

Add a node programmatically

I am very new to Drupal. I need to develop a site using this CMS. I can understand creating content as an admin. But I would like to create content from code. For example I want to create articles in the backend programatically without publishing the

How to stop updating the jQuery publishing page

I am getting data from an MySQL database through PHP. I am sending the and getting the data from PHP using jQuery. Here is the code. $.POST("SubmitCode.php", $("#questionCodeForm").serialize(),'json').done(function(data) {}); Now the p

Checking a cookie in a PHP script

Hey i still need a little bit of help with the rating system but i have a problem checking if the cookie exist this is <?php $rating = new ratings($_POST['widget_id']); isset($_POST['fetch']) ? $rating->get_ratings() : $rating->vote(); class rati

PHP - Regex works inconsistently

I have the following statement echo preg_replace("/(?<=\d)(th|rd|st|nd)([^0-z])/i","<sup>$1</sup>$2","some text 1st<br />\n2nd<br />\n3rd<br />\n4th 5th 21nd 33rd 41st<br />\nsome text")

How to use sessions in PDO?

I am still redoing and getting rid of old mysql_* commands in my code. I tried to transfer my session login form old code and this is what I got so far: public function login($user, $password) { if (!empty($user) && !empty($password)) { $password

PHP still does not allow file downloads greater than 2 MB

I have a Debian Squeeze install on an Amazon EC2 instance running Apache2, and PHP 5.3.3-7. I would like it to be able to accept uploads from a standard point-and-shoot camera (about 5 MB). Accordingly, I've edited php.ini in /etc/php5/apache2/ to al

PHP: Duplicate entry 'xx' for key 'yy'

I get the following error: Duplicate entry 'morandi-midnight-train' for key 'post_name' I want to check if post_name field has already a row defined with a variable and echo an error if it does. How can i acomplish this? post_name has a unique indexR

Boolean comparison processing by PHP - explanation?

I've come across something that intrigued me and I just want to know how to explain why it's happening. $var = true; if($var == 'X'){ echo 'pass'; } The above code will trigger 'pass'... why? If i use $var === 'x' it'll behave as expected. Thanks.A n

Why does this htaccess file cause a 500 error in Apache?

Why is my htaccess file causing a 500 error? I am trying to get it so when anyone enters http://www.example.com/24 it will run the script for the 'key' 24 but the server reads http://www.example.com/?key=24. Php script on index.php: <?php include("

PHP format output html

In ruby on Rails, you have the option to create cleaner and well formated output: <div> <%= 3.times do -%> <%= "Hello World" -%> <%= end -%> </div> and the output will be: <div> Hello World Hello World Hello W

Same scenario, work on one site, do not work on the other!

First of all I apologize in advance for this question, a bit off the rang of stackoverflow, but I've spend a day trying to solve that issue and I'm totally stuck. The issue: The search function of my script (php) works perfectly fine on one host but

Elmah For others PHP

Is there an Elmah equivalent for PHP in general, Symfony in particular?Symfony comes with a logging framework that can log to file or any other backend you care to give it. From my understanding of Elmah this is about as close as you can get - there'

best way to create / split a string into tags

In my php application user able to enter the tags(like here while ask question). I assume it will be regexp, and I used one - mb_split('\W+', $text) - to split by non-word characters. But I want to allow users to enter characters like "-,_,+,#"