php

How to generate .json file with PHP?

CREATE TABLE Posts { id INT PRIMARY KEY AUTO_INCREMENT, title VARCHAR(200), url VARCHAR(200) } json.php code <?php $sql=mysql_query("select * from Posts limit 20"); echo '{"posts": ['; while($row=mysql_fetch_array($sql)) { $title=$row['title']; $url=$row['url']; echo ' { "title":"'.$title.'", "url":"'.$url.'" },'; } echo ']}'; ?...

Convert Javascript Regular Expression to PHP (PCRE) Expression

Hi all, I am up to my neck in regular expressions, and I have this regular expression that works in javascript (and flash) that I just can't get working in PHP Here it is: var number = '(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)'; var oneChar = '(?:[^\\0-\\x08\\x0a-\\x1f\"\\\\]' + '|\\\\(?:[\"/\\\\...

how to upload a file from database without user interface in php

Help!!! i want to upload a file from database(or from local m/c) to server in php without user interface. Is it possible. Please Suggest. ...

Mp3 link crawler for dynamic links

i am writing an crawler that will go around a specific set of websites and crawl all the mp3 links into the database. I don't want to download the files, just crawl the link, index them and be able to search them. using php and how some sites linke guruji.com ...

How to store thumbnail image into the database?

I created an .png image from a video using ffmpeg tool and i want to how to insert that image into the db which has a blob field and also i want to know how can i recollect that image from the db to display as a image again? ...

How can I test a CRON job with PHP?

This is the first time I've ever used a CRON. I'm using it to parse external data that is automatically FTP'd to a subdirectory on our site. I have created a controller and model which handles the data. I can access the URL fine in my browser and it works (however I will be restricting this soon). My problem is, how can I test if it's...

how to print data in a table from mysql

hello, i want to extract the last eight entries from my database and print them into a 2 columns table!like this: |1|2| |3|4| |5|6| |7|8| is that possible? this is my code: $db = new Database(DB_SERVER, DB_USER, DB_PASS, DB_DATABASE); $db->connect(); $sql = "SELECT ID, movieno FROM movies ORDER BY ID D...

Display the first 5 file names using opendir() and $file using PHP

Hello, $d = opendir("docs"); while (($file = readdir($d)) !== false) { if (($file != ".") && ($file != "..")){ } } I want to be able to display the first 5 file names. Here is the twist, I have a next button, which I want to display the next 5 filenames Thanks Jean ...

jQuery addClass on $.post

I am basically trying to create a small registration form. If the username is already taken, I want to add the 'red' class, if not then 'green'. The PHP here works fine, and returns either a "YES" or "NO" to determine whether it's ok. The CSS: input { border:1px solid #ccc; } .red { border:1px solid #c00; } .green { border:1px s...

How do I make a PHP call whenever a form element is clicked?

I have a jQuery colorbox opened over top of my webpage (with a <select> drop down list) and I'd like to make an AJAX call every time a new <option> is selected from the drop down. I have the following code, but it's not picking up the select event. $('#cboxLoadedContent select[name=parent]').live('select', function() { $.get("edit.ph...

Executing a file not a project

I use Aptana Studio for my PHP projects. I have not learned it but just used with what I was able to do in it. Many features I still don't know how to use in it. At present, I have a HTML form and I want to write a .php script for the SEND button that it has. It is a submission script for the contact form. I want a simple PHP IDE with ...

PHP Regular expression flags

Can someone explain what the 'e' flag does, or link me to somewhere that does? I couldn't find anything via google. Example: preg_replace("/a(b?)c/e", "search_foo_term('\$1')", $str); ...

How can I catch a "catchable fatal error" on PHP type hinting?

Hello, I am trying to implement Type Hinting of PHP5 on one of my class, class ClassA { public function method_a (ClassB $b) {} } class ClassB {} class ClassWrong{} Correct usage: $a = new ClassA; $a->method_a(new ClassB); producing error: $a = new ClassA; $a->method_a(new ClassWrong); Catchable fatal error: Argu...

PHP: using REGEX to get the tablename from a mysql query

Hi Guys, Consider these three mysql statements: select * from Users; select id, title, value from Blogs; select id, feelURL, feelTitle from Feeds where id = 1; Now im not very good at REGEX, but i want to get the table name from the mysql query. Could someone possibly create one for me with a little explanation. Thanks, ...

Validation against 10K XSD - performance problem

I have an XSD scheme which has 10K lines. It takes 5 seconds to validate my XML with 500 lines. I get dynamically XML via POST from external server, on every click of the user on my homepage. The validation takes 5+ seconds, which is very much for every click of the user. PHP Example: $doc = new DOMDocument(); $doc->load('file.xml'); //...

php eval function in iframe

i got an iframe in an echo: <iframe width='100%' height='100'>$content</iframe> $content = eval ( "\$bugs = \"" . gettemplate ('bugs') . "\";" ); but it doesnt work. how can i use the eval function from php to show the page in an iframe? thnx! ...

Zend Framework :: ignoring predispatch for particular action

Hi, I am a newbie to Zend framework, I want to know how can we restrict the call to predispatch() function in my controller for any particular action. -DevD ...

does php mysql_fetch_array works with html input box?

this is my entire PHP code: <?php if(empty($_POST['selid'])) {echo "no value selected"; } else { $con = mysql_connect("localhost","root",""); if(mysql_select_db("cdcol", $con)) { $sql= "SELECT * FROM products where Id = '$_POST[selid]'"; ...

Concate String In MYSQL

How can i concate this string in mysql desc=desc+$desct what i want is each time i insert a variable from PHP that the string is added to the string which was already in db and seperated with || the field desc should look like this desc 10||30||90||710 say i want to add the value 20 desc 10||30||90||710||20 then the desc fiel...

google apps is setup on my server, how do i get php mail() to use it?

Hi, I've got google apps setup on my server with all the correct MX records etc, now i want to start testing it. I want to use it for all automated emails (registration, lost password etc). I'm testing on a localhost. ...