I have this marked as PHP but only because I'll be using PHP code to show my problem.
So I have some code like this for the controller:
switch ($page)
{
case "home":
require "views/home.php";
break;
case "search":
require "views/search.php";
break;
}
Obviously there's more pages but this should...
I'm playing with an embedded Linux device and looking for a way to get my application code to communicate with a web interface. I need to show some status information from the application on the devices web interface and also would like to have a way to inform the application of any user actions like uploaded files etc. PHP-seems to be a...
I'm customizing the 404 page for my website. I'd like it to include a "Did you mean...?" I need to figure out how to do this.
Here's what I'm doing so far: I come up with a broad list of files that the user might be looking for, then use levenshtein() to compare each possible filename to the mistyped filename. Those with the lowest d...
In PHP, depending on your error reporting level, if you don't define a constant and then call it like so:
<?= MESSAGE ?>
It may print the name of the constant instead of the value!
So, I wrote the following function to get around this problem, but I wanted to know if you know a way to do it in faster code? I mean, when I did a speed ...
Is there a Php function to determine if a string consist of only ASCII alphanumerical characters?
Note: I'm sorry if the question sounds dumb to some, but I couldn't easily find such a function in the Php manual.
...
I have an array full of random content item ids. I need to run a mysql query (id in the array goes in the WHERE clause), using each ID that's in the array, in the order that they appear in the said array. How would I do this?
This will be an UPDATE query, for each individual ID in the array.
...
Hi,
I'm looking for a complete solution to a automated "building" and testing of PHP application. I came across PhpUnderControl, a solution for running automated application builds created around Cruise Control.
Unfortunately PhpUC is still in it's early stages of development and I can't get it to work on windows box.
After few hours ...
Hello,
I have this php code, with which I am trying to generate a popup window that will contain the contents of a html file, however after adding in the script tags, no html is displayed. I tried echoing out $row2, but the word array is printed to the screen and nothing else.
<?php
session_start();
if (isset($_GET["cmd"]))
$cmd = $_...
Hello,
I just had some basic php questions to further my understanding as I learn, that I could not find easy answers to
I have a php ajax application that generates a table of mysql rows. I would like to know if there is a way to get php to generate neat html, as it seems neat enough as I echo it out, but when "viewing source" the ht...
function register_contact ($person = array()) {
$nogood = false;
foreach ($person as $val) {
if (strlen($val)==0) {
$nogood = true;
$status = "There was an error sending the registration please fill in all fields";
}
}
if (!$nogood) {
require_once("class.phpmailer.php");
$message = "New request for Fox In Touch Recipie...
Is there a simple way to remove a leading zero (as in 01 becoming 1)?
...
I have this short code linked that is sent from a php file:
{
$sql="SELECT * FROM Auctions WHERE ARTICLE_NO ='$pk'";
$sql2="SELECT ARTICLE_DESC FROM Auctions WHERE ARTICLE_NO ='$pk'";
$htmlset = mysql_query($sql2);
$row2 = mysql_fetch_array($htmlset);
echo '<script>
function makewindows(){
child1 = window.open ("about:blank");
child1.d...
I have create a form class for editing deleting and add users to a database. If I want to edit a user how can I simply supply the information of the user to the form.
I use a Zend_Db_Table to get the data from the database.
This is the userForm class:
class UsersForm extends Zend_Form
{
public function init ()
{
$username...
I find this very strange, must be something I'm doing wrong, but still...
I'm working on a page using PHP and TPL files.
In my TPL file, there's a place in the footer for some extra lines if needed.
For instance, formchecking with Javascript.
so in PHP I did this:
$foot = "<script type=\"text/javascript\">if(document.getElementById){l...
I have a class and I want to be able to iterate over a certain array member. I did a quick search and found IteratorAggregate:
class foo implements IteratorAggregate
{
protected $_array = array('foo'=>'bar', 'baz'=>'quux');
public function getIterator()
{
return new ArrayIterator($this->_array);
}
}
which work...
Is it possible to do a simple count(*) query in a php script while another php script is doing insert...select... query?
The situation is that I need to create a table with ~1M or more rows from other table, and while inserting, I do not want the user feel the page is freezing, so I am trying to keep update the counting, but by using a...
I am dealing with Zend_Form right now and am having a difficult time figuring out how to:
1. Use custom images for form buttons and,
2. Insert text and links in specific places (in my case I want to put a "forgot your password?" link before the submit button).
I've read through the manual but am not seeing anything about this. Any direc...
Hi,
I would like to change the default behavior of Joomla's password reminding mechanism. I would like to be provided with checking of the strength of a password and (optionally) with captcha capabilities. I was wondering if there's a free component for Joomla which I could install and use out-of-the-box.
...
What is the best method of hiding php errors from being displayed on the browser?
Would it be to use the following:
`ini_set("display_errors", 1);`
Any best practice tips would be appreciated as well!
Thanks!
-Matt
*UPDATE: I am logging the errors, I just want to make sure that setting the display_errors value to off (or 0) will n...
okee, i followed all instructions i could find here
and i could display all kinds of multilingual characters on my pages...
the problem is in phpmyadmin the japanese characters are replaced by question marks, as in a bunch of ???? ??? pieced together
i think there's a problem with my database's collation but i just wanted to verify that ...