php

Multiple count values on one column

Hi All, I want to query my database and get counts of the occurences of each id in a single column. The two tables related to this query are: categories: this table has a list of all categories with titles id | title ---------- 1 | project 2 | tech 3 | other category_news: this table is used to assign news items to categories, ea...

Sql: Unique field contraint (slug) across multiple tables (doctrine/symfony)

I have a number of tables that will be looked up using the url 'slug'. For example 'news' and 'blog' both have the 'slug' field, which is defined as a unique field in the doctrine database schema. Is there any way I can extend this uniqueness across both tables: for example if there is a news article with slug= "good-story" then it will...

PHP Objects Overwriting problem

Hello everybody, here's my problem: $Me[1] = new User(1); $Me[2] = new User(2); $Me[3] = new User(19); $Me[4] = new User(75); $Me[5] = new User(100); foreach ($Me as $k) echo $k->getId(); I'm trying to create 5 users with, of course, different ID. The problem is that the User with ID 2 'overwrite' the User with ID 1, the User with ID ...

problem with Create File dynamically in php

Hi .. I want to create File that have Full permission dynamically, that means every change for ID of session create new file . Unfortunately I faced some problem . Warning: fopen(test.txt) [function.fopen]: failed to open stream: Permission denied in /home/teamroom/public_html/1/3.php on line 2 Warning: fwrite(): supplied argument is...

Can I get the IP address for a FTP upload at the server?

I provide a public FTP account for people to upload files into a temporary folder. An AJAX interface shows fresh files, then users can tag and move the file into a different folder. I would like to show every user just the files they uploaded themselves, not all the other ones that might be uploaded at the same time by other people. Ind...

Codeigniter - multiple file upload ->insert into db - having problems!

Hi, I am using Codeigniter and I am trying to upload multiple files into a database. The files are seperate fields not multiple files for one field. I followed this post -http://codeigniter.com/forums/viewthread/110130/P0/ I almost have it working but I am having some trouble with adding the uploaded data into my db. Here is my Contr...

How can I call another site?

Hi How can I open another site from PHP in the Background? I try to use the bit.ly API. Thank you ...

GPL sources include in commercial PHP web-service application

We've got a dispute with one of my friends. He maintains a commercial public web-service that is written in PHP with closed sources. He claims that he may use any GPL library written in PHP just like any code he had written, without any obligations, attributions or opening code as long as GPL notice in file is intact. My opinion is that...

Facebook offline access. Updating status via cron job?

My users have allowed offline access. I have the infinite access token, but can't figure out how to update the status from a cron job. Any ideas? ...

prevent automatic add slashes while using parse_str

hi, my hosting server has magic_quotes on . so when i use parse_str, it also add slashes to it. so data gets stored as \\'name .. how do i prevent this.? ...

Array manipulation to create a dropdown box cakephp

hi, this is my problem i,ve to create a dropdown list box from a table states('id','state_name') which is not my default model( which has many fields one of the field is 'state' in which i store states('id') . so i used loadModel to populate the drop down box. in my controller i used $this->loadModel('State'); $this->set('states',$this-...

UK postcodes -> co-ordinates : possible purely in php?

Say have a mysql database with these cols: | house | postcode | lat | lon | The postcode's are complete but lat and lon are empty. I want to write/find a script that i can run once to complete the table. Is this possible purely in php (any tips?) or do i need to use a javascript api and $_POST to a php file? ...

Why is calling a function (such as strlen, count etc) on a referenced value so slow?

I've just found something very strange in PHP. If I pass in a variable to a function by reference, and then call a function on it, it's incredibly slow. If you loop over the inner function call and the variable is large it can be many orders of magnitude slower than if the variable is passed by value. Example: <?php function TestCoun...

A problem with using Smarty & Mysql & Jquery

Hi all .. I have a problem in using Samrtm Mysql and Jquery or Ajax and if I use a div auto reloader it shows a php error .. these are my files: accept.html (Template) {literal} <script type="text/javascript"> var auto_refresh = setInterval( function () { $('#invite').load('accept.php').fadeIn("slow"); }, 1000); </script> {/literal} <d...

php related error in linux terminal while setting up symfony framework

Hi i am trying to setup a new symfony framework project on ubuntu by following the documentation. But all the commands mentioned in the docs starting with 'php' give out the following error. The program 'php' is currently not installed. You can install it by typing: sudo apt-get install php5-cli bash: php: command not found. But php...

php-codeigniter - HTMLENTITIES in displaying value of textbox

Through out my application, i wanted to display the value htmlentities(str), since there is not restriction for single or double or any special char. Instead of using or converting by htmlentities(str),like <input id="text" name="text" value="<?php if(isset($_POST['text'])) { echo htmlentities($_POST['text']); } ?> Is there any way ...

jQuery $.each and $.data

Hi, i have a script that calls a php file and gets an JSON object from it. I'm tring to get the ids from the object attached to a specific element that is created by iterating with $.each the json object. Here is what i have done so far: $(document).ready(function() { $("#div2").hide('slow'); $("#div1").empty().html('<img src="a...

Writing a file with UTF8 encoding in PHP

I am writing a function to dynamically generate my sitemap and sitemap index. According to the docs on sitemap.org, the file should be encoded in UTF-8. My function for writing the file is a rather simplistic one, something along the lines of: function generateFile() { $xml = create_xml(); $fp = @fopen('sitemap', 'w'); fwrite($f...

File Limit on Shared LAMP

Hello all, I have a web site on Shared Hosted Server. They have a hard limit of 50,000 files. I have a while to go yet, but my site allows Image (jpg), file uploads, does anyone know any special tricks to help me get some of my file count back by storing multi image files in one file. Most of the image files are under about 300k, but...

Call to undefined method Facebook::setUser()

Anyone know if there is a new way in the new API to set the user? I'm getting the error, Call to undefined method Facebook::setUser(). I cant find anything on Google. ...