php

php / ajax... Printing results from function on page onclick?

Honestly, I'm not even sure the best way to go about this, but essentially, I have a function in an include file that takes a $type parameter and then will retrieve/print results from my db based on the $type passed into it... What I'm trying to do is have a series of links on a page that, when you click on a certain link, will run the ...

Best practice: Import mySQL file in PHP; split queries

I have a situation where I have to update a web site on a shared hosting provider. The site has a CMS. Uploading the CMS's files is pretty straightforward using FTP. I also have to import a big database file (Around 2-3 MB uncompressed). Mysql is closed for access from the outside, so I have to upload a file using FTP, and start a PHP s...

go-pear.bat file won't install PEAR at all.

I just made a new install of WAMP on Windows 7 and I'm trying to get PEAR to work. Things are going wrong from the very beginning. When I try to execute the go-pear.bat file, it shows me this. phar "C:\wamp\bin\php\php5.3.1\PEAR\go-pear.phar" does not have a signature Warning: require_once(phar://go-pear.phar/index.php): fail...

flex 3 retrieving colors values from MySql database with AMFPHP to style flex 3 Components at runtime

Hello Stackoverflowers, I'm making a social community application with profile. User must be able to style their profiles. That's why i'm looking for a way to store and retrieve color values from a MySql database to style flex 3 components at runtime. Does anybody know how i could accomplish this. (I don't want to use Runtime css swf s...

Ajax - php - mysql - checkbox

I am trying to create a dynamic system with check boxes for an web based game that I am trying to make using Ajax, PHP and MYsql Is there a possible way to detect whenever a checkbox is selected/unselected, pull up information from the database and display information based on user's selection dynamically on the website without refresh...

MVC controller jobs?

My MVC controller is in charge of passing desired onload javascript to my view object which inserts it into the bottom of my main page template. My question is...should I store the actual onload js scripting in my controller, or should i store it in my model, and have the controller pull it from there? My confusion is rooted in the fac...

PHP: Storing file locations...what if overwritten?

I am currently using the Zend Framework and have an upload file form. An authenticated user has the ability to upload a file, which will be stored in a directory in the application, and the location stored in the database. That way it can be displayed as a file that can be downloaded. <a href="/upload-location/filename.pdf">Download</a>...

Good PHP & MySQL book that shows how to build a rating system?

Looking for a good PHP & MySQL book that will show me how to build a rating system the correct way. ...

Removing array item by value

Hi I need to remove array item with given value: if (in_array($id, $items)) { $items = array_flip($items); unset($items[ $id ]); $items = array_flip($items); } Could it be done in shorter (more efficient) way? ...

PHP Cannot escape my string properly

I'm using mysql_real_escape_string to escape my content but I am receiving an error in a SQL INSERTION QUERY for having a single-quote unescaped. How can I resolve this? $content = mysql_real_escape_string("'content'",$conn); The error message I am receiving is: You have an error in your sql syntax near 'content My SQL Query ENDS U...

PHP, Zend Framework: How to set the upload max filesize?

I'm setting the upload max filesize in my form: $file = new Zend_Form_Element_File('file'); $file->setLabel('File to upload:') ->setRequired(true) ->addValidator('NotEmpty') ->addValidator('Count', false, 1) ->addValidator('Size', false, 10485760) //10MB = 10,485,760 bytes ->setMaxFileSize(10485760) ->setDestinat...

English/Arabic Encoding Problem

Hi I am designing a web page this web page should support English and Arabic languages my problem is : Arabic characters doesn't appear in its way it appears some thing like that "أهلاً يا معلم " I have tried to change the encoding of this page with the following tag <META CONTENT="text/html; charset=windows-1256" HTTP-E...

PHP: mail() vs SendMail

a simple question: which one has good performance for sending mails in bulk? mail() function or sendmail which one is used by popular PHP list manager packages? ...

Model class not found

I am trying out cakePHP so I have a very simple site. I get the following error. class Tag extends AppModel { $name = 'Tag'; } Fatal error: Class 'Tag' not found in /home/downtown/public_html/test_cake/cake/libs/class_registry.php on line 140 in ..\app\models\tag.php I have class Tag extends AppModel { $name = 'Tag'; } What s...

Zend Framework load plugin

I am trying to load a Plugin but I get the following error: Fatal error: Class 'Site_Plugin_ViewSetup' not found in C:\dev\library\Zend\Application\Resource\Frontcontroller.php on line 92 I configured the file (last line): [production] includePaths.library = APPLICATION_PATH "/../lib" bootstrap.path = APPLICATION_PATH "/Boot...

PHP: How to rename a file uploaded with Zend_Form_Element_File?

Form: //excerpt $file = new Zend_Form_Element_File('file'); $file->setLabel('File to upload:') ->setRequired(true) ->addValidator('NotEmpty') ->addValidator('Count', false, 1) ->setDestination(APPLICATION_UPLOADS_DIR); $this->addElement($file); Controller: //excerpt if ($form->isValid($request->getPost()) { $newFi...

PHP4 constructor naming convention in PHP5

Aside from the "you won't have to change the name", is there any real problems with retaining the PHP4 style constructor names: ClassName($args) in PHP5? ...

mysqli_field_type returns a number

When I call mysqli_field_type it returns a number, which I assume relates to the type. Does anyone have a list of types and their corresponding numbers? I am in particular trying to find out if the data type is numerical or text (if that makes a difference). ...

Is there a possibility of there ever being a PHP.NET?

Sorry if this is a silly and/or stupid question but... Will there ever be, or would it even be possible to have a PHP.NET? Or have I got the wrong end of the stick? It seemed to me that one of the main points of .NET was that you could write your code in one of a bunch of the .NET languages and have it compile into CLR. Could this happe...

PHP can include Text/HTML from CGI but not from Text/CSS ?

There's no problem to include cgi output with php except when it is Text/CSS. I tried to do so with: <?php echo system('./cgi-bin/stylegallery.cgi'); ?> As you can see here, it returns blank: http://reboltutorial.com/gallery/stylegallery.php whereas the cgi is returning something: http://reboltutorial.com/cgi-bin/stylegallery.cgi I ...