Ok here's my dilemma. I am looking for a way to consolidate the data in a group using SimpleXML in PHP. Here's what I mean.
Let's say I have an xml that looks like this:
<favorites>
<interesting>
<type>Movie</type>
<character>James Bond</character>
<name>Casino Royale</name>
</interesting>
<interes...
I'm trying to wrap my brain about how to do this. We need to provide some files within a directory from our servers to our clients' servers via a PHP/Web interface using FTP. I've looked at the FTP capabilities built in to PHP and some custom classes, but someone suggested cURL might be a better option. We will have the FTP login credent...
I've been wrestling with an issue I was hoping to solve with regex.
Let's say I have a string that can contain any alphanumeric with the possibility of a substring within being surrounded by square brackets. These substrings could appear anywhere in the string like this. There can also be any number of bracket-ed substrings.
Examples...
word 1
word 2
word 3
word 4
And so on... How can I turn that into a php array, here will be a lot of items so I don't want to write them all out into an array manually and I know there has to be a simple way
I mean do I have to do
<?PHP
$items = array();
$items['word 1'];
$items['word 2'];
$items['word 3'];
$items['word 4'];
?>
UP...
$items = "word1 word2 word3 word4";
$items = explode(" ", $items);
$items is my array, how can I have it turn into this
Like how can I make word1 be a key and a value?
"word1" => "word1"
...
I'm working on a PHP project and am looking for a good authorize.net gateway. I want something with mature code that's tested. The goal is to avoid writing and testing the entire thing myself based on the authorize.net api docs.
Does anyone know of any good PHP libraries for this? I've search Google to no avail.
...
Say I have an array like this:
<?php
$colors=array();
$colors[0]['id']=1;
$colors[0]['color']='blue';
$colors[1]['id']=2;
$colors[1]['color']='green';
......
?>
What's the easiest way to have the entire array converted to XML?
...
Hey guys, I am not very familiar with jquery & am trying to implement jCrop + upload via PHP. I found exactly what I needed ( http://webdevcodex.com/mashup-application-image-uploader-cropper-using-jquery-php/ ) and attempted to use it but the script is not going past step 6 (from the demo code).
I am able to upload an image to the fold...
Hello all,
I currently have the following tables for a private messaging forum:
What I'm trying to do is output an "inbox" that displays the most recent thread at the top and group by thread (meaning, you don't see the same thread twice in your inbox), no matter who the sender is.
What I have right now works fine for simple messa...
$canada_territories = array("British Columbia" => "British Columbia", "Manitoba" => "Manitoba", "New Brunswick" => "New Brunswick", "Newfoundland and Labrador" => "Newfoundland and Labrador", "Nova Scotia" => "Nova Scotia", "Northwest Territories" => "Northwest Territories", "Nunavut" => "Nunavut", "Ontario" => "Ontario", "Prince Edward...
I have two different PHP files that both write to the same file. Each PHP script is called by a user action of two different HTML pages. I know it will be possible for the two PHP files to be called, but will both PHP files attempt to write to the file at the same time? If yes, what will happen? Also, it is possible to make one of the PH...
passing a value to a php page via get, depending if the value is true
then how do i fire my jquery function..
currently trying..
<script type="text/javascript" language="javascript">
function showError(){
$('#errormsg').fade(1000);
$('#errormsg').html('<div class="error"><p>failed</p></div>');
}
</script>
php on the page:
<?p...
I have seen many different naming schemes and extensions used for PHP files that are basically just classes. Some examples:
myClass.php
myClass.class.php
myClass.class
What is the difference, and which is better?
...
I've just discovered the email-address-saving form on my website does not work on Opera and Internet Explorer (7 at any rate), and possibly other browsers. Works fine with Firefox. Unfortunately I'm not a developer and no longer have any contact with the guy who wrote the code for the form so I've no idea how to fix it. I assume the prob...
I'm looking for an easy way to compare two similar strings and output the difference
for instance if I have
"abcdefghijklmnop"
and
"abcdefghi"
the function would output
"jklmnop"
I need to know how to do this in both php and python
...
I am trying to improve my in-site personal messaging system by making it look nicer and feel more like e-mail. I currently add > before each line of replied text, but I would also like to add formatting such as font color to lines that start with ">" without the quotes. I am not sure how I would close the lines out with a regular expre...
I am fairly new to OO programming...
I am building what will eventually turn out to be a large library of classes to be used throughout my site. Clearly, loading the entire library on every page is a waste of time and energy...
So what I would like to do is require a single "config" php class file on each page, and be able to "call" or...
I find in my PHP pages I end up with lines and lines of code that look like this:
$my_id = isset($_REQUEST['my_id']) ? $_REQUEST['my_id'] : '';
$another_var = isset($_REQUEST['another_var']) ? $_REQUEST['another_var'] : 42;
...
Is there a better, more concise, or more readable way to check this array and assign them to a local variabl...
I have a website authored in PHP where anytime a user receives an error I will redirect them to a another page (using header(Location:...)) and put the error ID in the URL so that I know which error to display.
E.g. If the user tries to access a product page but that item is no longer available I will redirect back to the category of it...
function updateDemo($demoTitle, $desc, $keyword,
$uploadedFile, $clientname, $uploadedImage, $adminName, $demoID)
{
$query = "UPDATE demos SET dmTitle ='sdsdsdsdsd' , dmDesc = '$desc' ,
dmKey = '$keyword' , dmLink= '$uploadedFile' , client='$clientname' ,
imageTitle = '$uploadedImage' , userName = '$ad...