php

Zend Forms Module Include Paths

I'm using Zend 1.8.4 and setting up a simple form test. My form class is located in './application/forms/SectorSearch.php' and the class name is <?php class Form_SectorSearch extends Zend_Form {...} My controller creates a new form in the init() method <?php class SectorController extends Zend_Controller_Action { function init() ...

I'd like to implement dynamic hyperlinks based on keywords, but how.

I have a database table full of words. What I would like to do is to have a way to show the user in the html in the form of a hyperlink, any of these keywords. Kind of like you see on many forums now a days. When a keyword is noted in the html, it becomes clickable. Is there a way to do this? I'm using php. Thanks ...

appoint class to PHP table with results from MYSQL db help...

no border shows up when setting style in the table row below, inside the while loop? why? Background color setting works fine, but not this... NO BORDER SHOWS UP... // Build Result String $display_table = "<table>"; while($row = mysql_fetch_array($qry_result)){ $display_table .= "<tr style='border-top-width: thin; border-top-style:...

how to loop through associative array and echo out to list?

Hi I have managed to get my first array working but no matter how many code examples I try I cannot step through each array row and echo the three columns / elements out to a . The var_dump of my array is:- array(27) { [3]=> array(3) { ["id"]=> string(3) "295" ["title"]=> string(24) "ask.sqlservercentral.com" ["questions"]=> in...

Deleting portion of a text string in PHP

I've constructed a form, but some rows of the form can potentially be returned blank, with default values. I'm trying to find a way of searching the form output and then deleting the bit which I know is not needed - which looks like: <tr bgcolor="#FFFFFF"> <td>2E</td> <td id="8003">-800</td> </tr> I've used str_replace() effectively o...

something i missed here, style in PHP table row works partly!

no border shows up when setting style in the table row below, inside the while loop? why? Background color setting works fine, but not this... NO BORDER SHOWS UP... // Build Result String $display_table = "<table>"; while($row = mysql_fetch_array($qry_result)){ $display_table .= "<tr style='border-top-width: thin; border-top-style:...

PHP Image uploading - uniqueness via microtime()

If I make the filename of each uploaded file PHPs microtime(), are the risks of a collision realistic? And is there a way to further randomize the filenames? I'm expecting about 20,000 uploads in about a week. That's 2800/day or 119/hour (assuming even distribution). Does anyone have any experience with assuming microtime to be unique? ...

Joomla Image Renedering extension with JFactory access

Is it possible to write an extension for joomla or use some existing plugin similar to jumi to be able to render for instance a png image but with full access to user data (with JFactory)? In other words today it's not a problem to create a php script that renders a public image based on parameters passed. But if I want to access user da...

problems with text parsing using preg_split

Hello! I write some easy parser for my page and have some problem with it. HTML text: <p>some text</p><p>another text</p> If I try use something like: preg_split("#<p>#",$string); I have a result without <p>, and this is very very bad. (only </p> exist) Maybe I can split this string to array, but don't remove </p>? ...

twitter api post being cut off

I use the below code to post updates to twitter: // Set username and password for twitter API $username = '***'; $password = '***'; // The twitter API address $url = 'http://twitter.com/statuses/update.xml'; // Alternative JSON version // $url = 'http://twitter.com/statuses/update.json'; // Set up a...

PHP form validation + cookies = Firefox cache problem?

I have a simple form validation class in PHP. It works like this: A: form page that POSTs results to VALIDATION page VALIDATION: checks results. If wrong, set cookies with the name of the fields that are wrong and the message for each input error. Go back to A form page by using headers location property. A: if the cookies are present...

How to use jQuery AJAX $.post to store PHP $_SESSION variables?

Help! I'm having trouble wrestling AJAX to work for me. I have a paginated gallery with checkboxes beneath each image and I need to store the checkbox values in session variables if a user moves between the pages, so when they submit the form at any time it will include all checked values across all pages. I'm using this jQuery code: ...

properly endcoding & for twitter post

My automated call to the Twitter API causes problems when my update string has a & in it. How do I properly encode my update string $update that contains a & before I use CURL to call the Twitter API? // Set username and password for twitter API $username = '***'; $password = '***'; // The twitter API address $url ...

Working with multiple jquery-ui-dialogs

Hi, I have a table with a lot of text inputs like these: (they are marks of tests for a few students). Every field has an associated icon for adding a comment, so when the icon is clicked, a dialog must be shown with a textarea, and then save its value to a hidden input. An example of a mark field: <input class="num" type="text" si...

Object Oriented Programming accessing variable values, How to?

Hello, I am a learner, I have a class db to help me connect and fetch results in mySQL. $set = $db->get_row("SELECT * FROM users"); echo $set->name; this way i use echo results outside a class. Now i have created another class name user and it has this function public function name() { global $db; $set = $db->get_row("S...

Use of any class / namespace with ZendFramwork

EDIT: Additional questions: do I have to add the '.php' at the end of new NAMSPACE_CLASSNAME Can I access any Zend package inside my controller / model, for example: /* Controller // Methods // inside a */ method $client = new Zend_Http_Client('http://example.org', array( 'maxredirect...

CakePHP session/auth logging out intermittently

I'm having reports and complaints from my user that they will be using a screen and get kicked back to the login screen immediately on their next request. It doesn't happen all the time but randomly. I am using CakePHP and the Auth component, which seem to work well other than this issue I got some feedback on the Cake forums once tha...

Large .PDF Files Not Uploading To MySQL Database as Medium BLOB Via PHP, Files under 2MB Work Fine

I am developing a PHP script for uploading .PDF documents as medium BLOBs into a MySQL database via PHP. The script also allows users to search for files and open/download them but I do not think that part of the script is relevant to my issue. The script works fine with files less than 2 MB but as soon as I try and upload a file that ...

Extract filename from HTML text using regexp

I have this HTML code (just an example): Sem vestibulum blandit nostra, nullam imperdiet, pellentesque vel wisi sit fusce purus mi, porttitor lorem. Bibendum non phasellus ut ipsum massa sed, interdum per, facilisis facilis luctus fermentum et donec, tristique tristique non.</p> <p align="justify"><a class="nemo" href="http://myserver.c...

PDO in PHP, how to improve this PDO mysql code

Thanks for checking. All helpful answers/comments are up voted. I have the following code, which does the job, but imo is not efficient. The reason I think it's not efficient is because I'm using fetchAll + loop even though I know that the query will return either 1 or no records. //assume the usual new PDO, binding, and execute are up ...