php

PHP SQL Pagination Problem

I can't seem to get the desired result. SELECT * FROM `messages` WHERE `msgType` = '0' AND `status` = '0' ORDER BY `dateSent` DESC LIMIT 20, 0 Basically I'm trying to show 20 results per page. But this query returns nothing. (For the record, all instances in the db have msgType and status as 0 EDIT: Removing the L...

[IMAGE] Magento Description/Attributes Replace?

I'm having trouble swapping Short Description (Quick Overview) with Additional Information (Attributes) Here's an image better explaining what I'm trying to accomplish: I posted links to CodePaste.net Here is my View.PHTML Here is my Attributes.PHTML Here is my Tabs.PHTML Here is my Catalog.XML I know most files posted are ...

Help Using RegexIterator in PHP

I have yet to find a good example of how to use the php RegexIterator to recursively traverse a directory. The end result would be I want to specify a directory and find all files in it with some given extensions. Say for example only html/php extensions. Furthermore, I want to filter out folders such of the type .Trash-0, .Trash-50...

export to epub format in php

Does anyone know of a php class that can create/export ePub files? I have a book stored in a mysql database and I wish to publish it as an ePub format book? It's a very basic book, simple text and chapters, and a few images. Any suggestions? ...

Check if string contains another string

Hello, In php is there a way i can check if a string includes a value. Say i had a string "this & that", could i check if that included "this". Thanks UPDATED: $u = username session function myLeagues2($u) { $q = "SELECT * FROM ".TBL_FIXTURES." WHERE `home_user` = '$u' GROUP BY `compname` "; return mysql_query($q, $this->con...

Get a users latest youtube videos?

I'm looking for a way get the following from a users youtube name or url. thumbnail link to video on youtube.com Title of the video Need to do it with PHP. Is there some youtube api I can use or is something like simple pie my best bet? ...

n*n table vs (n^2)*3 table in mysql

A while back I posted a different question regarding column order. While this question does not relate to column order, I was suggested to make my table differently from how I was making it. Lets say I am selling 100 products. Some of these products are compatible with each other, some are not. Some have not been tested yet (I did not m...

Loading pdf\doc\odt files with a form in a secure way

Hello everyone, I've been searching online for a secure way to load files in php but I couldn't find any convincing solution. What I'm trying to do is loading a curriculum vitae by form uploading. This file should be viewed only by the website admin (the form will mail him the link) and obviously the form should be secure (even thought t...

PHP Object question

Using a very simple set of objects for this example in PHP. Lets say: ObjectA: Properties: DescId; Methods: getListofData(); ObjectB: Properties: DescId;DescName; Methods: getDescNameById(); What I want to know is what is the best way to get the DescName from ObjectB when ObjectA is the one calling the function from within a lo...

Can a model house multiple functions querying different domains?

I have a domain for users that connects to my user table, which includes information like username, first name, and last name. Then I have a domain for emails, that connects to the email table because a user can have more than one email. The email table consists of a fk to connect the user with their emails, and other fields like addres...

Error while trying feed a class parameter in php

Hi every one! i declared classes like this: class Foo{ public function __construct(){ echo 'Foo was created!';} } class Foo2 extends Foo{ public function __construct(){ parent::__construct(); echo 'Foo2 was created!';} } class Bar{ public function __construct(Foo $foo){ echo 'Bar was created!';} } in main code: $foo2 = new Foo...

Is it advisable to use serialize() to persist an object across multiple requests?

In a project I'm working on, I have an object that is a sort of Collection with a database back end. The exact results this Collection returns are dependent upon its configuration, which is itself dependent on a number of user inputs. I would like to have an element on the page that contains the records in the Collection and can be upd...

Simultaneous AJAX Requests and PHP Sessions

I'm having a peculiar problem with making simultaneous AJAX requests that modify a PHP object stored in the session. I'm having problems with race conditions but I don't understand why they're happening... only one AJAX call can have the session open at a time, so if they keep the session open while making modifications, shouldn't each c...

Redirect PHP page to IMG

I have a blog background website. We provide some HTML code that the user can insert into his page, and it has something like this: <img src="http://site.com/img.jpg" /> Unfortunately, I have had to relocate the images from time to time. Each time I have to relocate the image, the image no longer works for the people who have put the...

how can I find out if a method exist for a doctrine model in symfony?

I have a doctrine model that has a method getSomethingId() and I'm making something of an automated form generator for internal use in the company how can I check if my model has this method? I've tried with php's method_exists but it returns false for every method, what can I do? thanks ...

php script that calls itself when it is finished - indefinately.

I have a php script that can take anything from 2 to 10 minutes to execute. It fetches info from around the web so its time depends on how fast lots of other things are talking. I used to run the script on a cron every 15 minutes, but sometimes it only takes 2 minutes to run. So I wondered if I can somehow make it run perpetually - set...

Php Download script isn't working

Hi guys, I have a script which uploads files into an online directory and stores the file details in a database. The files when stored are renamed to the id of the entry in the database. Whenever a user requests a download, a simple SQL statement retrieves the file details from the database, the contents of the file are read from the da...

jquery send the dropdown html

this is a nutts job here. Not sure if jquery can handle this. I have a php page called page1.php where I have drop down like this <select id="startRecord" > <option value="0"></option> </select> Now I caclulate some values here and then send the values to page2.php. Now on page2.php I do some more caclulations and rum a query. If...

PHP sending HTTP_POST_VARS to another page?

Whats the best was of doing this? Sessions? How can I take all my variables defined on 1 page and send them over to another. I read using serialize convert the HTTP_POST_VARS to a string, and then pass that (using a hidden form/input?) and use unserialize on the other PHP page to get the variables back. Also I saw someone just use s...

IF statement not running in PHP

I have a code to declare a variable and then an IF statement which uses that variable to either display, or not display an image. This code is before HTML <?php $contents = file("textdocument.txt") ?> This code is in the HTML <?php if ( $contents = 10 ) { echo '<img src="image.png" name="image" border="0">'; } else {echo "wrong num...