php

mysql fetch sum php

Hi, sql column - trans_value contain both positive and negative value amount. so i'm trying to figure out how do i set a sum of positive value and negative value aside, so that i can calculate the how much sum of positive and how much is sum of negative. so in the end, i can minus both, positive - negative. edit, i forgot to mention ...

PHP Calculate Total of Looped Items

I have this code: foreach ($cartContents as $item => $itemQty) echo "$item <br /> $itemQty <br /> $price"; It loops through some items and prints the name, quantity and price. I would then like to print a total of all the prices added together. Is there a way to get this figure? ...

How to log user actions to db using the Zend Framework

Hi guys, I am building a cms at the moment using the zend framework and have implemented a text based log which will log any errors and allows me to log any custom messages I may want recorded. As part of the cms I need to provide some sore of revision history for pages, blog posts etc. My thoughts on this were to simple have a logs ta...

PHP trigger an email automatically when a certain condition is met

I would like to automate the process of sending this email. I mean when a condition is met then the email should automatically be sent to the given email addresses which is already given as hard-coded values. So for an example in my case a Technician has to complete 40jobs a day and if he finished 35 at the end of the day an email should...

How to show Ajax requests in URL?

What I want is to have links which change a part of the page , and a dynamic URL for it, where I can specify variables such like #calendar=10_2010tabview=tab2 Check this for an exact example: CLICK HERE FOR EXACT DEMO So here is the link format what I need: #calendar=10_2010&tabview=tab2 I need to have variables in the links like cal...

PHP while loop problems

I am primarily a CSS and HTML guy but I have recently ventured into PHP. I can't see why this script hangs: $loop_Until = 10; while($i < $loop_Until) {    // do some code here    $loop_Until = $loop_Until + 1; } Can anyone please help? ...

Push item to associative array in PHP

I've been trying to push an item to an associative array like this: $new_input['name']=array('type' => 'text', 'label' => 'First name', 'show' => true, 'required' => true); array_push($options['inputs'], $new_input); However, instead of 'name' as the key in adds a number. Is there another way to do it? ...

Jquery Dialog box within php grid

Hi, I'm trying to use jquery dialogbox for each returned records from the mysql query. But when only the first one works and the rest do nothing. Is it possible to use the dialog box for each record and let's say to bring up their details for editing? Many thanks in advance. ...

Sort Div id by using Php (or by java)

Is there a fairly easy way to sort div id's with php? I tried a jquery script to sort it be it gave a big delay on the page load. Example html part (unsorted) <div id="1">Content1</div> <div id="3">Content3</div> <div id="2">Content2</div> Example html part (End result, Sorted with php or java) <div id="1">Content1</div> <div id="2"...

append php in jquery

I'm trying to dynamically create a div to show error messages using jquery. I'm able to use append() to create the HTML easily enough, but I need to call a php variable in order to display the content. If I just try adding php opening and closing tags like I would ordinarily, the append method doesn't behave as expected and outputs a see...

Printing rss using PHP!?

I am trying to use an rss feed from a domain that does not have a crossdomain file and because of that I am going to use a web service in the middle where I will be just getting the rss feed from a url (let's say the url is: www.example.com/feed) and then just print it to a page. The service would work like: www.mywebservice.com/feed.ph...

problem with curl piping $_POST and $_FILES in same request

I'm trying to recreate an entire http request including both post and files data however no matter what I do I can't seem to get my files to work, the code I'm using is below... $count=count($_FILES['photographs']['tmp_name']); $file_posts=array(); for($i=0;$i<$count;$i++) { if(!empty($_FILES['photographs']['name'][$i])) { $_...

validate form before submitting (more complicated than checking for empty fields)

i have a form containing inputs for times (specifically, an opening and closing time). when the submit button is pressed, it goes to a php page where these inputs are added to a database. i want to check a few things before allowing the form to submit. for example, i want to make sure that the start time is earlier than (less than) the e...

How To clone an existing wordpress site into a subdirectory on same server?

For example: I have a Wordpress site (blog) on www.xxxxxx.com I want to upgrade some plugins and WP version of site but before it I want to check all things on a mirror version. How to make a mirror backup site of currently running site on same server like www.xxxxxx.com/testing-site/? Whatever I will do on mirror site, should not ef...

How does MAMP know to look in /opt for web applications?

I've installed a PHP web application that's in /opt/webapp name. However, I'd like to be able to tell MAMP pull the PHP files from something like /username/localdevversion/. The problem is that I can't figure out what tells MAMP to look for PHP files in /opt. I've looked in /Applications/MAMP/conf/apache/httpd.conf and /Applications/MAM...

Comparing strings in PHP

String comparison in PHP seems little difficult. I don't know if any other ways to do it. For example say: $t1 = "CEO"; $t2 = "Chairman"; $t3 = "Founder"; $title = "CEO, Chairman of the Board"; if (!strcmp($t1, $title)) { echo $title."<br>"; echo $Fname."<br>"; echo $Lname."<br>"; } else if (!strcmp($t2, $title)) { echo $titl...

PHP post checkboxes help

I"m having trouble receiving a list of items that are checked in a field of checkboxes which are part of a form. I have an HTML table with a few checkboxes: HTML <input type="checkbox" name="carry[]" value="1" /> <input type="checkbox" name="carry[]" value="2" /> <input type="checkbox" name="carry[]" value="3" /> PHP - this is wh...

XAMMP - How do turn on --with-imap-ssl

Hi, How do I turn on --with-imap-ssl in XAMMP? I'm on Mac. Under my imap setting I have this IMAP c-Client Version 2004 However, I think I also need to have the following option, which is not currently showing SSL Support enabled Thanks, Tee ...

getting an array of cities out of a json response

I have the following code. I am trying to get just the name of the city out of the feed that is requested, and into a new array. Can anyone give me an indication. $city = $_GET['city']; $json = @file_get_contents('http://ws.geonames.org/searchJSON?country=GB&amp;maxRows=10&amp;name_startsWith=$city'); $json = utf8_encode($json); $c...

optimizing a php function that trims strings

Hi, i programmed this php function that takes any text/html string and trims it. For example: gen_string("Hello, how are you today?",10); Returns: Hello, how... The problem arises when the function string limit is the same as the position of a special character such as: á, ñ, etc... In which case: gen_string("Helló my friend",5); ...