php

php file... how to spread my code around

hi, i am writing a web site with a php on the server side. which i have never used before. if i get it right it is procedural programming (which is another thing that i have never done) my question is how to write code: each procedure should be in a different file? to separate it to various files? maybe have one file that receive the...

ARC SPARQL Endpoint - Get results in json

Hi, can anyone help me to figure out how to get query results back in json or xml etc when using the Arc sparql endpoint? I am using the following code to get the result of my query: $endPoint->handleQueryRequest($query); $result = $endPoint->getResult(); I have looked through the code and tried passing some paramaters - trial and...

What are the differences between ADOdb and PDO in PHP?

Both seem to try making it simpler using a database in PHP. Both seem to provide an abstraction over different database types like MySQL, SQLite, etc. What are the differences between both ADOdb and PDO? ...

Are there good Tutorials on how to use PDO?

Maybe someone did a tutorial that shows the important thing: Setting everything up and using it with MySQL? ...

Zend Cache Howto PHP

How can i do the followin tasks public function addToCache($id,$items) { // in zend cache } public function getFromCache($id) { // in zend cache } The first method should take an id and items which should be cached. The second method should just take an id of an cached object, and should return the content of the cache of that it...

Drupal: PHP field for allowed values

I'm working in Drupal 6 with CCK. Under each text field there is a PHP section where you can run some PHP code to get allowed values. I'm running into trouble using an "if" statement to change the allowed values based on user type So to start, I do a query to determine current users user type. -1 is default user, which is employees and ...

Do I need an ORM for simple related queries in PHP/CI?

I started my app very simply following the documentation videos for Codeigniter. I have the following tables: Account account_id name details Contact contact_id account_id name address Order order_id account_id contact_id date description Item item_id order_id description ...

CURL: Code 0 from proxy after CONNECT?

Hello all, I am trying to test the below function but every time I try to use any sort of proxy IP (I have tried about 15 now) - I generally get the same error: Received HTTP code 0 from proxy after CONNECT Here is the function, anything wrong with it? It could just be the proxies I am using but I have tried several times now. funct...

PHP-ILooping an arrays values through a larger array

I want to know if it is possible to take an array and insert the array's values into a bigger array, multiple times, so that the values of the smaller array fill up the bigger array. Say array1 has values ([0 => 'a'],[1 => 'b'],[2 => 'c']), and array2 can hold 8 values. So, how would I take the values of array1 and insert them into arr...

Can I predict how large my Zend Framework index will be? (and some quick Q:s)

I have around 100thousand rows in a mysql table, where each row has about 8 fields. I have finally got the hold on how to use Zend Lucene to index and search data from a mysql table. Before I fully implement this funcionality to my website, I have some questions: 1- Is it possible to determine the size of a index in advance? This beca...

Read If-Modified-Since header in PHP CGI

My PHP script depends on being able to read the value of the If-Modified-Since header (yes, I know how to do this). It worked correctly when I used PHP as mod_php, but now that I've switched to suPHP (CGI), it appears Apache itself handles requests that contain this header, without forwarding them to PHP at all. This is silly, because...

Creating Subdomains Programmatically

I am looking for a solution to create subdomains pragmatically in ASP.NET, ASP.NET MVC and PHP. Specifically, a user profile page should resolve for both: www.domain.com/profilename or http://profilename.domain.com. ...

What is Facebook's new OAuth Wrap Framework? Should I worry about it if I am using OAuth?

I have just implemented OAuth as a signup mechanism complementing the standard signup we have. Recently, Facebook seems to have started using OAuth WRAP. What is new in OAuth WRAP? What are the pros and cons and is it supported widely? ...

Parsing JSON like data interchange format

I'd like to use a data interchange format that uses no quotation marks. Maybe something based on JSON: {param:value,param:value,param:{[{param:value,param:value}, {param:value,param:value}]}} How should I go about parsing something like that in let's say PHP. Should do it through regular expressions? ...

efficient creation of json from mysql output - grouping within uniques

I believe I have been writing some inefficient code here, but can't seem to figure out a more efficient way of writting it. This often happens with json output, though I've had the issue with some html or xml output as well. I run a query in my database which brings back an array. Say a persons favorite foods. php's mysql_fetch_assoc...

What's a good piece of LAMP-stack source code for a simple blog w/ comments?

Hello I want to create a simple blog where users can post comments, but I don't really want to get into one of the heavier code generators or frameworks like Django or RoR or Wordpress. Reason is I need to learn this stuff from the inside out, given that my project will require a lot of programming "from basics" in the future (since it'l...

Very basic HTML/scripting/active page question

Hi, A friend has asked me for help with her website design. Although I know a fair amount about the basics behind HTML, XML, Php, ASP.Net, javascript, etc., I'm not really comfortable sitting down and coding from scratch. All of the work I do is in Java, C++, and so on. My friend would like to add a vertically scrolling marquee to her ...

What is the lightest and most efficient way to embed images in php mail?

I am trying to imbed an image in my php emails and use as a signature. Meaning at the end of the email I want to have an image. I have tried many different combinations and for the most part am not getting the image to appear. Are there size restrictions for images or am I just doing in a way that is making it to heavy? A few things I ha...

Find all files with Blank or WS at BOF or EOF.

So, everyone knows PHP hates blank lines at the end or beginning of a file (before or after the PHP tags). I've got an awk script that will modify the files. I pass all my files through it and things are peachy, no more leading or trailing blank lines. I'd like to FIND the files first, to build a quick exception report. I tried someth...

How many php-cgi processes should I run?

I am asking about a web server running a light front (nginx in my case), with PHP processes accessed through fastcgi. I am trying to figure out a way to methodically calculate how many PHP cgi processes should be running in the machine. One way to think of it is figure out the average memory footprint of a process, and run as many as ...