php

How to populate a PDF form such as a w-2 from data inside of the the database?

i have a w-2 form and other pdf documents and using adobe acrobat pro i have created fields with field names using the adobe application. how do i populate those fields? i have done this a few years ago where the php would generate the fdf file then load the pdf file and populate it but i completly forgot how i did it. any help would be ...

PHP - mysql_real_escape_string not working

Hey, I have this strange problem. I have this script: echo $comment_content = $_POST['comment_content']; echo $comment_content = mysql_real_escape_string($comment_content); When I run it on my website server, it outputs the value only 1 time (not the second one), but when I run it anywhere else, it outputs right (2 times). However, I...

how to store the pdf file in mysql and retrieve those data

here's my code snippets and the data is not inserting on my database(mySQL).. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); include 'fpdf.php'; class generate extends FPDF{ function out($info,$Bold,$Size,$br){ if ($info != "") { $this->...

To combine challenging PHP arrays

How can you combine the two arrays? They are simplified as follows which is enough for this question. This question is based on this answer. 1 [a][b][] and 2 [a][c] where both arrays has one common subarray [a]. I would like to have this [a][c][b][] I have run the following command unsuccessfully array1[a] + array2[a] ...

how to use htaccess to disguise filetypes

I want to be able to name my files with whatever extension I choose. In this case let’s use .foo, and then process them as PHP files. Right now my .htaccess looks like this AddType application/x-httpd-php .foo But it doesn’t work, it still prompts me to download the file when I access it. Any advice or tips? ...

MySQL create view problem,

Hello, I'm using a view as a table to join data on 3 tables: create view category_list as select forum_categories.*, max( forum_answer.a_id ) as latest_answer_id from forum_categories left join forum_question on forum_question.catid = forum_categories.id left join forum_answer on forum_answer.question_id = forum_question.id and foru...

Figure out which checkboxes have been selected in a form in php

Hi all, I have a form with several checkboxes. When I submit it to another php page, I am wondering: How can I tell which ones are checked without calling isset on every checkbox name? (if there is a way). If I give each of the checkboxes the same name, then only the last selected checkbox is returned. Thanks, Michael ...

Regex PHP question

Guys, Not gonna lie, I'm terrible at regex. How would I be able to do this guys: $string = '>Data 1-23</a>'; $string = '>Datkl3</a>'; $string = '>RA Ndom</a>'; And pull out the "Data 1-23" from inside the above string using regex? And if I have multiple ones of this, how would I be able to put all of the matched strings into an arra...

preg_replace() help

i need to replace combobox like this. eg:- <select sistem="" name="answer5" > <option>math</option> <option>science</option> <option selected="selected">engineering</option> <option>English</option></select> result shuld be(AFTER REPLACED) :- {answer5} i have tried this but failed: preg_replace('|<SELECT(.*)name="'.$name.'"(.*)>...

Howto parse json with smarty?

Hi, In Smarty, is there a standard function or an easy way to parse json from an array, as json_encode() does in php? Actually It seems there is not in smarty documentation but wanted to ask anyways. Thanks, Sinan. ...

MYSQL mystery. Value passed to function is incorrect.

When I submit using this function I get an incorrect result for $_REQUEST["add_single"] in the database of 127, incorrect. but the javascript result is 188, correct. If i replace $_REQUEST["add_single"] with 10 I get 10 inserted into the database. if (isset($_REQUEST["add_single"])) { save_single_bracelet($_REQUEST["id"], $_REQUEST[...

PHP multidimensional arrays in generating question summaries

The purpose of this question is to find the best way to print data out of PHP multidimensional arrays. How can you complete the following procedure below? I have the following arrays array1['id']['title'] and array2['id']['tags'][] The arrays have been generated by the function pg_fetch_array. This allows you refer to each value ...

mvc question, interactive objects

i want to make a 'calendar object' which generates three different style calendars to display, they'll all use the same data. should i do the logic for the calendar style in the view, or should i do that in the controller and then call it from the view? ...

Using foreach to update fields in a mysql databse based on another query

Ok I really should be be clued up on this now but its a bit late here in england and I was wondering if someone could point out the obvious to me. I have to do a first query which is SELECT * from table WHERE NOT column=0, and use the results from that to do a foreach loop something like below. foreach($results as $result) { $nox = $r...

filemtime() not working in Windows PHP-CLI

I just got PHP-CLI working on my Windows machine so I could create scripts using PHP. However, I'm trying to write a script to cleanup my Firefox downloads folder of files older than X number of days, but I can't seem to get the filemtime() function working. Here is the function I wrote: function deleteOldFiles($dir, $days) { $mydir...

How do I use php to create a database with table and info using a backup file?

How do I use php to create a database with table and info using a backup file? so far my code is <? header("content-type:text/plain"); $serv= mysql_connect('localhost', 'root', 'xxxx'); if($serv){ wText("Server connection created"); } else{ wText("Server connection failed"); } $sql ="CREATE DATABASE tf2faq"; if(@mysql_qu...

What are some good tips for a new PHP developer?

As you probably figured out from the title, I'm relatively new to PHP, I'm not PHP retarded, but I'm still in my error prone phase. I would just like to know some good tips to help expedite my progress. I recently learned that it's good practice to totally separate everything from everything else, so keep my html forms in one file, and m...

How can I improve this PHP code?

I have the php code below which help me get a photo's thumbnail image path in a script It will take a supplied value like this from a mysql DB '2/34/12/thepicture.jpg' It will then turn it into this '2/34/12/thepicture_thumb1.jpg' I am sure there is a better performance way of doing this and I am open to any help please Also on a page...

Suggestions for writing a code flowchart

I'm nearing the end of my internship this summer, and I've developed a tool for my mentors that involves primarily PHP, MySQL, JavaScript (jQuery). Does anyone have any templates or suggestions or links on creating an easy to read document showing the code structure of the program and the relationships between the files? These guys are...

Free reporting library for PHP without installation?

Is there a good (and hopefully free?) source library to use for PHP for creating and displaying reports? I would love one that would allow the user to view it in a nice format for saving and printing (like PDF?). Also I would prefer one that is just files, not one that needs to be installed on the server itself as some of the people I c...