I have a website that is fairly static. It has some forms on it to send in contact information, mailing list submissions, etc. Perhaps hours/days after an upload to the site I found that the main index page had new code in it that I had not placed there that contained a hidden bunch of links in a invisible div.
I have the following code...
In this situation, is it better to use a loop or not?
echo "0";
echo "1";
echo "2";
echo "3";
echo "4";
echo "5";
echo "6";
echo "7";
echo "8";
echo "9";
echo "10";
echo "11";
echo "12";
echo "13";
or
$number = 0;
while ($number != 13)
{
echo $number;
$number = $number + 1;
}
...
Is it possible to do case-insensitive comparison when using the in_array function?
So with a source array like this:
$a= array(
'one',
'two',
'three',
'four'
);
The following lookups would all return true:
in_array('one', $a);
in_array('two', $a);
in_array('ONE', $a);
in_array('fOUr', $a);
What function or set of functions wou...
Let's say I have this code, adapted from Adam Backstrom's answer to a previous question:
$term = 'example'; // word I need to replace
$replacement = '<strong>example</strong>'; // this will replace the $term
$d = new DOMDocument;
@$d->loadHTML($body); // specifically, drupal's $node->content['body']['#value'] in hook_nodeapi when $op='...
I have a client I am building a small CMS for. One of the functions is that he would like to be able to pick the order in which images display on a page.
In my mySql Database I have a table called image_info with the fields:
index (auto incremented)
img_url
img_link
I was thinking of adding an additional field called img_order whic...
I'm very new to MySQL so I need some help please,
I have a table called "posts", this table has the following columns:
id - this is auto increment and primary key
title
content
I have a PHP page where I want to display all the posts from the database table. I want the title to show first and then the post content followed by the title...
Hi all,
I would like to make it so that my scripts can continue to run even if there's a CERTAIN fatal error. Right now I can get this fatal error: PHP Fatal error: Uncaught exception 'MongoConnectionException' with message blah blah.
How do we catch this specific error, log it, but allow the script to continue to run? Anyone has idea...
So what I'm trying to do is select all the distinct months from my database and then print them in a list. That, I can accomplish. The problem lies in the fact that I need my list to be two column. The way that I achieve this with CSS is by using 2 different div's "left" and "right" which are floated next to each other. This poses a prob...
Oh! Too many dragNdrops out there! Prefer the sleekest for my needs.
DragNdrop images: I want my visitors to select exactly 4 favorites from a "corral" of, say, 8 jpgs. Dragndrop each from the bottom "corral" up and into 1st Place thru 4th Place Boxes...
Unused images remain below, unmoved in "corral", blank space-holder if picture is ...
When querying data via PHP, will it significantly slow down the page loading time if I can the items separately?
For example, pulling in three items at a time:
<?php foreach ($example->get_items(0,3) as $item): ?>
Versus call each of the separately:
<?php foreach ($example->get_items(0,1) as $item): ?>
<?php foreach ($example->get_i...
Instead of writing a PHP script from scratch, I wanted to know if there are any free scripts, plugins, or APIs out there that allow me to add a search box to my website to search only content on my site.
Google's free version is ad-supported, and I am looking for a clean, simple, and non ad-supported solution. Any ideas?
...
i wanna get some field values from database and present them on html.
but some of them are longer than the div width so i wanted to chop if of and add 3 dots after them if they are longer than lets say 30 characthers.
windows vs mac os x-> windows vs m...
threads about windows vista -> threads about win...
how can i do that?
...
Is there an already existing function in PHP for creating an associative array from a delimited string? If not, what would be the most effective means of doing so? I am looking at PayPal's new NVP API, where requests and responses have the following format:
method=blah&name=joe&id=joeuser&age=33&stuff=junk
I can use explode() to get ...
I want to be able to have the user select an OPML file that contains a large number of bookmarks, then loop through each one and toss it in a mysql database.
Any direction would be much appreciated.
...
hey
so i decided against using uploadify as i could not get any help on it. i've been now trying to implement a simpler solution. but unfortunately i cannot seem to process the upload code on a single page without receiving the following error:
Warning: fopen() [function.fopen]:
Filename cannot be empty in
C:\xampp\htdocs\speedy...
I heard of frameworks like Ruby and cakePHP (correct me if I'm wrong). So should I proceed to learn them?
If so, which one is the more preferred among PHP developers?
...
I am using the following code to display the title and body content of articles from a database. How can I make only the first 200 characters from the article's body appear as opposed to all the characters?
<?php
$select = mysql_query("SELECT * FROM articles ORDER BY id DESC");
while ($result = mysql_fetch_assoc($select...
i want to save a library all 7 days open time and close time
please suggest how to do it...
right now i m doing like this
on database i crate a db table_lib_hours
-----FIELD-----x--TYPE----------
|day_id |INT |
|day_name |varchar(100) |
|day_open_time |TIME |
|day_close_time|TIME |
|last_update ...
I want to clean the filenames of all uploaded files. I want to remove all characters except periods, letters and numbers. I'm not good with regex so I thought I would ask here. Can someone point me to a helpful site or show me how to put this together? I'm using PHP.
...
I am trying to use the MS Exchange 2007 Web Services from PHP and my first snag (of course) is successfully authenticating to the wsdl file when creating the SoapClient object.
I am able to fetch the WSDL file via curl simply by setting HTTPAUTH and USERPWD:
$exch = curl_init($exch_url);
curl_setopt($exch, CURLOPT_RETURNTRANSFER,...