php

how to counting from data array?

i have some data at DB like: qty item id date 0001-0500 abcd 1 2010-06-22 0001-0500 abcd 2 2010-06-22 0001-0500 abcd 3 2010-06-22 i want some script can make them order by date and show result : qty : 500 (it means 500-1=500,number 1 read 1-1 = 0) item : abcd id : 3 (counting from 1 until 3) date :2010-06-22 qty ...

What are the disadvantages of using persistent connection in PDO

In PDO, a connection can be made persistent using the PDO::ATTR_PERSISTENT attribute. According to the php manual, these connections are not closed at the end of the script, but are cached and re-used when another script requests a connection using the same credential. The persistent connection cache allows someone to avoid the overhead ...

Why the following PDO transaction is committing?

I think the question itself is pretty self-explanatory. The code is given below - <?php $PDO = NULL; $pdo_dsn = 'mysql:host=localhost;dbname=pdo_test'; $pdo_persistence = array( PDO::ATTR_PERSISTENT => true ); $db_user = 'root'; $db_pass = ''; $db_query = "INSERT INTO person(name, address) VA...

Authorize posting to Facebook Fan Page

Hello! Does anyone know if you're able to authorize posting to "Fan Pages" using the new Oauth system, or is it still required to be done in the legacy fashion (as shown on http://stackoverflow.com/questions/2097665/authorizing-a-facebook-fan-page-for-status-updates)? I've attempted to dig deep into the new API for ways to authorize of...

How do I prepend file to begining??

In PHP if you write to a file it will write end of that existing file. but how do we prepend a file to write in the beginning of that file?? I have tried rewind($handle) function but seems over writing if current content is larger than existing... Any Ideas?? ...

how to make sure other programmers don't put backdoors and callbacks in my site!

How can I look for any client side call backs in javascript. I have people adding javascript code for me. how do I make sure they are not somehow sending confidential data or user info to their sites through client side POST, GET, AJAX or any client side methods! How would I do the same thing for my server side code like to see my php p...

secure transfer between login form and server in php

how can i implement a secure transfer from login form on client to server in php? i mean coding password and user ,something except using https. ...

str_replace of html using php

Hi, I have this code: $newphrase = str_replace('href="/Css/IE6.css"', 'href="http://www.company.com/pgrddedirect/iefix.css"', 'href="/Css/IE6.css"'); So that I can search the html file in php using DOM in an attempt to modify the location of the .css file before I redisplay it. I intend on uploading the new .css file to my server and...

How to read session values form another session instance in PHP?

Hello guys, I am doing something in PHP where I have to read session values for another session instance. example Browser1: $_SESSION['value']="user1"; Browser2: $_SESSION['value']="user2"; Browser1 will need to get "user2" value from certain request. The request will also include cookie(key, value). How can I do that? Thanks, Wa'e...

Fatal error: Cannot redeclare happening on same line

I have been fighting with this error for a while. The error is somewhere in the function I now have php telling me it can't redeclare a variable on the same line... strange. Any help would be great. Fatal error: Cannot redeclare bp_block_admin_init() (previously declared in /home/bp-member-login-redirect/bp-member-login-redire...

Regex - Grab a specific word within specific tags

Hey guys, I don't consider myself a PHP "noob", but regular expressions are still new to me. I'm doing a CURL where I receive a list of comments. Every comment has this HTML structure: <div class="comment-text">the comment</div> What I want is simple: I want to get, from a preg_match_all, the comments that have the word "cool" in th...

How to apply privacy settings on posts the appear in a news feed with MySQL ?

What I am trying to achieve is a complex privacy routine, i have the following tables. posts posts_privacy privacy_global followerlist We have a news feed sort of thing on our site, which gets the 10 latests posts from the people a user is following, there are 3 levels of privacy, first is privacy_global where the user can set a pri...

javascript file not being cached?

Hi guys, I'm trying to optimize my web application and unfortunately have ended up with a javascript file size of around 450K - that too after compressing [it would take a while for me to redo the javascripting but until then I have to go live] - I initially had made a number of small javascript libraries to work upon. And what I do is I...

Sending mails from localhost to gmail or yahoo or rediff ?

Hi i am working on sending email to any recipient like yahoo gmail my code is contact form <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Email Form </title> </head> ...

php vs regex for counting data

hello..i need your help. i have an array, it have same data: data range 115X0101-115X0200 115X0101-115X0200 115X0101-115X0200 the 115x mean production code..this unimportant. we just concern at four digits behind it that we can counting. 1. i want script read or search "0101" and "0200" from 115X0101-115X0200 2. i have tried u...

PHP Object Extension $this->some_object->method

I am trying to make a script in which different classes (e.g. Database, Utilities, Config) are all used to form one central Main class. I have tried extending a chain of them: Main -> Utilities -> Database -> Configuration But how can I set the different parts so that they can be called like this: <?php $this->db->select("WAFFLE...

we should have the ability to add/remove/hide columns on listing page.

in php,there is a simple listing page.in listing page we can not display all the columns from database.i want to give functionality of add/remove/hide columns. ...

delete main row and all children mysql and php

Hi there, I have inherited a PHP project and the client is wanting to add some functionality to their CMS, basically the CMS allows them to create some news, all the news starts with the same content, and that is saved in one table, the actually news headline and articles are saved in another table, and the images for the news are save...

Combining Install Profiles

So lets say that I'm interested in the functionality that Install Profile A offers, but I'm also interested in some of the functionality that Install Profile B offers. But technically it's not possible to fire up both install profiles. Is there a way I could someone manually combine 2 install profiles into a custom one? Do I have to re...

Any reference material for fetching search results from retail sites?

If the question hasn't already done so, allow me to flag myself as a relative newcomer to backend programming. I'm really just wondering if anyone could point me to some literature on how to (for example) scrape the results of a search for "Die Hard" from amazon.com, and list them on your own page. Thanks in advance. ...