php

Php index page utitlizing an idea for a superswitch...

I dont know if this is a great idea...or a crap one. But I was thinking I may use one page to display all my pages using includes. Here is what my index.php would look like...on the functions include there is a function called "superSwitch" which will determine what requested page will be included....for instance if I do a get ?a=a i...

simple ways to create rdf/xml using php?

what's the best/simplest/easiest way to create rdf/xml with php? ideally i would like to use simpleXML - but i believe it doesn't support namespaces? failing that maybe simpleDOM? id rather not use DOM since it tends to confuse me a lot! perhaps there is some other way? thanks for your help! :) nb: i tried to post an example but co...

How can we make a single dimension array to multidimensional Hierarchical ?

I have an single array of Hierarchical categories. Index of the array is the category_id like:: [8846] => Array ( [category_id] => 8846 [title] => Tsting two [description] => Tsting two [subtype] => categories [type] => object [level] => 2 [parent_category] => 8841 [tag...

Creating a mobile version for my web app in CodeIgniter

Hi there, I'm using CodeIgniter to develop a new web app, and I'd like to create a mobile version that users get redirect to when they visit it from their phones. The mobile version of the app should have a different flow, so swapping CSS/HTML files in the code is not an option for me since the mobile version and the web version will h...

Why does mysqli.fetch_field_direct() return different results when working with db views under LINUX/WIN?

I created a Database View in Mysql. I select the view via php's mysqli extension and extract the meta column infos using the fetch_field_direct method. Under linux it shows in field orgtable the name of its real table. Under windows only the view name is shown. Why this? Is it a bug? Does someone has a alternative solution? ...

PHP Code Problem...

function check_login($array_val) { $strQury = "Select * from tblsignup where usr_email ='".$array_val[0]."' and usr_password = '".$array_val[1]."'" ; $result = mysql_query($strQury); $row_user = mysql_fetch_array($result); if(mysql_num_rows($result)>0) { $msg = "true"; } else { $msg ...

How to get parameters from the URL to the model in cakePHP?

hi there, let's say i have: http://some-domain/application/controller/action/parameter This is somehow working in cakePHP. Now I want to now what exactly 'parameter' is. But inside the Model. How to get to this information? I have to say that there is a formular including a 'Next' Button and I want to validate the input inside of th...

Find out the post data size in byte.

When I submits the form in php. I want to find the size of the data for each text box that are posted through javascript in bytes. ...

Which cms or script for social network wiki?

Hi, I am building a social network. I need a cms that will allow users to contribute content. Each content item will need to have a google map, list of features, ratings, comments, etc. And the content must be editable by other users with revision control. Also, each user should have a profile with their bookmarked content items, contri...

PHP mutual exclusion (mutex)

Read some texts about locking in PHP. They all, mainly, direct to http://php.net/manual/en/function.flock.php . This page talks about opening a file on the hard-disk!! Is it really so? I mean, this makes locking really expensive - it means each time I want to lock I'll have to access the hard-disk )= Can anymore comfort me with a deli...

how to delete memcached data with "filter" keys ?

Hi, I just want to delete cached data, but I have many keys, for example: user_54_books user_54_movies user_54_comments user_54_foobar I can write $cache->delete('user_54_books'); but I have to do it with all "user_ID_objects", can I say to memcache, something like delete->('user_54_*'); ? how? thanks :) ...

how to change picture using drop down list ?

Hello, I want to use a drop down list, every time i click the content in it, different pictures will show up. But i don't want to use the property 'value', because i want to use the values for other use. Example: <select name='test'> <option value='1'>1</option> <option value='2'>2</option> <option value='3'>3</option> <option value...

[Magento] Add new Action to invoice's ActionList

Hi, I need to add a new action to the ActionList in the Invoices page I don't know where magento creates this list and how it call the selected action, so I thought you guys would know where I should start looking... Thanks! Jonathan ...

Handling apostrophes, php and pgsql

For my forms, I'm using pg_escape_string on every field before I insert them into the database. So I get something like firstname='O''reilly'. But when I try to print that out, I get O''reily, 2 apostrophes. Shouldn't it only 1 apostrophe, O'reilly? This isnt a debugging problem, im just wondering if you have firstname='O''reilly', how ...

PHP return(value); vs return value;

Is there any difference between return($var); and return $var; other then wrapping it in parentheses? ...

Why doesn't PHP's oci_connect return false?

I have a situation in which we have two production databases that synchronize with one other. Server One is considered the primary. Sometimes due to maintenance or a disaster Server Two will become primary. In some of our code that means we have to manually go in and edit the server name for database connections. I find this annoyi...

redirect into silverstripe's pages

Hi all, i'm trying to get a redirect in my silverstripe site: i created my own module, and now i want that, after login, the user will be redirect to that. I've tried with Director::redirect($Url_base. 'myModule'), but it doesn't works. Anyone of u got suggestions? Thanks Ed ...

problem in running complex multiple table mysql query

hey guys i need to show pages'details , now i used this query to fetch from 3 tables group_concat( ) its working fine but shows array of tags and topics duplicated. ...

[PHP] Which method of variable setting is better?

So just to better myself I'm wondering which method is better for setting a variable: Code: http://pastie.org/private/jkw9dxplv0ixovvc0omq Method 1: Set the end variable in the if statement -OR- Method 2: Set a default variable and only change it's value if needed. I hope this makes sense. Thank in advance! ...

Using PHP to get the source code of a URL I must be logged in to reach

I am trying to write a PHP script that will get the source code of a page in my Amazon account. However, to reach that page, I must be logged in. From what I understand, I should be able to accomplish this by posting the correct request headers, and then capturing the HTML response. Is that correct? If so, I'd really appreciate it if som...