PHP's PDO allows multiple querys to be executed at once, either via the query() method or as a prepared statement. Both of the following examples work:
// Two SQL queries
$query = "SELECT * FROM table; DROP table;"
// Execute via query()
$pdo->query($query);
// Execute via prepared statement
$stmt = $pdo->prepare($query);
$stmt->execu...
Setup: Joomla website on LAMP stack
I have a MySQL table containing some records, these are queried by a simple SELECT on the Joomla article, as pasted below. This specific Joomla website has Caching turned on in Joomla's Global Configuration. I need to randomize the order in which I display the resultset, each time the page is loade...
I know that MongoDB can scale vertically. What about if I running out of disk?
I am currently using EC2 with EBS. As you know, I have to assign EBS for a fixed size.
What if the mongodb growth bigger than the EBS size? Do I have to create a larger EBS and Copy & Paste the files?
Or shall we start more MongoDB instance and each connect...
Hello,
I am building a Codeigniter shopping cart. On the cart details page I have a form input field allowing the user to type in the quantity required of a product, and a submit button to post the information to the update function.
When there is just one item in the cart, when updating the quantity everything works as it should. Ho...
Hi
As usual you write in Joomla Development
defined('_JEXEC') or die('Restricted access');
I make a plugin which needs access from Paypal/IPN, so i exclude that in that specific file. BUT I also need to use the Joomla-intern Variables to access the Database, so i tried this:
require("../filewithaccesstoframework.php");
OR even...
I got a PHP script that is looping and will continue to do so for about another hour. How do I stop it. The script explicitly overrides the time out and the memory buffer. It's on a shared hosting server with cPanel installed. The entire website is down until the script completes.
I had added a usleep(100000) statement, but it doesn't a...
I am trying to send the time to flash but set to the currently timezone. When you view the below even though the echo date, looks like its working the $time is the same. When i test in flash I get the extra hour added. Any help tips welcome on this one...
$format = "d/m/Y H:m:s";
$timezone = "Europe/Amsterdam";
date_default_timezon...
I am trying to pass a variable (in this case an IP variable of the user) into a url so when it is displayed on the web it is an automatic link. Below is the code I have and I'm getting an error. Seeking PHP Guru to help a n00b.
$user_tracking_vars = "<br /><br /><strong>Browser and Operating System:</strong> ".$browser."<br /><br /><str...
I have created a website which allows users to sign up for, and use, an online service. To help promote the website we will be have resellers who will be offering their own branded services through us. The initial plan is to allow resellers to place registration, login, and lost password forms on their own website and use an API created ...
Hi,
I'm running Drupal and Mediawiki on my server under the same domain. They are connected to each other with extensions/modules. Meaning if I log in to Mediawiki, it automatically logs into Drupal also.
Mediawiki has some extensions that filter the information shown on the page.
What I want to do is to show that filtered information...
How would i get the last 20 results submitted in a mysql db row.
I need the 20 most recent user submitted results.
Cheers.
...
Hello
I`ve been wondering how to implement methods in a class.
Could someone explain me what means if one does OOP in procedural style?
Here is an example:
class Fld extends Model {
private $file;
private $properties = array();
public function init($file) {
$this->file = $file;
$this->parseFile();
}
private funct...
I'm trying to implement a simple way to manage static pages in CakePhp, as described in this article.
The problem I'm facing is that App::import() doesn't seem to import the required class in the routes.php file.
The code is the following:
App::import('Model','StaticPage');
$page = new StaticPage();
$slugs = $page->find('list', array...
I want to create my own RSS/XML feed. I fetch data from the database to display, but keep getting invalid character errors. If the string has an ampersand or other strange characters in it, the XML will be invalid.
I tried using urlencode and htmlentities, but these don't capture all possible characters which need to be escaped. Does...
Quick question: One can set the path where a cookie is valid, but is it also possible to get (read) this path from the cookie (in PHP)?
Or else: is it possible to extend a cookie's time, without knowing what path it's on (but keeping the path the same)?
...
For the first time I am needing to join information from two tables and am quite nervous about doing it without any advice first.
Basically, I am building a secure site that is accessed by authorised users. I have my login table with user_id, username, password
Once the user is on the site, they have the option of inputting data into ...
I have a select and query like below...
$sql = "SELECT *
FROM notifications
WHERE to_id='".$userid."'
AND (alert_read != '1' OR user_read != '1')
ORDER BY alert_time DESC";
$result = mysql_query($sql);
how do I test how long the query took to run?
...
Hi everybody!
I am loading an xml in php via simplexml_load_file().
I load the file with that:
$xml = simplexml_load_file('flash/datas/datas.xml');
And the access my content like that:
$descText = $xml->aboutModule->chocolaterie->desc
The text from desc is well registred in my $descText, but all the <br/> of the text disappear....
I have stores this object in an variable called results. How would i access the profile_image_url for example.
Here is the return value with print_r:
stdClass Object (
[results] => Array (
[0] => stdClass Object (
[profile_image_url] => http://a3.twimg.com/profile_images/685278639/twitter-logo_normal.jpg
[created_...
I'm receiving XML sent via POST. Naturally I need to parse this XML to get at the goodies it holds for me. However, when I receive the XML is seems that PHP is parsing it like a query string.
For example, this xml:
<?xml version="1.0" encoding="utf-8"?>
<ForgotPassword>
<version>1.0</version>
<authentication>
<login>my...