I have an array that may have some null or blank values in it. Is there a PHP function that I can use to traverse this array to simply find out if there is a value anywhere?
For example:
[0]=>
[1]=>
[2]=> test
I'd like to test against the total number of values present, if any. count() won't work because this is only a portion of thi...
hi friends,
I'm developing a website in php.
I want to show a message something like javascript alert, when a user tries to edit or add something in a form and tries to navigate to some other section without saving the modification, i want to show a message to them,
that you are about to navigate about from this page, your modificati...
I'm trying to write a tool to check if a proxy server is up and available for use. So far, I've come up with two methods in the class below (I've removed setters and getters that are superfluous to this question).
The first method uses cURL and tries to request a page via the proxy, the second tool uses fsockopen and just tries to open...
I've just downloaded the newest beta of CakePHP 1.3 for a new project
(not a serious one, so no worries with the beta, still learning stuff,
I'm right now trying to get grip on acl/auth).
I've baked model and controllers for four databases, but baking a view
results in a fatal error:
Fatal error: Call to a member function on a non-obje...
I have an issue when connecting php and only php to the sphinx daemon. I have tested the sample sphinx php example test.php and narrowed it down to being a connection problem.
I have the follow piece of code which shows the problem,
<?php
$fp = @fsockopen ( '127.0.0.1', '9312', $errno, $errstr,300 );
if(!$fp) {
echo "$errstr ($errno)...
I've wanted to check if a number in PHP was proper binary. So far I've added this to check if it is devisable by 8:
if(strlen($binary) % 8 == 0){
return true;
} else {
return false;
}
It works, but it obviously allows other numbers to be placed in, such as 22229999.
What method can I use to make sure only 1's and 0'...
Example
Input = 1.1.0.1
Expected output = 1.101
...
Has anyone got a working example on howto insert and delete nodes in a tree that is directly connected to a datastore (FileItemWriteSotre) without explicit declaring a Model?
I tried everything I found searching net and forums, nothing works. Inserting the node into the datastore seems to work but does not insert a node in the Tree.
A...
I love Java. It's great. In fact, I think Java code is just down right sexy! But, there are several things I hate about writing Java web apps:
So many configuration files. I have yet to find a server/container/framework/etc that allows me not to have to create a web.xml. And frameworks only ever add to this complexity.
I love the way P...
I'm forking the filefield_stats module to provide it with the ability of exposing data into the Views module via the API.
The filefield_stats schema is as follow:
function filefield_stats_schema() {
$schema['filefield_stats'] = array(
'fields' => array(
'fid' => array('type' => 'int', 'unsigned' => TRUE, 'not nul...
I googled a lot, for those kind of problems have been asked a lot in the past. But I didn't find anything to match my needs.
I have a html formatted text from a form. Just like this:
Hey, I am just some kind of <strong>formatted</strong> text!
Now, I want to strip all html tags, that I don't allow. PHP's built-in strip_tags() Method ...
I have this code:
$layout_template = template_get("Layout");
$output_template = template_get("Homepage");
$box = box("Test","Test","Test");
eval("\$output = \"$layout_template\";");
echo $output;
In the $template_layout variable is a call for the
variable $output_template, so then the script moves onto the $output_template variable
...
I'm using this function to check if binary is correct, I know it looks sloppy.. I'm not sure how to write the function that well.. but it doesn't seem to work!
If binary = 10001000 it says malformed, even though it's not.. what is wrong in my function?..
function checkbinary($bin) {
$binary = $bin;
if(!strlen($binary) % 8 == 0)...
I found this tutorial at tizag.com. But It is for displaying entries from different tables.
How can I do an insert?
<?php
// Make a MySQL Connection
// Construct our join query
$query = "SELECT family.Position, food.Meal ".
"FROM family, food ".
"WHERE family.Position = food.Position";
$result = mysql_...
Using Drupal 6, Views 2 with exposed filters, I'm trying to determine the best way to convert the select list to a list of links, each with a count of matching nodes. For instance instead of what I get by default, as a select list:
<select name="state" class="form-select" id="edit-state" >
<option value="All" selected="selected"><An...
Hi,
Is there a very simple way in PHP to convert one date format into another date format?
I have this:
$old_date = date('y-m-d-h-i-s'); // works
$middle = strtotime($old_date); // returns (bool)false
$new_date = date('Y-m-d H:i:s', $middle); // returns 1970-01-01 00:00:00
But I'd of course like it to r...
I have the following test script on my server:
<?php
echo "Test is: " . $_GET['test'];
?>
If I call it with a url like example.com/script.php?test=ɿ (ɿ being a multibyte character), the resulting page looks like this:
Test is: É¿
If I try to do anything with the value in $_GET['test'], such as save it a mysql database, I have th...
i m using a button to go back page (let zero.php) so i m using this
<input type="button" value="Back" class="button" onClick="javascript:history.go(-1)" />
but it fails when we do some stuff on that page
like from one.php we add some data and go to two.php( where database quary runs) and again comes to a.php and then click on that...
What will be the syntax if I want to list a person with an address like the one inputted by the user?Here is my code, please help. The form input would be address.
I want to do something like this: http://dev.mysql.com/doc/refman/5.0/en/pattern-matching.html
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
...
Latelly I've seen a lot of PHP/MySQL questions that enclose SQL values within {}, for instance:
SELECT * FROM table WHERE field LIKE '{$value}';
What's up with that? Is it even valid? Why do so many people use this weird (at least for me) syntax?
...