Hi, something seems to be wrong with the first line of this if function, seems alright to me though.
if ($count1 == sizeof($map) && $count2 == sizeof($map[0])){
echo ";";
}else{
echo ",";
}
This is the error I get (line 36 is the first line of the above line.)
Parse error: parse error in C:\wamp\www\game\mapArrayConvertor.php on line...
I have the following string replacement problem and I am in quite a fix here
PFB the sample string
$string = 'The quick sample_text_1 56 quick sample_text_2 78 fox jumped over the lazy dog.';
$patterns[0] = '/quick/';
$patterns[1] = '/quick/';
$patterns[2] = '/fox/';
$replacements[2] = 'bear';
$replacements[1] = 'black';
$replacement...
I want to accept a string from a form and then break it into an array of characters using PHP, for example:
$a = 'professor';
$b[0] == 'p';
$b[1] == 'r';
$b[2] == 'o';
.
.
.
.
.
$b[8] = 'r';
...
A while back I asked link text and I got some great answers. What I would like to know is if there is a way to keep the files under my web applications document root, and when I make a change, commit them back to the repository.
From what I understand, in order to work on files, they can't be in the web root. Having to move them out to ...
When you have 5 dropdowns for date selection (Y, m,d, H,i) how do you insert the selected date and time into a single column of a mySQL table as a datetime using PHP5?
I know they need to be combined in a string such as:
$DateTime="$Year-$Month-$Day $Hour:$Minute:00";
and then maybe use strtotime:
$Date=date('Y-m-d H:i:s', strtotime...
How can a filter out the array entries with an odd or even index number?
Array
(
[0] => string1
[1] => string2
[2] => string3
[3] => string4
)
Like, i want it remove the [0] and [2] entries from the array.
Or say i have 0,1,2,3,4,5,6,7,8,9 - i would need to remove 0,2,4,6,8.
...
I want to create links to pages and content that are in protected directories. I didn't program the protected directories I set them up from the host admin page.
I want to be able to give links to user that will take them to page and login as well.
Also if there is a way I want to be able to embed content from the protected directorie...
I'm using MAMP just for my development environment and haven't really understood the folder structure of /var/www/project-name/ on a web server. I'm wondering whether you're meant to point the web server to the htdocs folder or it's supposed to point to the root of the project folder?
The reason I ask is because libraries are meant to ...
I want a trigger to fire only when UPDATEs are user-initiated (not me running updates from the MySQL command line).
What's the 'industry standard' for achieving this? I have been trying unsuccessfully to detect a variable passed in with the query (i.e. @user_update=true), but without success. A colleague of mine suggested a way to do i...
Hi gurus,
We're using CakePHP for a new application, and we use Mercurial as the source control tool. (Mercurial uses one .hgignore file in the root directory, unlike (for example) CVS that uses .cvsignore in any directory.)
I'd like to exclude the content of the app/tmp/ directory from the source control (since they change all the tim...
I have a case where I'm returning database results and displaying them on a page based on a search term. This part is working fine, but I want to hightlight these search terms by wrapping them in span tags. I started to write a function that I called on each result that used the str_replace function, but then it dawned on me that this ...
I've inherited an application with a glaring security hole.
It has session-based security, but file uploads (which are user specific) are not secured in any way and they are stored in the public file tree.
Filenames do not follow any convention as such, making them hard to guess, but the data is sensitive and thus I need to implement ...
I'm trying to define multiple criteria for a single field in symfony, but every time I define a second criterion, it overwrites the previous one. Here is an example of my code:
# build query to fetch search results
$c = new Criteria();
# set minimum price
if($request->getPostParameter('price_from') > 0)
{
$c->add(HomeMode...
If I have this class:
<?php
class Model
{
var $db;
function Model()
{
$this->db=new Db_Class();
}
}
?>
and a second class that extended the parent class:
<?php
class LessonModel extends Model
{
public function LessonModel()
{
//code here
}
public function getTitle($id)
{
$...
Hi all,
I'm trying to get some more info on a question I posed on another thread
Basically, I am using this method to pass parameters to a php script which returns values from a server:
NSString *urlstr = [[NSString alloc] initWithFormat:@"http://www.yourserver.com/yourphp.php?param=%d", paramVal];
NSURL *url = [[NSURL alloc] initWithS...
Sorry for a noobish question but I've stumbled upon some other person's code and he is using i_tmp2 inside of a for loop. When is the i_tmp2 notation used?
...
Is there a place to find a list of the possible values for the PHP predefined constant PHP_OS ? I'd like to use this value for a system requirements check, but need to know how different operating systems are named in this variable.
Through some searching, so far I've compiled the following list:
CYGWIN_NT-5.1
Darwin
FreeBSD
HP-UX
IRI...
Hello,
I am trying to send something to serial port (r232) with PHP.
I am using this class: http://www.phpclasses.org/browse/package/3679.html
The problem is that I am allowed to send only 1 byte.
But if I send something like "1", I am actually sending 49 (ASCII for 1).
Instead of send("1"), I tried with send(1) but it is no good, becau...
Using PHP and MySQL, I want to query a table of postings my users have made to find the person who has posted the most entries.
What would be the correct query for this?
Sample table structure:
[id] [UserID]
1 johnnietheblack
2 johnnietheblack
3 dannyrottenegg
4 marywhite
5 marywhite
6 johnnietheblack
I woul...
I have 1 table filled with articles. For the purpose of this post, lets just say it has 4 fields. story_id, story_title, story_numyes, story_numno
Each article can be voted YES or NO. I store every rating in another table, which contains 3 fields: vote_storyid, vote_date (as a timestamp), vote_code (1 = yes, 0 = no).
So when somebody v...