So I'm going to be working on a home made blog system in PHP and I was wondering which way of storing data is the fastest. I could go in the MySQL direction, or I could go with my own little way of doing it which is storing all of the information (encoded in JSON) in files.
Which way would be the fastest, MySQL or JSON files?
...
Hi,
I'm using the data mapper pattern in a PHP app I'm developing and have a question. At present, you request a Site object with a specific ID and the mapper will lookup the row, create an object and return it. However, if you do this again for the same Site you end up with two different objects with identical data. eg.:
$mapper = new ...
Hi,
I have a php site about to go live (With Flex on the UI side) and was wondering what my options are for monitoring. I'm looking for some form of api which is the equivalent to .NET performance counters/ASP.NET health monitoring.
Ideally, I would like to get stuff like requests queued/responses served in ms, and related stats so I c...
I am making a litte php-file to log some ip addresses. It is going to write the ips and date/time into a html-file. The html-file is going to be a table. So I want to mak it like this:
<table cellpadding="6" rules="groups" frame="no">
<thead>
<tr><th>IP</th><th>Date</th><th>Time</th></tr>
</thead>
<tbody>
<tr><td>192.168.0.1</td><td>3...
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/a9184872/public_html/test_forum/admin.php on line 158
I get that error when I try to run my script. I read that the error is sometimes caused by lines before the line stated so here are lines 154 - 160.
if(strlen($desc) > 255){
echo "The description must be ...
If have a problem on my site that users can post empty messages if they use space.
Code:
if (isset($_POST['submit'])) {
// check for empty fields
if (empty($_POST['headline']) || empty($_POST['text']) ||
empty($_POST['forum_id'])) {
header("Refresh: 2; url=/add-thread");
die('You must fill out every field.');
...
I have my own php data object class that wraps the mysqli library. It works fine handling most datatypes, including text. As soon as I change a table column from text to mediumtext, I get the error described in the title of this question. I've tested my php scripts on several shared hosting environments, and I only get this error on o...
Let's say I have a database table "widgets"
Should there be an index.php with a big switch statement for different actions, like "list_widgets", "edit_widget", "new_widget", "delete_widget"... and then each of those actions in a separate file?
Or, should there be list_widgets.php, edit_widget.php, delete_widget.php....
Or some other ...
What is the best way to stop bots, malicious users, etc. from executing php scripts too fast? Is it ok if I use the usleep() or sleep() functions to simply do "nothing" for a while (just before the desired code executes), or is that plain stupid and there are better ways for this?
Example:
function login() {
//enter login code here
}
...
I have a widget that people can put in their site.
The widget is generated via php script that echos the populated string using: document.write('$widget_output').
The hosting sites call to the widget using a javascript tag:
<script type="text/javascript" src="http://www.link.com/page.php?param=1"></script>
The problem is t...
As you probably know, Derek Sivers is the guy who created CD Baby and eventually sold it for some big bucks. He wrote it in PHP originally and then down the road set about rewriting it in Rails. His troubles are the stuff of legend:
7 reasons I switched back to PHP after 2 years on Rails
That article came out in 2007 but being newly in...
Hi,
I have a site developed in ASP.NET and hosted on a windows server using shared windows hosting account at godaddy.
I developed a replica of my website in php and hosted my php site on a free hosting service (php, linux, mysql) and its working fine. This is on a shared subdomain. Example (mysite.freehostprovider.com)
Now I want to ...
Hi,
I want to execute an SQL query like:
select 'tb1'.'f1','tb1'.'f2','tb2'.'f1' from 'tb1','tb2';
Now the problem is that i want to put it into an array in PHP like:
$result['tb1']['f1'], $result['tb1']['f2'], $result['tb2']['f1']...
Any idea how to achieve the above? Afaik there is no function which does the above. I was wond...
I have 2 tables:
posts
tags
Tags table is structured like this:
post_id
tag
So for every tag that's given for a post, I create a record in the tags table. If a post has 10 tags, there will be 10 records in tags table with that post_id.
I'm now trying to build a search page where users can do a search for posts where tags do not ...
Hi all,
I am working on a Moodle project and I have downloaded and installed the latest build(1.9) on my system. I'm using this framework for the very first time so presently trying to get familiar with the environment and the documentation.
My need is to embed an iCal kinda calendar on Moodle's front page using the PHP iCalendar API. ...
Is it a good practice to bootstrap your PHP application.
I found two ways to bootstrap my PHP application. Need some suggestions which is a better way.
First.
Define a constant for the folder structures
$controllerPath = 'controller';
define('CONTROLLER', str_replace('\\', '/', realpath($controllerPath)).'/');
//usage
require_once CON...
We have OCRed thousands of pages of newspaper articles. The newspaper, issue, date, page number and OCRed text of each page has been put into a mySQL database.
We now want to build a Google-like search engine in PHP to find the pages given a query. It's got to be fast, and take no more than a second for any search.
How should we do i...
Hi,
I'm having an PHP application running on IIS7. I want to secure particular folder by modifying web.config. I don't want to use tag in config as this will redirect users to login page. Rather then, I'd like to implement HttpNotFoundHandler.
Say for example, http://domain.com/SecureFolder is the directory on which I want to implemen...
How would one go about implementing a "who's online" feature using PHP? Of course, it would involve using timestamps, and, after looking at phpBB's session table, might involve storing latest visits in a database.
Is this an efficient method, or are there better ways of implementing this idea?
Edit: I made this community wiki accidenta...
I am doing an HTTP POST using cURL
$url = "http://localhost:8080/~demo/cgi-bin/execute/100";
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,count($data));
curl_setopt($ch,CURLOPT_POSTFIELDS,$data);
//execute post
$result = curl_exec($c...