php

How to make a web live chat? PHP?

Hello. Does anyone know how I can make a live chat on a webpage? Maybe using PHP and have the text stored into a database? If so, how could I get the text to automatically show on the users live chat, without refreshing? Any ideas? Thanks. ...

Is it safe to develop for older versions of Zend Framework?

Our vendor-supported server's O/S only supports PHP 5.1.6, which limits us to ZF 1.6. The current version of Zend Framework requires a higher version of PHP. We're struggling to decide whether to adopt ZF because of this incompatibility. Is it feasible to develop (indefinitely) in these older versions of ZF or should we hold off? Fea...

best PHP programming approach?

Hello guys, i guess that many of us has acceptable years of experience in PHP programming, me myself got 5 years programming in PHP since in University (not very solid), i just want to gather some suggestion here, what is better approach in PHP OOP? Since there is a lot of PHP framework out there as well as javascript framework, can a...

Advice on Session var and Shared SSL

Hi, I got a client which is website is under SSL only on the payment proccess. But he bought shared SSL so the actual domain is different (although I think its the same server). So when a user is logged in at for example: www.mydomain.com/login.php and tries to buy something he redirected to https://secure20.livessl.com/mydomaincom/pay...

how to show text while typing in textarea in jquery

hey guys i looking for a way to preview the text while im typing in a textarea in jquery exactly what u are using for Stackoverflow , ...

Why would I see PHP NOTICE and ERRORs when running a script as a regular user, but not as root?

As far as I can tell, there's no difference between the error reporting or message redirection between users. They both use the same PHP ini. However, when I run a script as a regular user, I get tons of NOTICES, when run as root, I get none. When starting PHP interactive mode as a regular user, I get two PHP Warnings that 'memcache' ...

Linking Post Title to Specific Page ID

I've created a form to update my websites homepage with content but I wanted to know how I could set it up so that a posts title links to a specific post ID. I'd also like to add a Read More link that directs anybody reading the blog to the correct post. Here is my PHP code: <html> <head> <title>Blog Name</title> </head> <body> <...

supplied argument is not a valid MySQL result

I have written a function: function selectWithPaging($where){ $pg = (int) (!isset($_GET["pg"]) ? 1 : $_GET["pg"]); $pg = ($pg == 0 ? 1 : $pg); $perpage = 10;//limit in each page $startpoint = ($pg * $perpage) - $perpage; $result = mysql_query("SELECT * FROM $where ORDER BY id ASC LIMIT $startpoint,$perpage"); return $result; ...

Using DateTime in PHP, generating bad unix epoch time from $foo->format('U')

I can't seem to get the correct Unix epoch time out of this PHP DateTime object. $startingDateTime = "2005/08/15 1:52:01 am"; $foo = new DateTime($startingDateTime, new DateTimeZone("America/New_York")); echo $foo->format('U'); which gives 1124085121 Which is Mon, 15 Aug 2005 00:52:01 GMT -500 (according to http://w...

Saving dynamically added text input to MySQL.

Hey all, using this method http://stackoverflow.com/questions/1501181/jquery-append-and-remove-element i'm adding text inputs to a document. i'm using this php if($_POST['cp_slider']) { $array=$_POST['cp_slider']; foreach($array as $cp_slider) { if(strlen($cp_slider)>0){ echo '<li><input type="text" name="cp_slider[]" value="'.$this->op...

Avoid multiple LEFT JOIN

Is there a way to avoid adding a second LEFT JOIN for the table "social_mcouple" to query where social_members.m_id = social_mcouple.c_id below? $res = @mysql_query("SELECT *, DATE_FORMAT(m_lld,'%m/%d/%y') AS m_lld_formatted FROM social_members LEFT JOIN social_member_types ON t_id=m_type WHERE m_user='".$en['user']."'"); ...

Make HTTP/1.1 request with PHP

My code is using file_get_contents() to make GET requests to an API endpoint. It looks like it is using HTTP/1.0 and my sysadmin says I need to use HTTP/1.1. How can I make an HTTP/1.1 request? Do I need to use curl or is there a better/easier way? Update I decided to use cURL since I am using PHP 5.1.6. I ended up forcing HTTP/1.1 by ...

How do I unpack a binary string in PHP?

How can I do this Perl code in PHP? print unpack ("H*", pack ("B*", "00000000100000012000000" )); ...

How to obtain the facebook uid of a user in php

Hey, I'm writing a canvas app for facebook. I use the command: $user_id = $facebook->require_login(); To get the userid, but at the first few pages of my app I don't want to require login, but if the user's logged in, I'd like to know what the userid is. Basically I need a get_login() command that perhaps returns 0 or null if the user...

How to send news letters in zend

i am trying to send something like news letter Via Zend_Mail but after 12 mail i got this message Fatal error: Maximum execution time of 30 seconds exceeded in C:\Program Files\Zend\Apache2\htdocs\forga\library\Zend\Mail\Protocol\Abstract.php on line 321 my Code is like: $smtpHost = 'smtp.gmail.com'; $smtpConf = array( 'aut...

Sort array by keys of another array.

Hello There are 2 arrays, both with the same length and with the same keys: $a1 = [1=>2000,65=>1354,103=>1787]; $a2 = [1=>'hello',65=>'hi',103=>'goodevening']; asort($a1); The keys of a1 and a2 are id's from a database. a1 gets sorted by value. Once sorted, how can we use the same sorting order in a2? Thanks! ...

How can I pull multiple rows from a MySQL table and use all of them automatically for the same thing?

Basically, I have multiple URL's stored in a MySQL table. I want to pull those URLs from the table and have cURL connect to all of them. Currently I've been storing the URL's in the local script, but I've added a new page that I can add and remove them from the database, and I'd like the page to reflect it appropriately. Here is what I ...

php writing array in a text file fails, why?

trying to write an array to a text file, but it is failed, can anybody say, WHY? $filename= 't12a'; for ($pnum = 1; $pnum <= 15; $pnum++){ $bbal = 3; $ipmnt = 14 * 5; $ppmnt = 26 - 7; $ebal = 48 - 4; $ccint = 54 + 45; $cpmnt = 25 + 54...

Join DELETE in MySql? How to?

I have this: $query="DELETE FROM classified, $sql_table WHERE classified.ad_id = '$id' AND classified.classified_id = $sql_table.classified_id AND classified.poster_password='$pass'"; I get this error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ...

Wordpress, PodCMS and Search

Hey guys, I have a WordPress site for a client. He owns a video store, and I made a site for him to update the list of movies, usually just the "new this week" movies. I used PodCMS as an easy way for him to upload movies and then display them. No need for him to even create posts. Works really well, it's a great extension, I'm just ha...