php

How to validate non empty string in xml content using XML Schema in php

Source XSD:------------- <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xsd:element name="labor_invoice" type="labor_invoice_type"/> <xsd:element name="parts_invoice" type="parts_invoice_type"/> <xsd:complexType name="labor_invoice_type"> ...

Define "Validation in the Model"

There have been a couple of discussions regarding the location of user input validation: http://stackoverflow.com/questions/659950/should-validation-be-done-in-form-objects-or-the-model http://stackoverflow.com/questions/134388/where-do-you-do-your-validation-model-controller-or-view These discussions were quite old, so I wanted to as...

Retrieve subcategory ids as an array

I have three columns in my category table: ID, name and parent_id. If the category is parent there is 0 under the parent_id, if it's not parent category id is recorded instead. I would like to get all subcategory ids with one parent category id as an array. How is that possible using php? Can anyone please help? Thanks in advance ...

JavaScript: If clause partially executed

Hi everyone My problem is that when the condition is true it will close the window but not execute the php part ! here goes my code.. <script type="text/javascript"> function onClose() { var r=confirm("Is the meeting Over!"); if (r==true) { <?php $result=mysql_query($sql);?> window.close(); } else { <?php $res...

PHP OOP: Method Chaining

I have the following code, <?php class Templater { static $params = array(); public static function assign($name, $value) { self::$params[] = array($name => $value); } public static function draw() { self::$params; } } $test = Templater::assign('key', 'value'); $test = Templater::draw();...

Exploring search options for PHP

I have innoDB table using numerous foreign keys, but we just want to look up some basic info out of it. I've done some research but still lost. How can I tell if my host has Sphinx installed already? I don't see it as an option for table storage method (i.e. innodb, myisam). Zend_Search_Lucene, responsive enough for AJAX function...

Using PHP, how to parse the title and meta tags from a HTML page?

Hey guys, I need to be able to get the TITLE and DESCIPTION metadata out of a page. I've been trying to do this but I've been getting more errors than actual results. (I have an array of about 10 URLS, usually only about 2 of them give me the descrption. I have yet to get the title). So how do I, in PHP, get the Desc and Title from a ...

How do I return the numeric value from a database query in PHP?

Hello, I am looking to retreive a numerical value from the database function adminLevel() { $q = "SELECT userlevel FROM ".TBL_USERS." WHERE id = '$_SESSION[id]'"; return mysql_query($q, $this->connection); } This is the SQL. I then wrote the following php/html: <?php $q = $database->adminLevel(); if ($q > 7) {...

how to get a page owner feeds by facebook graph API

hello i'm trying to get a facebook page feeds using graph URL. but i want to get only the owner data ... i don't want anything not from the owner. i can do that using PHP. but i'm asking if i can do that using the same graph request. Thanks ...

Add items from one array to another

I have two arrays: 1) The first array: array( [0] => array( [code] => code_1 [value] => xxx [1] => array( [code] => code_2 [value] => xxx [2] => array( [code] => code_3 [value] => xxx 2) The second array: array( [0] => arr...

How To Call Javascript In Ajax Response? IE: Close a form div upon success...

I have a form that when you submit it, it sends the data for validation to another php script via ajax. Validation errors are echo'd back in a div in my form. A success message also is returned if validation passes. The problem is that the form is still displayed after submit and successful validation. I want to hid the div after suc...

How to hide controller name in the url in CodeIgniter?

Hi, so the thing is I'm using .htaccess to hide the index.php but I still get the controller name in the url like that: http://example.com/name_controller/about My question is: is it possible to hide the name of the controller, so that only method is shown? hxxp://example.com/name_controller/about ...

"Connection: Keep-Alive" in server response

Hi, I'm trying to establish a HTTP persistent connection from a Silverlight application to a PHP page (ie without creating a new TCP connection for each HTTP request) hosted by an Apache server. To this end, I need the webserver to send its HTTP responses with the "Connection" header set to "Keep-alive". Client-side, there doesn't seem...

Little mod_rewrite problem

I have a classifieds website. Each classified is linked like this originally: mydomain.com/ad.php?ad_id=Bmw_M3_M_tech_113620829 What RewriteRule should I use to make this link look like: mydomain.com/Bmw_M3_M_tech_113620829 Also, what do I need to add to my .htaccess file? This is what I have so far: Options +FollowSymLinks ...

Admin section in CakePHP

I'm having a hard time understanding how the CakePHP admin system works. Should all controllers who has an action which requires login include AuthComponent or just the one who handles the login/logout? Let's say I want to protect the add action of a controller. First I create admin_add() in the controller and then in the beforeFilter(...

PHP download script for "processes running limited" hosting (eg. hostgator)

I am currently with HostGator on a shared hosting plan. I have a new website I'm trying to setup with a download.php script. The issue I am having is that, while someone is "downloading" a file through the download.php script, it counts as a "process" and my hosting plan limits the processes that can be running at the same time to 25 at ...

Procedure in converting int to decimal data type?

I have an int(11) column which is used to store money. I read some of the answers on SO and it seems I just need to update it to be a decimal (19,4) data type. Are there any gotchas I should know about before I actually do the converting? My application is in PHP/Zend and I'm not using an ORM so I doubt I would need to update any sort o...

Birds on the trees in the background

How do these birds pop up behind the trees on the bottom? http://grabaperch.com/about Are they using css with php or what is it? ...

call_user_func_array problems

I have a class with this in self::$DB = new PDO("mysql:dbname=$dbname;host:=127.0.0.1" , 'root' , ''); and then this public static function __callStatic($name, $arguments) { return call_user_func_array(array('self::$DB', $name), $arguments); } How does I make it right/work? ...

PHP: Accessing namespaced XML with SimpleXML

http://pastebin.com/nN8G78AH I'm using simplexml() function to parse through RSS feed, while i can access $var->title to < title> how do I access < dcterms:issued> ...