php

How can I make a calendar with MYSQL data?

In my database, there are some days with data and some without; I have one column with data, and another column with the date and time submitted. So I want to create this calendar. So it will show all the days in the month, and then the days with data will be a hyperlink. When I click the link, it will show all the data submitted on that...

mysql result fetching comparison using php

Which one is better to fetch data from mysql database using PHP and why? mysql_fetch_row() mysql_fetch_assoc() mysql_fetch_array() ...

my session_start doesn't work :(

i start a new session with : session_start(); then i set some session variables like this : $_SESSION['name']=$_POST['name']; and some another variables. at bottom of page i set header to diffrent page : header('location: index.php'); exit(); now in new page (index.php i can't access to my session variables, like $_SESSION['name']) what...

MySQL ifnull equivalent for php

My scenario: $exTime = get_cfg_var("session.gc_maxlifetime")?get_cfg_var("session.gc_maxlifetime"):1440; I'd like it to be like mysql: $exTime = isnull(get_cfg_var("session.gc_maxlifetime"),1440); or something like it that would also test for FALSE ideally. That way I'd only have to call the function once! I know I could just ass...

When to include helper methods in a model (MVC)?

I think the easiest way to ask this question is with the actual real-world situation I'm facing. In our system, we have a Site model (classic MVC framework here) that represents a row in our site table. One of the fields of the site table that is stored in the Site model is the time zone of the site. We use this to adjust UTC datetimes ...

how can i use captcha and audio for human validation?

I need to validate human user by using captcha in PHP. Also the critical characters generated by captcha will be pronounced by an audio voice. Is it possible? If possible then how? ...

In PHP, can you instantiate an object and call a method on the same line?

What I would like to do is something like this: $method_result = new Obj()->method(); Instead of having to do: $obj = new Obj(); $method_result = $obj->method(); The result doesn't actually matter to me in my specific case. But, is there a way to do this? ...

PHP new line problem...

simple problem baffling me... i have a function: function spitHTML() { $html = ' <div>This is my title</div>\n <div>This is a second div</div>'; return $html } echo $spitHTML(); Why is this actually spitting out the \n's? ...

PHP scope -> Javascript scope pattern?

Anyone have any clean patterns for getting php vars into the js scope? Two ways I have done it before is either injecting it with an actual call from the base template inside a document ready wrapper. (jQuery/Smarty Template) {literal} $(document).ready(function() { TargetClass.targetVar = {/literal}{$phpVar}{literal}; }); {/liter...

What is the difference between ' and " in PHP?

Possible Duplicate: PHP: different quotes? Simple question: What is the difference between ' and " in php? When should I use either? ...

Print cascading table

Hi! I'm trying to load data from database and display it in table like here: http://img196.imageshack.us/img196/1857/cijene.jpg In database i have 2 tables: cities (id, name) prices (id, city1_id, city2_id, price) For example, the printed table for 4 cities would look like this: <table> <tr> <td>city1</td> <td> </td> <td> </td> ...

Help me debug annoying error

The error I'm trying to get rid of is there is an additional letter "t" outputted before the rest of the HTML in one of my Zend Framework applications. The "t" is there only in a single action so I'm certain the problem is somewhere there. For illustration HTML markup of the buggy controller action starts like this: t<!DOCTYPE html PUB...

basic php problem I think answer will involve arrays

I want to make a conditional if statement that does this if($get_['b']=="1") { $offer1a=$offer1XXX; $offer1e=$offer1YYY; $offer2a=$offer2XXX; $offer2e=$offer2YYY; $offer3a=$offer3XXX; $offer3e=$offer3YYY; $offer4a=$offer4XXX; $offer4e=$offer4YYY; } All the way to offer #12. It seems like a lot to write out. There are other valu...

Session variables not persistent in IE6 Don't know what else to do

My case is very simple, but I've read through many posts and tried the suggestions but can't seem to figure this one out.... session's variables are not passed to the next page in IE6. Every page refresh creates a new session_id(). I'm using wamp/IE6, no software blocking cookies, and the privacy setting is set to Medium... I know i ca...

Is there a free/open-source equivalent of mailing list managers such as MailChimp or ConstantContact, etc..?

Hi, MailChimp is a very nicely done service, where they tell you things like %clicked, and Google Analytics of recent email campaigns. They are similar to other sites like ConstantContact and CampaignMonitor, and many many others. Is there anything similar to MailChimp which is open-source or free? Or is there anything that could be ...

dompdf/PHP is not streaming the PDF, just showing the code in page

I have a little problem with dompdf, Instead of generating the PDF, the screen just shows the following code: %PDF-1.6 %���� 1 0 obj [/PDF/ImageB/ImageC/ImageI/Text] endobj 4 0 obj <> stream x����r�0��<���nH"�\�4�&ul:�Ǥ�cB��L��.� ~��!�踶,4�����92#���{�&'\� e����q���/� ���+^�N����*�}qW��o�$��8!��Z�4%���A6?��i��Rj��i��S�pp��4� �o�gU�,H���...

MySQL query sets field to 0 instead of blank string

This one's puzzling me. I have a MySQL query, being run though PDO: $stmt = $db->prepare( "UPDATE member SET acode='' AND status='active' WHERE username=:u" ); $stmt->bindValue( ':u', $member->username, PDO::PARAM_STR ); $stmt->execute(); The acode field gets set to 0 for some reason. It was created with `acode` varchar(8) NOT NULL ...

Gallery 2 htaccess deleted while permalink and rewrite plugins active!

I deleted my htaccess file from my gallery2, problem is I have the permalink and rewrite plugins running, now I can't get inside my admin panel to retrive the htaccess code. Can somebody help? ...

Automatically align and resize 3 images into a small image with PHP?

I don't know if this is even possible with PHP, but I figured if it is, someone here will know how. I'm currently working on a project where users can customize a full body main avatar to be used throughout the site. There are a bunch of different face, hair, etc transparent png images that can be selected to make their custom avatar. ...

how do i compare 2 html pages, and output only the different bits in ruby or PHP ?

how can i get 2 pages, and output the difference between those. getting the pages not a problem, but stuck on how to get the difference....i need a library for ruby OR php thank you. ...