Questions about PHP, a widely-used general-purpose scripting language that is especially suited for Web development.

learn more… | top users | synonyms

0
votes
0answers
23 views

Html/php script (POST method) works on local host but doesn't do anything on my hosting website

I want to make a script for my website that it shows a form and a visitor can write his email and a message this is the code: <html> <head> <title>Feedback</title> ...
0
votes
2answers
29 views

Encapsulation: Separate functions for separate variables, or return a table? [PHP]

I have been making a website with PHP and I have a few classes, so far none of them really follow encapsulation rules of OOP. Lets say I have a user class like so: class User{ public $username; ...
-1
votes
0answers
5 views

Cannot pass CasperJS result back to PHP [migrated]

I am trying to pass CasperJS results to PHP but it's not working (the output is empty). Here is my code: <?php exec("casperjs test.js", $array); print_r($array); ?> The exec works for any ...
0
votes
1answer
26 views

Storing and accessing settings from database query

I am trying to figure out the best way to accomplish this so feel free to criticize my thought process. My tool has different locales and each locale can have different settings for the tool. For ...
5
votes
2answers
184 views

How to handle a vendor who asks for the solution of an issue they could not solve

Being a small department of developers, it's not uncommon for us to outsource projects. We have a set of companies that we really like to work with, very reliable and good local people who appreciate ...
1
vote
1answer
95 views

API Key DDOS protection

Hi I just wanted some feedback on a DDOS preventing php script that I'm designing. It is quite simple and I wanted some feedback on whether you guys think it would be effective. I'm currently using ...
2
votes
2answers
153 views

Best pratice for return json in a REST application?

I'm starting now with REST (using Laravel 4.2) and Mobile (Android, iOS, SP, etc.) applications. Initially I'm checking if the request is ajax/json and then return a json response. But this ...
0
votes
0answers
66 views

When to use packages or Repositories in Laravel?

I'm a Laravel (PHP) developer, and new with DI, Packages (workbench) and Repositories (Pattern). I want to know about the best concept/methodology for a more flexible design; ie. the project can grow ...
-1
votes
0answers
30 views

How to list sub-categories when a parent category is selected? ( PHP MySQL ) [on hold]

So here's my situation I am working on MVC Patern. It's not any framework. It's just a basic setup of MVC done by myself. I am building a classifieds Ads Website. There are some categories and some ...
0
votes
1answer
32 views

Roles configuration strategy

We're close to start new project using sf2, and, probably, FosUserBundle. Keeping that in mind - what's the best strategy to define roles? App will be used by multiple divisions inside our company ...
-1
votes
0answers
44 views

How can we create a desktop based application in php? [duplicate]

I this possible to create a web based application in php if we can please provide me some link of that app also if applicable in youtube provide me youtube link. My search: I search on google and ...
2
votes
3answers
99 views

Multiple many to many relations or one option table?

Let's say I have a database of persons who have some properties. For the sake of this problem let's say all of these properties relate as N-N. I can either create two tables for each property (one ...
-2
votes
0answers
18 views

Google App Engine File Upload Error - PHP [closed]

PHP Warning: File Upload Mime headers garbled in Unknown on line 0 When i am trying to submit form with large data in texarea and uploading image also.
0
votes
1answer
49 views

How can I configure updates in a CMS like WordPress?

I have a CMS built in core PHP. Till now, if a new version is released, it is downloaded to client machine in zipped form. And then client has to manually unzip the folder and copy that to required ...
0
votes
0answers
15 views

MYSQL selecting multiple rows of same type [migrated]

From this MYSQL table which has several hundred cities divided into different sets, I need a page to display a clickable link pertaining to each set (i.e. set 1, set 2 etc.) in a list and when one is ...
0
votes
0answers
40 views

PHP: frequent file system write

I am building a game based on PHP and MySQL. Basically there is a player-vs-player mode but I figured I should add a player-vs-computer mode as well, since players may not be online at all times, ...
2
votes
2answers
98 views

I have a legacy project that I'm working on, how should I improve its structure?

I have a slightly old PHP project I'm working on for a client (I think it was started around 5 years ago), it makes extensive use of the outmoded mysql_query function, which is concerning not only ...
0
votes
0answers
41 views

Zend framework 2 authentication - only storing the user ID in session

I've just put together my first app using Zend_Authenticate. According to some tutorials I've read they store the user's "email" column. Is this recommended? I've read to store the ID only, then on ...
0
votes
0answers
44 views

Database auto Increment primary key as a foreign key in another table [closed]

So right now I have one table user with primary key userID, this primary key is cross referenced with another table Sets where userID is a foreign key (the set belongs to the user)- Autoincrementing ...
0
votes
0answers
21 views

Are Components ideal for packaging and reusing find() requests?

I find myself loading several models over and over again throughout my application. Instead of typing the code to load the model, run a find, would it be reasonable to put that code in a method and ...
0
votes
0answers
17 views

Should I use session or cache to keep the time it last polled when polling to server at intervals?

I'm building a web chat app using session to keep the time the app last polled so that the server can determine whether messages exist between the current polling time and last polling time. It works ...
0
votes
1answer
135 views

How can I fetch data from more than one web services simultaneously in PHP?

I have 3 web services that are providing me data for my hotel booking engine. It is taking too long if I run them sequentially. Therefore I wanted to run them using threads, but I am not sure if php ...
9
votes
6answers
2k views

Can someone help me understand MVC? [duplicate]

I've read a few articles on the MVC pattern and tried to understand what it exactly is. But till now, what I get is a plain diagram showing 3 modules of Model, View and Controller. Some say that it ...
1
vote
0answers
47 views

PHP Framework that favors better general habits over convention

This is intended as an objective question. I've been reading about most of the Frameworks for PHP. We use Cake at work, and I've had exposure to CodeIgniter and Symphony. They all have their own ...
0
votes
0answers
25 views

Deleting dynamic elements from a database

I have a select dropdown, with '+' and '-' buttons that add and remove items before submission. I would like to be able to remove the elements with the '-' button after they have been added to the ...
0
votes
0answers
22 views

Verifying and insertion of details in db [migrated]

I need to insert the details (name, id , number )of many documents into database if they are not already existing and if they exist i just need to do a update for any changed information. I have ...
0
votes
0answers
43 views

How to loop through a foreach in php? [migrated]

I need to retrieve day and amount data according to car name. i managed to retrieve carname,car image using foreach and while loop but I'm unable to loop through day and amount of rental for that car. ...
2
votes
1answer
156 views

PHP Cache Strategy - Genius or Sheer Stupidity?

I have a shared hosting with limited capabilities. Memcache and mod_cache are not available to me. I would like to implement my own PHP caching method to cache the results of load-intensive SQL query. ...
0
votes
0answers
20 views

Can't post data to php, Can't see why [migrated]

I have some data from a form that is being sent to a php script to send an email, it is from a template but I think it is wrong. I have isolated the part of the code that is to blame. The specific ...
-1
votes
1answer
30 views

Load partial data and data sorting [closed]

I have one database table that I query on load and display items in a list sorted out by dates (latest first). However, as the table may become quite big, I only fetch the n first rows. To see more ...
0
votes
2answers
117 views

Is there a better way to load objects?

I have always kept the code to load an object within the object itself. That way no matter what method is creating the object, it always has access to the method to load the object. However this does ...
0
votes
0answers
26 views

Rendering STL file to STL viewer which is in new page

I've uploaded a STL file as an additional file for a product. And it gets downloaded in frontend as shown in screen shot. When I click on that link for STL Downloader, then that STL file will be ...
0
votes
1answer
29 views

Creating a voting platform for submissions during timeperiod

I have a site where stories are submitted at any time by users. The staff would like the ability to create a voting period at any time. For example, they can choose to open up voting from today until ...
1
vote
1answer
142 views

What is the simplest archive file format to aim for when writing collections of files?

I've created a PHP-based document management system and hosted it on my Raspberry Pi. I created a "backup" function that zips together all the documents, but it takes too long due to the hardware ...
3
votes
2answers
242 views

What's a good simple way to combat the n+1 problem?

I'm trying to better understand performance in PHP. One issue I'm thinking about is the n+1 problem. By n+1 I mean something like this: $posts = Posts::getPosts(); foreach($posts as $post) { ...
2
votes
2answers
249 views

Repository pattern implementation that knows nothing about the database table and column names

I've seen around the Internet and Github, implementations for the design pattern Repository that knows about database table and column names. I was think, if I want to work with the database as a ...
-1
votes
1answer
77 views

PHP4 constructor does not work with namespaces [closed]

Here's a scenario: whenever accessing class using namespaces in php, it doesn't launch the standard constructor, but only the 'magic' method. What's wrong here and what can be fixed? hierarchy ...
0
votes
0answers
28 views

Doctrine 2 and Concrete table inheritance

I use Doctrine 2 and I've read some articles on inheritance strategies' mapping with ORM. I've seen three main strategies : "Class table inheritance", "Concrete table inheritance" and "Single table ...
0
votes
1answer
74 views

How can I cancel all running mysql queries in a web application?

I am running a web application which has to scan (mysql query on a particular column) a huge MySQL table, which has over 100,000 records. The problem I find that when a user requests another page ...
-3
votes
0answers
19 views

Regular expression(preg_replace) in php [duplicate]

I tried below code for replace some text with regular expression pattern..but i cant get properly: Following scenario: My input 'the is good [[text]] [[link1|text1]] [[link2|text2]] [[text]]' ...
1
vote
1answer
129 views

AJAX or web sockets for client-server communication?

I recently took a course on AngularJS, and quite frankly I loved the concepts of a website that fetches json to handle subsequent requests, however I still feel like Javascript is far too slow for ...
1
vote
2answers
129 views

How do two applications communicate? [closed]

Say I had a PHP page with a calculator interface, but I want to transfer the sum to Windows Calculator.exe and then get a reply from the application back to my PHP page, how do you go about doing ...
-2
votes
0answers
11 views

Convert symbols to html tags in php [migrated]

<?php //Read file $file = 'sample.txt'; $file_copy = 'sample1.txt'; $homepage = file_get_contents($file, NULL, NULL,10); echo htmlspecialchars($homepage); //Write file $current = ...
1
vote
1answer
68 views

Repository Pattern: Doctrine2 vs Microsoft Entity Framework?

I have been using Symfony2 with Doctrine2 for some years. I have recently started using Microsoft's Entity Framework with MVC5. From my Symfony2 experience I understand that a repository's job is only ...
1
vote
0answers
133 views

MVC content management framework with an admin panel

I've lately been developing my own MVC content management system using PHP and, at least in my mind, am a little stuck with the system design. I believe this would apply to building a content ...
1
vote
1answer
153 views

Should we live by using Suhosin with PHP?

A lot of my security experienced friends have told me that I need to code my web applications for working under the Suhosin PHP patch, Suhosin being "an advanced protection system for PHP ...
0
votes
0answers
54 views

PHP Password_Hash Function [migrated]

I've been reading up on the usage of the PHP Password_Hash Function it states that it automatically generates a salt and manually generating one is not advised. With this in mind, does this mean I ...
2
votes
0answers
79 views

Use and manage Front End Assets for Web

I am a beginner and am currently developing a kind of cms using PHP. The number of libraries that we can potentially use in the front end is large. I have a question about properly selecting, ...
-1
votes
1answer
82 views

Cloud Newbie … what should I know while creating my App [closed]

I never developed for the Cloud, and to tell you the truth I am not fully 100% sure of what Cloud is when coming down to servers and services. I am starting to develop an App where I will need to be ...
-1
votes
2answers
178 views

Is PHP the only popular language that mixes simple and associative arrays into a single type? [closed]

I'm doing a research on PHP and wondering if there any other commonly used programming langues that use an associative array for both simple indexed element storage and key-value functionality. Does ...