Hey Guys,
Our application uses rewrite rules in our PHP application and our developer added these rewrite rule to our Apache VHosts file:
I have updated our Rewrite rules based on suggestion below.
Currently my VHosts file configuration looks like this:
RewriteCond %blog !-d
RewriteRule ^/([a-zA-Z0-9-,]+)/?$ /index.php?a=$1
Rewrit...
I have several drop lists where if no option is selected then the value is = ""...
I cant figure out how to build the query for mysql in PHP.
query = SELECT * FROM db
...
Ok, i have a problem here...
I am sending values of drop down lists via ajax to this PHP file.
Now I want to search a mysql database using these values, which I have managed to do, BUT, only if I set the values to something...
Take a look:
$query = "SELECT * FROM cars_db WHERE price BETWEEN '$cars_price_from' AND '$cars_price_to...
First, let me apologize for Yet Another Framework Question. But I think this is different enough from the usual "What framework should I choose?" to warrant it.
Here's my situation: For the past year I've been using a custom framework. It's been used on everything from small CMS's to larger sites and even a mid sized social network. It'...
When coding Visual Studio, I can have multiple website projects, and to switch between them is as simple as opening each website project on the local drive.
I'm confused at how CodeIgniter handles this, it seems the programming environment is the actual install location (doesn't really have a "project" concept), and how do I start to co...
DROP TABLE IF EXISTS `actividades`.`act_actividad_audit`;
CREATE TABLE `actividades`.`act_actividad_audit` (
`fe_creacion` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
ON UPDATE CURRENT_TIMESTAMP,
`usr_digitador` char(10) NOT NULL,
`ip_digitador` char(15) NOT NULL,
`id_act_actividad` int(10) u...
So I'm trying to install mcrypt on my local for development. I've never compiled from source before, so please bear with me, but the short of what I've done is:
Download and install libmcrypt-2.5.8 (from source)
Download compiled mcrypt.so from http://www.viames.it/mac-os-x.html (note: the compiled gd.so seems to work fine)
Update php....
Historically, I've always used
mysql_real_escape_string()
for all input derived from users that ends up touching the database.
Now that I've completely converted over to MySQLi and I'm using prepared queries with bound parameters, have I effectively eliminated the possibility of SQL injection attacks?
Am I correct in saying I no lon...
Using PHP, how can I verify if a phone # is well formed?
It seems easiest to simply strip all non-numeric data, leaving only the numbers. Then to check if 10 digits exist.
Is this the best and easiest way?
...
I've been reading up on how to do this all morning, and the general consensus is this: store your timestamps in UTC and calculate the offset from there.
However, like most people, I am maintaining an existing codebase and I can't change the way we store our dates. At least, not in the allotted time frame.
So my question is, can I safel...
I have the following PHP code:
foreach (...) {
try {
$Object = MyDataMapper::getById(123);
if (!$Object->propertyIsTrue()) {
continue;
}
}
catch (Exception $e) {
continue;
}
}
MyDataMapper::getById() will throw an Exception if a database record is not found. Here is the definition of that method:
public...
Given a $result from a SELECT query that returned 20 rows, what is the simplest way to accomplish what the comment sugggests in the loop?
while ($row = mysql_fetch_assoc($result))
{
// echo "success" when i get to the 9th row
}
...
Hey all
I'm trying to create a regular expressions that will filter valid emails using PHP and have ran into an issue that conflicts with what I understand of regular expressions. Here is the code that I am using.
if (!preg_match('/^[-a-zA-Z0-9_.]+@[-a-zA-Z0-9]+.[a-zA-Z]{2,4}$/', $string)) {
return $false;
}
Now from the materials th...
Several times I heard that PHP hosting is much cheaper than ASP.NET one. I decided to check it out and went to Google. But there are different categories of hosting (it can be expensive or not). There is a cheap ASP.NET hosting and expensive PHP hosting, and vice versa.
So I can't know exactly if there is a difference between their price...
Hi, I'm working on a basic php/mysql CMS and have a few questions regarding performance.
When viewing a blog page (or other sortable data) from the front-end, I want to allow a simple 'sort' variable to be added to the querystring, allowing posts to be sorted by any column. Obviously I can't accept anything from the querystring, and nee...
I'm finding that the PDO Transaction is only commiting 1 of my 2 SQL statement. For some reason, my PHP script is not inserting into my MySQL database 'homes' table BUT it does insert into the 'invoices' table - even though I'm using a PHP PDO database transaction.
Code below:
$conn_str = DB . ':host=' . DB_HOST . ';dbname=' . DB_NAME;...
This one should be easy, I think. I have a paginated image gallery, and under each image is a small link that says "Download Comp". This should allow people to quickly download the .jpg file (with a PHP generated watermark) to their computer.
Now, I know I can just link straight to the .jpg file, but that requires the user to have the i...
I'm working on a feature which requires me to get the contents of a webpage, then check to see if certain text is present in that page. It's a backlink checking tool.
The problem is this - the function runs perfectly most of the time, but occasionally, it flags a page for not having a link when the link is clearly there. I've tracked ...
how can i prevent a form to be submitted when it only contains a space? for example a user presses the space bar on a field, the space will be considered as a character so the forms submits. how can i prevent that in php?
...
I have historically used a monolithic approach to PHP coding.
That is, I write one index.php, with an average size of 70k-250k, and use
mod_rewrite
to turn the rest of the
REQUEST_URI
into parameters passed into the index.php to control what is happening.
The alternative would be to write many small php scripts, each specialize...