I am trying to set a flag to show or hide a page element, but it always displays even when the expression is false.
$canMerge = ($condition1 && $condition2) ? 'true' : 'false';...<?php if ($canMerge) { ?>Stuff<?php } ?>
What's up?...
Over the course of your web development experience, what PHP framework(s) have you worked with? What strengths and weaknesses have you observed in those frameworks? Considering these, what framework would you recommend if beginning a new application?
...
Even though I have a robust and fast computer (Pentium Dual Core 2.0 with 2Gb RAM), I'm always searching for lightweight software to have on it, so it runs fast even when many apps are up and running simultaneously.
On the last few weeks I've been migrating gradually to Linux and want to install a free lightweight yet useful IDE to prog...
I am getting the following error:
Access denied for user 'apache'@'localhost' (using password: NO)
When using the following code:
<?phpinclude("../includes/connect.php");$query = "SELECT * from story";$result = mysql_query($query) or die(mysql_error());echo "<h1>Delete Story</h1>";if (mysql_num_rows($result) > 0) { while($row =...
Ok, heres one I've been saving for the day SO comes through.
Ive always been a Zend Studio user (PHP developer here, 5 years self taught). Just fairly recently Zend introduced an Eclipse version of Studio which, albeit a lot easier to install I keep hitting walls when it comes to setup, some things are just 20-click retarded (e.g. confi...
I'm trying to write some php to upload a file to a folder on my webserver. Here's what I have:
<?phpif ( !empty($_FILES['file']['tmp_name']) ) { move_uploaded_file($_FILES['file']['tmp_name'], './' . $_FILES['file']['name']); header('Location: http://www.mywebsite.com/dump/'); exit;}?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1....
In a language such as (since I'm working in it now) PHP, which supports procedural and object-oriented paradigms, is there a good rule of thumb for determining which paradigm best suits a new project? If not, how can you make the decision?...
I have a directory structure like the following;
/script.php
/inc/include1.php
/inc/include2.php
/objects/object1.php
/objects/object2.php
/soap/soap.php
Now, I use those objects in both script.php and /soap/soap.php, I could move them, but I want the directory structure like that for a different reason. When exe...
Is there a tool for PHP which can generate code for consuming a web service based on its WSDL? Something comparable to clicking "Add Web Reference" in Visual Studio or the Eclypse plugin which does the same thing for Java. ...
When asked to create system XYZ and you ask to do it in Python over PHP or Ruby, what are the main features you can mention when they require you to explain it?...
We have a php project that we would like to version control. Right now there are three of us working on a "Dev" version of the project that all have our Eclipse linked to it with just an external folder, and thus no version control.
What is the right way, and what is the best way, to version control this (not necessarily the same I dont...
I'm wanting extra security for a particular point in my web app. So I want to lock the database (SQL Server 2005). Any suggestions or is this even necessary with SQL Server?
Edit on question:
The query is failing silently with no errors messages logged, and does not occur inside of a transaction.
Final Solution:
I never was able to s...
I'd like to set up a cheap Linux box as a web server to host a variety of web technologies (PHP & Java EE come to mind, but I'd like to experiment with Ruby or Python in the future as well).
I'm fairly versed in setting up Tomcat to run on Linux for serving up Java EE applications, but I'd like to be able to open this server up, even j...
Without using a big framework whats a good standard starting layout for code being written in php?
update: Directory layout, code flow, etc....
This is how I wanted to do it which would work in PHP 5.3.0+
<?php
class MyClass
{
const CONSTANT = 'Const var';
}
$classname = 'MyClass';
echo $classname::CONSTANT; // As of PHP 5.3.0
?>
But I'm restricted to using PHP 5.2.6. Can anyone think of a simple way to simulate this behaviour without inst...
I know that just using rand() is predictable, if you know what your doing, and have access to the server.
I have a project that is HIGHLY dependent on choosing a random that is as unpredictable as possible. So I'm looking for suggestions, either other built in functions, or user functions that can generate a 'better' random number.
I us...
How do I turn the following 2 queries into 1 query
$sql = "SELECT level FROM skills WHERE id = $id LIMIT 1;";
$result = $db->sql_query($sql);
$level = (int) $db->sql_fetchfield('level');
$db->sql_freeresult($result);
++$level;
$sql = "UPDATE skills SET level = $level WHERE id = $id;";
$result = $db->sql_query($sql);
$db->sql_freeres...
Does anyone know of any good IDE (Code completion, Syntax coloring, etc) that will handle php. Looking for anything that might be relatively cheap or free and doesn't run like crap (IE: Eclipse)...
What are some good steps to follow for a smooth migration from PHP4 to PHP5. What are some types of code that are likely to break?...
What is the difference, if any, between these methods of indexing into a PHP array:
$array[$index]
$array["$index"]
$array["{$index}"]
I'm interested in both the performance and functional differences.
Update:
(In response to @Jeremy) I'm not sure that's right. I ran this code:
$array = array(100, 200, 300);
print_r($array);
...