php

Setting up path in the below code.

<?php if($_FILES['Filedata']['size']>=520000) { echo "\n Sorry, Not Moved Size below 5.2kb or 5200 bytes Only\n"; return; } $ext = end(explode('.', strtolower($_FILES['Filedata']['name']))); if(move_uploaded_file($_FILES['Filedata']['tmp_name'], "./".$_FILES['Filedata']['name'])) { echo "\nfile mo...

How to execute SELECT and INSERT in single query with PHP/MYSQL?

I have a table user_name with 3 fields, id, Name, Email (id is auto_increment field). I want to execute the following query in PHP, but its not returning any result. INSERT INTO user_name (Name, Email) VALUES ('Example', '[email protected]'); SELECT LAST_INSERT_ID() AS 'userid'; When I am executing the above query in PHP as below then ...

Sending mass email using PHP

I am currently writing a music blog. The administrator posts a new article every 2-3 days. Once the administrator posts an article, a mass email will be sent to around 5000 subscribers immediately. What is the best way to implement the mass mail feature? Does the following function work? function massmail() { $content = '...'; f...

Write image file to database as BLOB (PHP)

Hi Guys, I want to enter some image file that is in ../img/test.jpg into the database If I do $image = file_get_contents('../img/test.jpg') And then mysql command "INSERT into table(picture) VALUES ('$image')" it doesn't work. Any suggestions? ...

help with preg_replace

i want to replace html text that closed by tag start_ticker code.... end_ticker i don't success my code is $string_html = preg_replace('/<!-- start_ticker -->.*<!-- end_ticker -->/i',"bla bla",$string_html); ...

Array with associative values accessed numerically

Hello, I have an associative array that I might need to access numerically (ie get the 5th key's value). $data = array( 'one' => 'something', 'two' => 'else', 'three' => 'completely' ) ; I need to be able to do: $data['one'] and $data[0] to get the same value, 'something'. My initial thought is to create a class ...

How to store European Currency in MySQL?

On a new project I work on I have data in CSV format to import into a mysql table. One of the columns is a price field which stores currency in the european format ie. 345,83. The isssue I have is storing this decimal seperator. In most European currencies the decimal seperator is "," but when I try to insert a decimal number into a fie...

Two insert query... in the same click

I have two text fields and a button, on the click i need to save them into MySQL Tables. The top text box field data in table 1 and data in text box in table two... How to perform it. ...

selecting multiple items per date of a limited amount of dates from DB

My DB has a list of song I like that I have places on my web site for my friends to listen to. Some days I will upload 5 songs. Some days 1. Some days 0. What I want to do is select all the songs from say the last two weeks or last month but not have it limited by the number of songs or days I might have skipped uploading a song. For ...

how to access xml file?

Actually in my website www.musicking.in when the user selects songs one player window will open and that will access the corresponding selected songs xml playlist and the player will play those songs. actually its working fine. but sometimes the problem is when so many users are accesiing the player not playing the songs selected, eithe...

jquery GET request not working in IE

Hi, I have the following jquery code: function update(){ $.get("getlatest.php", { id: $.cookie('last_post_id') }, function(response){ $('#board_posts').prepend(response); $('.incoming_post').slideDown("slow").effect("highlight", {}, 3000); $('.incoming_post').toggleClass("incoming_post").addCl...

How to enter tags correctly?

I have a tag field in my web page, in which user can enter tags seprating them by , (comma), same as done in StackOverflow. I am using PHP and I am seprating all tags enetered by the user on the basis of comma using explode function and then adding them to my tags table in teh database. My code is working perfect for normal tags like if...

fastcgi does not work - wrapper dowloaded not run

On my fresh Ubuntu 8.04 I installed virtualmin. Then I set up fastcgi as I did on my other server (Debian). Bu I have small problem. When I open website It instead of running fastcgi wrapper it downloads it. Here is config: <IfModule mod_fastcgi.c> FastCgiIpcDir /usr/lib/apache2/fastcgi AddHandler fastcgi-script .fcgi Fas...

SSL - pointing all assets to https

Hi, What is the best way to make sure all assets(images etc.) are https://.... on all secure pages so that the ssl cert shows in browser address bar? ...

displaying mysql timestamp correctly

Hey i'm trying to display a date/time from a timestamp field using: echo $date = date( "D F j", $row['date'] ); However it returns: Wed December 3 When it should return today: Monday July 13 Timestamp from the DB row is: 2009-07-13 04:16:31 Thanks. ...

Pass Ascending/Descending option to uasort()?

Quick question: How would I switch the sort order between ascending/descending in the following function? All it does is order a multidimensional array by a chosen field, and then by title. $sortby = 'date'; $orderby = 'asc'; function sort($a, $b) { $retval = strnatcmp($a[$sortby], $b[$sortby]); if(!$retval) return s...

PHP - Extracting a property from an array of objects

Hi, I've got an array of cats objects: $cats = Array ( [0] => stdClass Object ( [id] => 15 ), [1] => stdClass Object ( [id] => 18 ), [2] => stdClass Object ( [id] => 23 ) ) and I want to ...

php feedback email form

Hi I'm trying to make a feed back form for php and it worked but I was just wondering, can i make a set of code also deliver this email to the visitor who sent this mail? Also tagged along with a small message like "Thank you, for your feedback. This is the message you wrote ".....". and here is my code: <?php $myemail = "****@myemail....

Manager for folder of images

I am a big fan of jquery and PHP. I have already found a solution to batch upload jpg with resizing. I am now on a looking for a solution to MANAGE photo list must i need : view (thumbnail) edit name (simple) delete (single click) Will be cool : crop color correct sharpen So the question, does anybody know a framework or php script ...

PHP solution for creating a list of static value objects

I have a configurable report. For each field that can be included on the report, there's a key (stored in report preferences), a label, potentially an access level, and a SQL descriptor -- something like foo as my_foo. In a Java app, I would create a class called ReportField with each of the properties listed above. I'd use a private c...