php

Jquery - .click not triggering on submit button

Well, I can't seem to figure out why this isn't working. (there is a description of the error at the bottom) <script type="text/javascript"> $(document).ready(function(){ $('#submit').click(function(){ $('input[type=checkbox]:checked').each(function(){ ajax=$.ajax({ type: "POST", url: "rollcall_submitvote.php", data: '...

Problem with objects in php

Hi. I am trying to get used to writing object oriented, but often I get a little stuck. I have this queries that I want to use to create arrays. $user1 = mysql_fetch_object(mysql_query("SELECT * FROM tbl WHERE username='$oc->user1'")); $user2 = mysql_fetch_object(mysql_query("SELECT * FROM tbl WHERE username='$oc->user2'"...

Improving this longwinded and repetative sql script..

I've been learning about DRY code and my code isn't DRY... For example, I have a custom CMS and I save basically a name, content and a publish status for a few things... like an article, a user, a event. To submit a form, I submit to a file (process.php) which has a switch in it like so: switch($_POST['process']) { case 'speaker': ...

preg_match help

Hi! I'm using preg_match for the first time but I'm stuck even before I got some code... With the help from RegExr I have figured out that I need to use this expression: /\(.*M\)\s.*?:/gm What I need help with is how I gonna use this to place<b></b>around the matched text. Gratefull for help. ...

Prevent or clear HTML/CSS tags.

I'm developing a website using PHP, MySQL and HTML. In the database, one of the fields is a text that may contain HTML tags such as <b> or <i>, for example. My problem is that in a specific part of the website (a search section), I wanna display only a 'summary'/substring of this field. The problem is: when I get a part of this field t...

What datatype is this? is it wordpress specific ?

Hey can anyone tell me what datatype this is? it wont parse as i've stripped out sensitive data. Am I correct in thinking its json? a:7:{s:12:"competitions";a:893:{i:1;s:10:"Ersie";i:5;s:19:"General News"1510126584;s:0:"";i:1019;s:0:"";i:8284;s:0:"";i:191016;s:0:"";i:284;s:0:"";i:91019;s:0:"";i:81863;s:0:"";i:1563;s:0:"";i:7101...

Small Issue PHP Pagination Mathematics Help

I have a small problem with my PHP pagination, I have 6 records and I display 2 at a time, when I click on next and it displays from 2 to 4 records, that works fine, But to display from 4 to 6 records, that does not work. I am not sure what im doing wrong. Anyone have any ideas ? the problem is to do with the calculation for the Next rec...

Best DB abstraction class for PHP

I'd like to start building my own framework. Everything is fine, but I can't build the most important part (from my point of view): DB controller. I've seen so many project codes and some uses ADOdb, others have built its own. I don't want compatibility, just an easy class that obviously filters SQL injections but also allows the user t...

Issues when using multiple if statements in php

Hi All, I needed suggestions for the following scenario. I have a php variable called $data which holds a lot of information.I am trying to break up the data into fragments using the function explode. After exploding them into say n fragments, i loop through them and store around 50 lines in array1,50-100 lines in array2 and so on. ...

Is there a way I can perform one PHP function first and then execute another function after the first function?

Is there a way I can perform one PHP function first and then execute another function after the first function? ...

Can I programmatically determine what fonts I can use with GD?

I want to put text over an image using GD. When I use ImageTTFText($image, $fontSize, $fontRotation, 7, 22, $colorShadow, 'arial.ttf', $str); I get Warning: imagettftext() [function.imagettftext]: Could not find/open font in /home/index.php on line 17 Can I get PHP or GD to return a list of all available fonts per my s...

XML to PHP Array?

I am trying to edit an open source PHP wrapper to export an XML. Original: $new_invoice = array( array( "Type"=>"ACCREC", "Contact" => array( "ContactID" => "[contact id]" ), "Date" => "2010-04-08", "DueDate" => "2010-04-30", "Status" => "SUBMITTED", "LineAmountTyp...

How to enable IIS/PHP to supports multiple request from localhost?

I've build and setup site in IIS 6, with FastCGI and PHP 5.3. And I've built a page named data.php which will be accessed via these two URLs localhost/data.php?news localhost/data.php?article the problem is that I can't open one of them while loading another one. Suppose I'm accessing localhost/data.php?news in browser and it will ta...

How to run a command line script through a normal Zend Framework application

I am working on a ZF application that needs to run a command line script and then parse the results into something meaningful and return to the user. I know there are various PHP functions, like exec and system, but I was wondering if there is anything built into Zend Framework that does command line scripting easily. Even if there isn...

Hiding PHP Files Outside WWW for Security

I've got a "globabVars.php" doc in my own little framework that contains database connection vars etc... I'm thinking would be neat to store outside of the web facing directories to keep it a little more secure. But, then I was thinking, is it really THAT much more secure? I mean, if someone were able to look at my .php files as a whole...

PHP and JQuery Question.

Is there a way I can pass a PHP variable from a PHP page to a JQuery page and back to a PHP page? ...

What I have minus months in database (mysql), is it the php code?

Hi, Description: I am doing purchasing function, whenever the users make purchases, it will add 1 month privilege to my access special page of my site. I have received some complaints from my users, please read the problem section. Problem: Out of 500 users, there are few users, that for example: make purchase today, but the expirati...

PHP Scrapping methods and help?

Hello, I have a site http://www.coldwellbankerpbr.com/listings.aspx that I am trying to grab the listings from, now I need the address and bedroom details, etc however there is no unique identifier besides the text Address (which is repeated several times on the page) I was looking at PHP DOM however that seems to be more of a looking f...

Wordpress as cms for different page content per country.

Which plugin to use? I use wordpress as a CMS and was wondering which plugin I could use make 1 page with dynamic content for different selected country/per domain/URL? (I would like to have many versions of the same site where, some pages have common page content while other pages have different page content) ...

PHP using proc_open so that it doesn't wait for the script it opens (runs) to finish?

I've spent a while on this but can't get this to work, I apologize as I asked a somewhat related question about this earlier but deleted it so I could do more research to narrow down the question, at this point I am stuck as I thought I had the solution with this but its not working as I expect.. I found a forum where someone asked a sim...