php

Retrieving a file name to attach to an email with SwiftMailer and PHP

I am able to attach a file using SwiftMailer with its name hardcoded. But what if the file is uploaded by a user from an HTML form's 'file input type control and has to be sent with an email by a PHP script? How do I specify the file name in SwiftMailer? Thank you! ...

Array sum of value based on same key

I have my array data as shown below: Array ( [0] => Array ( [name] => Bank BRI [amount] => 0 ) [1] => Array ( [name] => Bank BRI [amount] => 0 ) [2] => Array ( [name] => Bank BCA [amount] => 1412341234 ) [3] => Array ( [name] => Bank CIMB Niaga [amount] => 532532552 ) [4] => Array ( [name] => Bank BRI [amount] => 34534534 ...

CI Base URL Routing

For example, in Twitter you can have this URL format: http://twitter.com/username/ With "username" being the username for the user. I am wondering on the proper method to have that in Codeigniter. I would need the same format. I have other pages such as user account management, about, etc. Would I need to route it through one function,...

SQL Server cast to text datatype

Can someone help me with SQL Server CAST to text datatype? I'm trying to get the long text to display using the CAST function, but it wont work if I am retrieving from more than 1 table. Perhaps I've created the statement incorrectly. $from = 'RealEstate AS RE, Models AS M, Catalogue AS C'; $select = 'CAST(RE.Details AS TEXT) AS RE.Det...

Problems accessing element style attribute with javascript

I am trying to access the style attribute of a element in order to display a form however, I get this error: Uncaught TypeError: Cannot read property 'style' of undefined. The example below is a simplified example. cookies.php echo "[a href='test.php?flavor=butter']Bake Butter Cookies[/a]"; echo "[a href='test.php?flavor=choco...

PHP + jQuery - How to form submit, process and redirect on success?

Hi All Stupid question (I seem to be leading all my questions with this phrase), but I was wondering if anyone out there had an elegant solution for processing forms via php and jquery and then redirects [HTML FORM] --> submits via jquery post to --> [PHP FILE] --> upon success redirects to --> [SUCCESS HTML PAGE] (and if not suc...

Querying multiple tables

Hi there. Following on from my query yesterday, I've restructured my recipe database as follows: categories cid | category_name 1 | desserts 2 | cakes 3 | biscuits recipes id | recipe_name 1 | black forest cake 2 | angel cake 3 | melting moments 4 | croquembouche 5 | crepes suzette ingredients iid | ingredient_name 1 ...

PHP Estimation Function

I am trying to calculate value $x in a number series based on an array of numbers (as $numbers). Ex: $numbers = array(1=>1000,2=>600,3=>500,4=>450,5=>425,6=>405,7=>400,8=>396); function estimateNumber($x) { // function to estimate number $x in $numbers data set } What would be the most statistically accurate method? ...

How to set English(UK) as a default language in CKEditor 3.2.

How to set English(UK) as a default language in CKEditor 3.2. ...

How do I set up a dropbox?

Hi guys my company requires that we set up in our application a dropbox feature kinda like what we see in highrise implemented. The idea is that when an account is created - automatically for each user a dropbox 'email' would be created and users would send emails to that dropbox address and based upon the email teh content would be adde...

MySQL installation problem

I'm working on Windows with Apache and PHP. I just installed MySQL, configured it, and started it. But when I run <?php phpinfo(); ?> I don't see the mysql section, which means that I cannot use MySQL commands in the PHP code, right ? Why is that ? Should I do any manual connection between MySQL / PHP / Apache ? ...

Some PHP (Zend Framework/Doctrine) fails after reinstalling PHP (on Windows/Apache)

i am on windows/apache/mysql/php setup. i have recently reinstalled PHP. but i found that it broke certian things. simple scripts like just phpinfo(), echo, simple OO class definitions etc works. but my Zend Framework app failed. same as the doctrine 2 sandbox i am working on. they both returned the ... below ... screen i also noticed...

Best way to submit UL via POST?

Hi All, Quick question... I have an input box that upon key enter, adds the value to an unordered list. How would I pass this unordered list to jquery post? I'm using the form.serialize, so I don't have to define each variable for posting. Example, let's say I entered 3 fruits and they get dynamically added to an unordered list insid...

Updating records in database

guys, i have these codes for updating the records in the database. please.. check if these is correct? <?php session_start(); include "db.php"; $username = $_SESSION['username']; $query="SELECT * FROM members where username='".mysql_real_escape_string($username)."'"; $result=mysql_query($query); $num=mysql_numrows($result); mysq...

I want to take backup of site folder from admin side,not using cron.

I want to take backup of site folder but not using cron. I have used copy command,but it is taking too much time,is there any other way or script i can copy site folder? ...

Fastest way to get HTML version of Drupal page?

I create a page called "blank" located at http://www.mysite.com/blank How can I download this page and get it as an HTML string in PHP? I know the PHP "file_get_contents" function could do the trick, but I would prefer a way where Drupal's API generated page with node ID X, and I can just grab the whole page generated as an HTML string....

PHP OOP Programming Question

Im new to PHP Object Oriented Programming but I know to code in procedural way. If this is my PHP Class <?php class person { var $name; function __construct($persons_name) { $this->name = $persons_name; } function get_name() { return $this->name; } } ?> and if I access it in my PHP page $jane = new person("Jane Do...

howto restate this code from php to c#

hi there! this script is from here: $r = /* get R value from querystring */; $g = /* get G value from querystring */; $b = /* get B value from querystring *; $mask = ImageCreateFromPng(/* magical path */); $w = /* width of the mask */; $h = /* height of the mask*/; $im = /* create a new image with width and height of mask */; imagea...

Storing the mysql password in the apache configuration file using SetEnv

Currently we are storing mysql passwords in the application.ini. As this file is in our source code control repository (bazaar), it is not a good place for the passwords of the production server. I was thinking about storing it in an environment variable of the apache configuration. Is this reasonably safe? ...

PHP - extracting specific <a href> urls out of the document

I think this should be elementary, but I still cant't get my head around it. Let's say there's fair amount of HTML documents and I need to catch every image urls out of them. The rest of the content changes, but the base of the url is always the same for example http://images.examplesite.com/images/, so I wan't to extract every string t...