php

How to export from xml

I have a xml file file name is file.xml This is content <PAD_INFO> <ITEMS> <Item> <PAD_URL>http://www.instant-navigator.com/instantn_pad.xml&lt;/PAD_URL&gt; <Antivirus_Report_URL>http://instantnavigator-for-onenote.extramind-systems.qarchive.org/antivirusreport.html&lt;/Antivirus_Report_URL&gt; ...

Survey written in HTML using Generic HTML Form Processor, won't save a user's data if the user clicks the previous button

Hello, I'm using Generic HTML Form Processor in combination with an xampp lite installation to save data into a MYSQL database. However, I've encountered a problem while writing a multi-page survey. If users use the previous and forward buttons coded like: <INPUT TYPE="button" VALUE="Previous Page" onClick="history.go(-1);"> <input ty...

Problems storing content from a form via CMS

I have a MySQL table called sales, containing the fields product, quantity and paid. I am using a CMS like system which has a custom way of doing forms, and custom formfields to use. As far as I can tell, the id given to a formfield is what is used as the table name to insert into. My current form I am using is as follows: <?php ...

Base64_encode for URLS

Is there a base64_encode function that is URL safe in PHP? It also needs to be decodable obviously. Thanks for your help! ...

PHP - cooler function parameter

Hi I have this: function boo($show_one = false){ if(!show_one) return 1; else return 2; } how can I call boo like this: boo(SHOW_ALL); instead of boo(false). I see some native php function have parameters like that which make the code more easy to read ...

Heading on first comment - Drupal comment list question

Hello! I'd like to have a header on the comment list. Is there a php if statement that I could use? Something like <php if $first : ?>. I can't find it. ...

PHP Array manipulation

I have an array like this: [0] => Array ( [slideritem] => 592 [sliderbig] => 644 ) [1] => Array ( [slideritem] => 593 [sliderbig] => 645 ) [2] => Array ( [slideritem] => 594 [sliderbig] => 646 ) slideritem is the id of an image that will be displayed and the sli...

How to improve this mysql query in speed .

here it is SELECT tbl_rls . * , ( SELECT count( * ) FROM `comments` WHERE `post_id` = `tbl_rls`.`id` ) AS `t_comments` FROM `tbl_rls` WHERE 1 =1 AND `status` <> 'denied' AND ( `id` IN ( SELECT `rls_id` FROM `tbl_visitors_logs` WHERE `date` LIKE '2010-07-02%' AND `page_type` = 'post' GROUP BY `rls_id` ORDER BY count( * ) DESC ) ) AND ...

Making a PHP/MySQL Timestamp look more attractive

Hello there! So basically, I'm currently selecting a Timestamp from my MySQL database. In the database, the timestamp looks like so: 2010-06-30 12:36:08 Obviously for a webapp, that's not very attractive for users to view. So, using some CodeIgniter functions, I made it look a bit nicer. <h4 class="timestamp"> <?php // Quickly c...

When did $this start working?

Ok, all jokes aside... I just noticed that I was able to refer to a static class propery using $this::$name. I don't remember ever running across that before since I always used self::$name or $this->name in my classes. In what version of PHP did $this start working with static class properties? ...

Redirecting users when they have made 10+ submissions in one hour

Hello, The code below is supposed to check to see if a user has made an addition to a MySQL database table called "submission" more than 10 times in the last day. If the answer is yes, then the user is re-redirected back to the index page. As far as I can tell, it works just fine. How could I modify to make it do the re-direct if the...

PHP - global variables

So I got a lot of responses from this site that global variables are bad and kill puppies. What if I use such variables like this: function get_stuff(){ global $stuff; if(!stuff) $stuff = 'candy'; return $stuff; } function screen_output(){ $stuff = get_stuff; echo $stuff; } does this make the code better than using 'global...

ASP.NET File Upload - > Translation from PHP

Hi All, I posted something similar but I am changing my question around enough to warrant a new post. I am trying to handle a posted file to an aspx page (C#). I am told this is not possible without a postback from <input type=file> or the asp file uploader. However, I have a PHP script does this perfectly, so I am really hoping it ...

Why/how is my PHP shared host setting argc/argv?

Until now, I had been checking for the presence of argc and argv in my script to determine whether requests were coming from the CLI, which worked on several development machines. When placed on a particular shared host, though, the program went into fits. Looking at my routing code, I discovered that the host was setting both argc and a...

Why PHP's md5 is different from OpenSSL's md5?

I am quite confused as to why I am seeing different results for md5 hashing in PHP and in OpenSSL. Here is the code that I am running: php -r "echo md5('abc');" Results in: 900150983cd24fb0d6963f7d28e17f72 While this: echo abc | openssl md5 Results in: 0bee89b07a248e27c83fc3d5951213c1 Why? ...

Monitor Database Updates Live using AJAX and SQL

How can one trigger an event locally when a field in a connected database changes? I've done some research but it seems like there there are varying and inconclusive answers to the question. I'm building an application where users rate comments, and I'd like to have the ratings change live when they are modified by a different user. For...

Any PHP Frameworks that use a Layout and Block system like Magento?

While it is most typically touted as a fully-featured shopping cart system, Magento is an awesome framework to boot. Of particular awesomeness is the layout system. In essence a page is created from "Blocks" which all inherit from an abstract class which does not assume the use of template files. These blocks are assembled according to a...

Can I randomize an array by providing a seed and get the same order?

I am trying to create a random string based on a fixed string. I'd like to be able, if at all possible, create the same random string (i know its an oxymoron) provided I use the same seed. like so: $base = '0123456789abcdef'; $seed = 'qwe123'; function getRandStr($base, $seed) { } such that so long as I give the same $base and $seed ...

Can't get mssql_connect to work properly

I'm trying to connect to a specific local server using mssql_connect method but not having any luck. Any Ideas? mssql_connect('10.12.179.66:1433\ONE_ROOF_PROD', 'username', 'password'); ...

Why is the bitmapdata not posted to server side with flash?

Here is the code I used to post the bitmapdata to server side(PHP): private function savePicToServer(bmpData:BitmapData):void { trace("in savePicToServer"); trace(bmpData); var jpgEncoder:JPGEncoder = new JPGEncoder(85); var jpgStream:ByteArray = jpgEncoder.encode(bmpData); var loader:URLLoader = new URLLoader(); ...