I am having some problems parsing this piece of XML using SimpleXML. There is always only one Series element, and a variable number of Episode elements beneath. I want to parse XML so I can store the Series data in one table, and all the Episode data in another table.
XML:
<Data>
<Series>
<id>80348</id>
<Genre>|Acti...
I have a query
public static function TestQuery(
$start=0,
$limit=0){
$sql = "
SELECT count(*) AS total
FROM db.table1
JOIN db.table2
ON table1.fieldID = {$fieldID}
AND table2.assigned = 'N'";
$qry = new SQLQuery;
$qry->query($sql);
if($row = $qry->fetchRow()){
$total = intval($row->total);
}
ret...
Hi there,
So basically what I'm working with is a database full of phone numbers.
if I get one of those users from that phone database and they sign up to my website I want to automatically associate the number from the database that is already present, how would I go about linking those 2 tables together once a user signs up?
-Aaron
...
I have an array being returned from the database that looks like so:
$data = array(201 => array('description' => blah, 'hours' => 0),
222 => array('description' => feh, 'hours' => 0);
In the next bit of code, I'm using a foreach and checking the for the key in another table. If the next query returns data, I want to upd...
I have a form being AJAX'd in by jQuery on a page with multiple forms. I'm performing the following function, which is a wrapper for the $.ajax function:
function do_json_get(uri){
var ret = '';
var url = AJAX_URL + uri;
$.ajax({
type: 'GET',
url: url,
async: false,
success: function(data) {...
As far as I can tell, there's no difference between the error reporting or message redirection between users. They both use the same PHP ini.
However, when I run a script as a regular user, I get tons of NOTICES, when run as root, I get none. When starting PHP interactive mode as a regular user, I get two PHP Warnings that 'memcache' ...
//this is intializer.php
defined('DS')? null :define('DS',DIRECTORY_SEPARATOR);
defined('SITE_ROOT')? null :
define('SITE_ROOT',DS.'C:',DS.'wamp',DS.'www',DS.'photo_gallery');
defined('LIB_PATH')?null:define('LIB_PATH',SITE_ROOT.DS.'includes');
require_once(LIB_PATH.DS.'datainfo.php');
require_once(LIB_PATH.DS.'function.php...
i used javascript and php script as mixed. i got a parse error
this is the code
<script language="JavaScript1.1">
var photos=new Array()
var which=0
<? for($i=0;$i< count($productdata2);$i++)
{
foreach($productdata2 as $row)
{?>
// the error occured at this line
photos[0]=<?=base_url().'uploads/'.$productdata2[$i]->image;?...
Hi,
I am trying to convert a flat array to a nested array depending on the 'level' data of each array item. 'level' data shows us if current array item is a child, a parent or a sibling.
Here is the flat array:
$flatArray = array(
array('title'=>'Page 1', 'level'=>0),
array('title'=>'Page 2', 'level'=>0),
array('title'=>'P...
how do I get all the records for latest date. The date filed in my db is called recordEntryDate and it is in this form 2010-01-26 13:28:35
Lang: php
DB: mysql
...
The IETF recommends to use base64 encoding for binary cookie values.
http://tools.ietf.org/html/draft-ietf-httpstate-cookie-07
So I use setrawcookie(..) but I don't know what variable to use to get the cookie back because $_COOKIE[..] still uses the URL decoding that matches setcookie(..). This replaces "+" with " " in the output.
<?ph...
All,
I have the following array in array format. The JSON format is shown just for user-friendliness. How can I sort the array ascending with the key "name" in php?
"food":
[
{
"id": 1,
"name": "dessert"
},
{
...
domain.com/hello/world/
How do I only get the /hello/world/ part?
Update: How could I get domain.com/hello/world?
...
I've decided that using a PHP proxy for AJAX calls for a project is the best way to go - but I have a question regarding passing POST data through the proxy. As in - how to do it.
Should I need to create a single variable in the javascript using alternate characters, then have the PHP proxy parse and modify the variable to reassemble...
Hello.I am trying to use ckeditor for image uploading.But it does not have Browse facility for uploading image.In the URL textfield,If i give hard-coded path,image can be uploaded.But this is not best practice to give hard-coded path.Can anyone help me with this to achieve Browse facility?Thank You in advance.Please please help me.
...
My code is as follows:
<?php
include("config.php");
$ip=$_SERVER['REMOTE_ADDR'];
if($_POST['id'])
{
$id=$_POST['id'];
$id = mysql_escape_String($id);
$ip_sql=mysql_query("select ip_add from Voting_IP where mes_id_fk='$id' and ip_add='$ip'");
$count=mysql_num_rows($ip_sql);
if($count==0)
{
$sql = "upd...
Is it possible to package PHPUnit tests as a PHAR archive, and run them using phpunit?
I've created a .phar with the follow script:
<?php
$cPhar = new Phar('mytests-archive.phar', 0);
$cPhar->addFile('mytest.php');
$sStub = <<<ENDSTUB
#! /usr/bin/php
<?php
Phar::mapPhar('mytest-archive.phar');
require 'phar://mytests-archive.phar/myte...
Hi everyone,
I recently migrated to PHP 5.3.2, and realized that I am unable to turn off notice errors in my site now. I went to php.ini, and in these lines:
; Common Values:
; E_ALL & ~E_NOTICE (Show all errors, except for notices and coding standards warnings.)
; E_ALL & ~E_NOTICE | E_STRICT (Show all errors, except for notices...
I have a list of file names(I already have the filelist let's say in a text file). I want to process this list in the following way:
filenames of type /dirX/subdirX//.ext will be written in a new file
all the other filenames will be written in a separate file.
Is there any option to verify if a filename corresponds to a mask, without...
I have two classes that work seperate from another, but they extend the same class. Is it possible to have them work the same instance of the extended class. I'm wanting the constructor of the extended class to run only once.
I know this isn't right but something like this:
<?php
$oApp = new app;
class a extends $oApp {}
class b extend...