I have a online PHP system where users vote different awards for their friends, however I am finding that the awards in the middle of the page and at the bottom get less votes overall. I would prefer this to be evenly distributed so came up with ordering the list of awards by random to make it different each time you load the page.
This...
This works in Safari, FF, Chrome, etc.:
setrawcookie('mycookie', 'myvalue', time() + 31556926);
This does not work in FF or Chrome:
setrawcookie('mycookie', 'myvalue', time() + 31556926, '/', '.localhost');
I have been using PHP for quite some time, and have never seen this behavior before.
...
Hello,
I have this code to add new elements to a multidimension array:
$this->shopcart[] = array(productID => $productID, items => $items);
So how do i remove an element from this array? I tried this code, but its not working:
public function RemoveItem($item)
{
foreach($this->shopcart as $key)
{
if($key['productID'] == $item)
...
Any hacks to make my absolute positioning render how it is suppose to on IE6?
...
I'm trying to allow rel attribute in a elements within HTML Purifier filter. I'm following this guide http://htmlpurifier.org/docs/enduser-customize.html and here is my code:
$config = HTMLPurifier_Config::createDefault();
$config->set('HTML.Doctype', 'XHTML 1.0 Strict');
$config->set('HTM...
I have a website where I need to parse date/time strings from receipts. These can be in a variety of different formats -- for instance, one string could be '11/04/2009 12:46PM', while another could be 'Mar06'09 10:57AM'. I need to get a standard date/time string out of them to do a database insert.
I'd like to avoid writing new php cod...
The problem:
I have a legacy php app that is coded in no particular style (some OO, function libraries, some templates, no templates), which I am slowly rewriting, cleaning up, and adding to.
When I introduced templates to the system, it was immediately evident that that would really clean up and simplify the code a lot because of th...
I'm looking for a PHP script that can:
Be downloaded and installed on my website
Give my site or any other entered url a SEO score
Suggest improvements for the entered site
Is there somethiing open-source available that does this? Maybe even a paid service that allows me to call a web service from my site?
...
I have an single-dimensional array of PHP objects. Each object has two attributes, one attribute is the object's unique ID and the other is the unique ID of another object in the array that is its parent. For example:
array(3) {
[0]=>
object(stdClass)#1 (2) {
["ID"]=>
int(1)
["parentID"]=>
int(0)
}
[1]=>
object...
I have 31 separate tables (actually I have 365, but lets keep this simple) in a MySQL database, each containing data for a given day. The tables are (badly) named based on the day.
Example:
island01Aug07
island02Aug07
island03Aug07
island04Aug07
...
island31Aug07
I would like to combine all the tables into one master table:
island_...
Hi
What is the way to get the greatest value into a serialized data. For example i have this in my column 'rating':
a:3:{s:12:"total_rating";i:18;s:6:"rating";i:3;s:13:"total_ratings";i:6;}
How can I select the 3 greatest 'rating' with a query?
thanks a lot
...
the images are showing up in safari and firefox but not IE6. I have four images, two of them are showing up in IE6 and two are not. If it helps, they are being toggled with an if statement. suggestions?
Here is an example of the code, there are four of these chunks:
<div class="NavIcons">
<a href="h...
I'm working on a small project, where I'm using the codeigniter php framework, but find it's got a bit too much bloat for my purpose.
Essentially I'd like something to make database interaction, sessions and validations simpler. MVC would be nice too.
What I'm looking for is something that has 10 php files tops.
When I'm adding some...
function get_arr() {
return array("one","two","three");
}
echo get_arr()[0];
Why does the above code throw the following error?
parse error: syntax error, unexpected '['
...
When I insert a row into a table with 1000+ entries, and attempt to return the row ID (be it from an autoincrement trigger/seq, or from setting the value manually in the insert statement), I get a truncated value:
$db = OCILogon(DATABASE_LOGIN, DATABASE_PASSWORD, DATABASE_NAME);
$mysqldate = date('Y/m/d G:i:s');
$db_vid_id = 748;
$auth...
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 136753 bytes) in /home/alien/Desktop/1/scanner.php on line 166
this is 166 line of the PHP code:
$text[$i] = curl_multi_getcontent ($curl[$i]);
is here any way to get around this by emptying RAM or something, sorry I'm not a programmer
...
Hello, I am using this code to enter update user permissions on a web app:
$updaters = array();
for ($i = 1; $i <= 24; $i++){
if (isset($_POST['permsA['.$i.']']))
$updaters[] = '`'.$i.'` = \''.mysqli_real_escape_string($db, $_POST['permsA['.$i.']']).'\'';
}
$insert = mysqli_query($db,'UPDATE `tbl_perms` SET '.implode(...
I'm looking to get a random row from MySQL without using too much time or resources on the system. I don't care about weather the code given is PHP or MySQL based, however please note there are 'gaps' in my table.
My table columns are
'id' (Primary key, auto increment), varchar, int, int
I'd like it to be as random as possible
...
I have some HTML that is being run through PHP:
<a href="?char=">&</a>
and I'm wanting to use a preg_replace to replace the first & with a urlencoded value of it. However:
preg_replace("/char=\">(.*?)<\/a>/", "char=".urlencode("$1")."\">$1</a>", $links);
But this gives me the value $1, instead of the expected back-reference. How ca...
Hi,
i'm looking for a way to display a web page inside a div of other web page.
i can fetch the the webpage with CURL, but since it has an external stylesheet when i try to display it, it appears without all his style properties.
i remember facebook used this technique with shared links (you used to see the page that was linked with a fa...