php

PHP Query from a FORM

So I have a form that I post to a page and in the form I'm posting certain variables that I build one of my queries with and then call them on my page. How can I post data and also build a query and display the answer on one call? Maybe I'm not wording it right and I'm learning this stuff, but I just don't know. Should I post to an in...

need to get value from the database and populate a drop down list using jquery

hi i need to populate a drop down list when i select a certain value , and the options need to be queried from the database .. can i achieve this from jquery ? if i can then please i would appreciate any help.. ...

problem with dropdown with php and ajax

For some time i am battling to solve this problem but iam not coming to any conclusion so thought to seek some help here. The problem is that i am getting a blank dropdown instead i should get list of cities populated from the database. Database connection is fine but iam not getting anything in my dropdown. This is what iam doing: ...

PHP call a function from a function

What's the PHP code that would do one thing first and then take that and do a second. 1st: I want $_GET a variable and then run a query on it and return variables. AND THEN 2nd: Use those "other" variables in a query. I'm thinking I want to do this with two functions b/c my query is based off of what values I send from a form. So it...

A need to get data from a table and then use that data for a query

I would like to write a PHP function that calls another function Page 1. User selects item from drop down. (I then post to the same page.) Page 1. (I have a query on the page that's based off of which item is selected) (In this case I'm returning the lat and long of the item.) $latitude = $row_farms['lat']; $longitude = $row_farms['...

php array help. Getting the correct content.

I have an array like so: Array ( [level] => Array ( [0] => Array ( [lvlName] => name [lvlEnt] => ent ) ) [title] => Array ( [0] => Array ( [title] => a title ...

Single centralized or seperated log table for modules ?

Hi All I am designing intranet system for medium business. Should i keep single log table for all modules or make it separate ? Audit log keeps all admin/staff activities(create, update, delete objects) and the log structure is universal for any kind of module. And also is it good idea if i pull report based on log records ? My log tabl...

Split a text into single words

Hello! I would like to split a text into single words using PHP. Do you have any idea how to achieve this? My approach: function tokenizer($text) { $text = trim(strtolower($text)); $punctuation = '/[^a-z0-9äöüß-]/'; $result = preg_split($punctuation, $text, -1, PREG_SPLIT_NO_EMPTY); for ($i = 0; $i < count($result); $i...

how to run php file by double clicking from any folder like html files in windows xp ?

Is there any trick to run .PHP files in windows XP from any folder by double clicking like HTML file ? I use XAMPP but in this we need to put files ina special htdocs folder. I want to run file from any folder, desktop by double clicking. ...

.mp3 Filetype Upload

I'm working on a PHP upload script which allows .mp3 file uploads amongst others. I've created an array which specifies permitted filetypes, including mp3s, and set a maximum upload limit of 500MB: // define a constant for the maximum upload size define ('MAX_FILE_SIZE', 5120000); // create an array of permitted MIME types $permitted =...

Jquery getJSON to external PHP page

I've been trying to make an ajax request to an external server. I've learned so far that I need to use getJSON to do this because of security reasons ? Now, I can't seem to make a simple call to an external page. I've tried to simplify it down as much as I can but it's still not working. I have 2 files, test.html & test.php my test.htm...

What's the difference between " and ' when creating strings in PHP?

Very basic, but would like to know the difference/security ramifications etc of using " vs. '. Can someone provide an example that explains when to use each one? ...

count lines in a PHP project

Hi there I'm just curious. Do you know any tool which can count all the code lines from a PHP project? Many thx! ...

How do I restore Apache and PHP to Leopard defaults?

I used this guide on Apple's website to enable PHP on my computer but I lost all my Apache configuration files in process. I ran this script which I found on Google to restore Apache on Mac OS X: #!/bin/sh # run with ./apache_refresh.sh #If permissions error do: chmod u+x filename.sh #WARNING THIS MAY DELETE OR CHANGE YOUR APACHE SETTIN...

How can I include break lines in mysql records?

When someone types in the following to be put into a database: Hello, My name is John and I am 22, and looking for a good time. My Phone Number is: 555-NOT-REAL Sincerely, John D. I want the break lines to stay there, but it seems that when I pull the value back out it comes out as follows. Hello, My name is John and I am 22, and ...

Somewhat lost with jquery + php + json

I am starting to use the jquery $.ajax() but I can't get back what I want to...I send this: $(function(){ $.ajax({ url: "graph_data.php", type: "POST", data: "casi=56&nada=48&nuevo=98&perfecto=100&vales=50&apenas=70&yeah=60", dataType: "json", error: function (xhr, desc, exceptionobj) { ...

Keeping a live connection with php?

I am working on a project has me constantly pinging a php script for new data, so if I understand this correctly that means that the php script being pinged gets run over and over indefinitely. It works but i'm guessing its a huge strain on the server, and is probably considered ugly and bad practice. Am I right about that? Is there any...

Why is my MySQL INSERT query inserting 3 identical rows?

I am trying to track what users are searching for on my site (from a simple search form on the front page) with PHP and MySQL. At the end of all my queries I am using this query: INSERT INTO `DiggerActivity_Searches` ( `SearchTerms`, `SearchType`, `NumResults`, `Location`, `Date`, `Time` ) VALUES ( 'SearchKeywords', 'SearchTypes', 'Num...

Online fingerprint authentication

Hi there; The company has a web-based punch card application, but my boss wants to make employees punch in and out using their fingerprint rather than sharable passwords. Is there any free/open source/commercial SDKs that can be used? With a Java or ActiveX based embeddable component? Thanks in advance. ...

Passing associative array through AJAX to PHP

I'm trying to pass this to a PHP script through AJAX: var answers={}; for (x=0; x< allAnswers.length; x++) { answers.x=new Array(); answers.x['id']==allAnswers[x]['id']; answers.x['val']=$("#field_" + x).val(); } var data={}; data.id=questions[qId]['id']; data['answers']=answers; $.post('inde...