php

encodeURIComponent is really useful?

Something I still don't understand when perfoming an http-get request to the server is what the advantage is in using JS fucntion encodeURIcomponent to encode each component of the http-get. Doing some tests I saw the server (using PHP) gets the values of the http-get request properly also if I don't use encodeURIcomponent!!! Obviuosly...

Good practice when using php includes on headers, navigation and other elements?

I don't know how those elements are usually separated by professional web designers: like this: <?php include("head.php"); ?> <?php include("lang.php"); ?> <?php include("nav.php"); ?> or just like this <?php include("head.php"); ?> <?php include("header.php"); ?> or just placing all the elements that I want to repeat together: <...

how can I modify this script to add instead of incrementing

<?php $aDoor = $_POST['formDoor']; if(empty($aDoor)) { echo("You didn't select any buildings."); } else { $N = count($aDoor); echo("You selected $N door(s): "); for($i=0; $i < $N; $i++) { echo($aDoor[$i] . " "); } } ?> The script above will increment and then echo the extracted values of ...

inserting record mysql

Hello all! I have a method which insert a record into a table as shown below: public static function AddCategory($categoryName) { $sql = 'INSERT INTO category(name) VALUES(' . $category_name .')'; $parameters = array('category_name' => $categoryName); return DB::Execute($sql,$parameters); ...

nested foreach loops with a many to many relationship

I have two tables (groups and parties) in a many to many relationship using a lookup table called groupparty. I'd like to be able to assign prices to each party, such that a party that belongs to two groups might have one price in one group and a different price in another group. In the table groupparty, I have three columns: groupid, p...

Read foxpro DB using php/Java

I am looking for a code snippet/library to read data from third party foxpro DB over the Net using php/Java from a Linux server. Is there any library available? Some people seem to be using Dbase library for php? Does that work? What parameters do i need from the Foxpro DB other than the default (databasename, username, password). DBF ...

Apache/PHP processes hanging while interacting with MySQL

Hi all, We're seeing some strange behaviour and we're not sure if it's a problem with apache, php, mysql or the OS, so over to the big brains of stackoverflow! We have Apache and mod_php talking to a mysql5 server. Sometimes, a process will choose to hang, trying to read from a file descriptor. Firing up strace one on of them (all han...

php mailing list - considerations and potential pitfalls?

hi folks, my client needs a mailing list in their site. the idea is that users can subscribe to get newsletters or announcements. i expect the list to contains hundreds of users, not tens of thousands. i have not done this before (only single messages like "thank you for registering") my initial idea was sending each message to all user...

Check if PHP varible is contained in SQL field

Hi, Is the following possible? field in DB contains: 1,2,3,4 $a=1; $selqry="select * from table where field={contains $a}"; Thanks, B. ...

porting this php code to c#

I'm having trouble porting this code below to c#. my main trouble is with the $fb_activity_array. $fb_activity_message = '{*actor*} played this game'; $fb_activity_array = json_encode(array('message' => $fb_activity_message, 'action_link' => array('text' => 'Play Now','href' => 'http://yoururltoplaygamegere'))...

How to get the correct results calculating two unix timestamps

I know this has been asked several times before but I can't seem to find the right answer. I want to calculate the difference between two unix timestamps and show this difference in days. I'm not concerned about minutes or seconds here. $time = 172800 - time() + 1265010604; echo floor($time/86400); Where 1265010604 is the timestamp f...

How to download part of a file via FTP in PHP?

I would like to download parts of files on a FTP server. I've got this solution: $opts = array('ftp'=>array('overwrite'=>false, 'resume_pos'=> 5*16+12)); $context = stream_context_create($opts); $version = file_get_contents ( 'ftp://'.$ftpAccount["username"].':'.$ftpAccount["password"].'@'.$ftpAccount["server"].'/...

[PHP] fgetcsv() ignores special characters when they are at the beginning of line!

I have a simple script that accepts a CSV file and reads every row into an array. I then cycle through each column of the first row (in my case it holds the questions of a survey) and I print them out. The survey is in french and whenever the first character of a question is a special character (é,ê,ç, etc) fgetcsv simply omits it. Spec...

How do I retrieve the user information of a user authenticated with Apache's mod_ldap?

I have LDAP authentication working with Apache. Now I need to know how I can get what user logged in with PHP. Is it even possible? Do I have to do the authentication in PHP to store the user name? ...

create personal MySQL Database

What's a good way to approaching this? I would like to create a local database, just on my laptop (for now), so that I can teach myself some PHP and how to interact with databases. ... preferably a free approach... Thanks, Hristo ...

What property inside the form can I use to assign this index string ['size']value as a value of the property?

I have this database field that used as the form input value '. $variety['price']. ' I also have a '. $variety['size']. ' database field that carry the name of the product but I don't know what another form input property to use to assign this size database field as a value to the input form property? I feel like I have run out of prop...

unable to push feed into publish_stream

i have a php based fb app. everything is running fine, but I am unable to publish stories into the user's feed. i am attaching some code for better understanding... EDIT: The problem is I am unable to show any fbml/xfbml dialog. I can retrieve information from facebook but the fbml/xfbml just doesnt show up. Even the profile pic is not ...

PHP - how to access this data structure?

Hi, This is a newbie question - how do I access the value0, value1, ... entities? object(SimpleXMLElement)#43 (2) { ["@attributes"]=> array(3) { ["ABC"]=> string(1) "1" ["DEF"]=> string(14) "recordXYZ" ["GHI"]=> string(1...

Singular/Recurring Schedules in my CMS

I'm building a CMS that has a requirement to allow users to store schedules. The interface is similar to MS Outlook, so the recurring schedules pretty much needs to mimic what that UI can support. When the schedule is saved, we need to somehow be alerted when an event is supposed to happen. Right now, the plan is to have a cron job run ...

Applying utf8_encode to ob_end_flush()

I have a script which produces text output. That script grabs content from a MySQL database encoded as latin1_general_ci. Including that script in a HTML page marked as iso-8859-1 works fine. How do I capture the output of this script and include it in a HTML page encoded in utf-8? I have attempted to capture the output of the script u...