Was wondering if it is possible to make a variable point to another variable instead of having it have a value of its own. What I'm trying to do is to have a class instance like:
$users = new User_Model();
and then have
$user
simply point to
$users
instead of making a new class instance. Is this possible? Think I saw something ...
I'm creating thumbnails cycling through a lot of images, when I find a large image I get:
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 13056 bytes)
Now I already know how to circumvent this with:
ini_set('memory_limit', '-1');
What I want to know is why it exhaust the memory! Is there some debug t...
what is the correct way to connect to MySQL database without the mysql_fetch_assoc() error?
Getting [Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource] with
mysql_connect('localhost', 'name', 'pass'); mysql_select_db('dbname');
getting mysql_fetch_assoc() error without mysql_select_db any suggest?
...
I want to set the cron job in the config file of the Catalog module to be ran at a different time. Currently it is setup like this in the config.xml
<crontab>
<jobs>
<catalog_product_index_price_reindex_all>
<schedule><cron_expr>0 2 * * *</cron_expr></schedule>
<run><model>catalog/pro...
I have an array of timestamps referring to the days when a holiday home is booked.
each timestamp is a round day.
I want to turn this into an array of 'begins' and 'ends' pairs for consecutive dates
Are there any php functions I should be aware of for writing this function?
Or does anyone have any pointers for this kind of thing?
...
I have the following code and it should return just one value (id) from mysql table. The following code doesnt work. How can I output it without creating arrays and all this stuff, just a simple output of one value.
$query = "SELECT id FROM users_entity WHERE username = 'Admin' ";
$result = map_query($query);
echo $result;
...
My javascript isnt so great, but i found a brilliant looking function here
I'm not sure what to do with this bit:
var ranges = [], rstart, rend;
full function:
function getRanges(array) {
var ranges = [], rstart, rend;
for (var i = 0; i < array.length; i++) {
rstart = array[i];
rend = rstart;
while (array[i + 1] - ar...
I have a function I use in PHP to work with numbers. The intent is to clean the number and, optionally, convert nulls to zero. It began for me for use in prep for sql, but is now used in more places. Here it is:
function clean_num ($num, $null_to_zero = true) {
$num = preg_replace("/[^-0-9.0-9$]/","",$num);
if (strlen($num) == 0)...
Hey folks. I'm looking for the best way to do something simple in symfony.
Basically, I have a module in which all the pages will contain the same header and footer. That module also shares the same general layout as the other modules.
I'm just wondering, should I create one file and have my content pages called up as partials or shoul...
basically i want to hold a parameter that retrieve value from $.post() call like this:
init = function(){
var lastpage = getLastPage();
}
function getLastPage(){
$.post("getInfo.php",{
last: "yes"
},
function(data){
setLast(data.last);
},...
Hi, please see: http://pastebin.com/5za3uCi1
I'm quite new to php and I'm editing the ventrilo status script. What I'd like it to do is that it stores everything in one big variable for easy parsing instead of using separate echo's. Can someone tell me how I can accomplish this?
Thanks,
Dennis
...
I am trying to come up with a function that does a good job of sanitizing certain strings so that they are safe to use in the URL (like a post slug) and also safe to use as file names. For example, when someone uploads a file I want to make sure that I remove all dangerous characters from the name.
So far I have come up with the followi...
I have the following code. I would like username to take the value of the getUserName function however I am fighting with syntax. Can anybody tell me what should be the correct one?
$query = "SELECT user FROM users_entity WHERE username = getUserName()";
...
I have a function in PostgreSQL / plpgsql with the following signature:
CREATE OR REPLACE FUNCTION user_login(TEXT, TEXT) RETURNS SETOF _get_session AS $$ ... $$
Where _get_session is a view. The function works fine when calling it from phpPgAdmin, however whan I call it from PHP I get the following error:
Warning: pg_query() [functi...
hi,
can I collapse the field in my edit-content page in Drupal ?
For example, at the bottom of the page Revision Information, URL Path Settings, Authoring Information etc are collapsed.
I would like to have this functionality for the CCK Fields as well.
thanks
...
I've got this php code and I'd like to get the exact equivalent C#
$ivSize = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_192, MCRYPT_MODE_CBC);
$iv = mcrypt_create_iv($ivSize, MCRYPT_RAND);
$encryptedData = mcrypt_encrypt(MCRYPT_RIJNDAEL_192, $key, $salt . $message . $nonce, MCRYPT_MODE_CBC, $iv);
$base64Data = base64_encode($salt . $iv . $encry...
Hi, I'm pretty new to CakePHP but I think I'm starting to get the hang of it. I'm trying to pull related table information recursively, but I want to specify which related models to recurse on. Let me give you an example to demonstrate my goal:
I have a model "Customer", which has info like Company name, website, etc. "Customer" hasM...
Is there an option for Zend's lucene implementation (or a third-party plugin) that would allow me to put the lucene dictionary into a [MySQL] database?
The reason I need to ask is that the database is the only common resource for our two otherwise independent web servers.
...
Hi Everyone,
I have this file 'gardens.php', which pulls data from a table called 'generalinfo' and I use fopen to send that data to a file called 'index.html'. Here is the issue, only one option is filled. I have a demo running here Garden Demo <-- this is a new updated page and location, there are more errors than I have locally If an...
Given the following case:
<?php
class ParentClass {
public $attrA;
public $attrB;
public $attrC;
public function methodA() {}
public function methodB() {}
public function methodC() {}
}
class ChildClass extends ParentClass {
public $attrB;
public function methodA() {}
}
How can I get a list of me...