HuggieBear
Members-
Posts
1,899 -
Joined
-
Last visited
Everything posted by HuggieBear
-
It's very unusual for a ISP to not have webmail these days, are you sure hers doesn't? Regards Huggie
-
I have two paragraphs on a page that I want to replace. I've used preg_match_all() to get these paragraphs into an array. This works without issue and was simple as the paragraphs are between HTML comments. The code's shown below. <?php $pattern = '/<!\-{2}\s#CONTENT[^>]+>((?:.(?!<!))+.)<!\-{2}\s#CONTENT[^>]+>/s'; $c = preg_match_all($pattern, $fs, $matches, PREG_PATTERN_ORDER); ?> I also have the text that I want to replace it with in an array. I thought it would be a case of simply using preg_replace() or str_replace() with my two array's as arguments to swap them around. This works without issue too, brilliant. BUT... And there's always a but. If the paragraphs are the same, this causes problems. It replaces both paragraphs, with the the first element in the replacements array, as I would expect it to. My question is, how can I get each replacement to only replace one instance of the matched text? Here's the code: <?php /* * $matches[1] is my array from preg_match_all() * $textareas is my array of replacements **/ foreach ($matches[1] as $k => $v){ $matches[1][$k] = '/\Q' . $v . '\E/'; // Make each match a valid regex pattern } $nfs = preg_replace($matches[1],$textareas,$fs); ?> Regards Huggie
-
Very useful for security permissions. Regards Huggie
-
[SOLVED] Populating databases from text files
HuggieBear replied to gerkintrigg's topic in PHP Coding Help
The first question should have been "in what format is your text file". Please give an example of layout. Regards Huggie -
It means that $POST['email'] isn't defined. (Not set) Use isset() first to see if it exists. Regards Huggie
-
From what I can see you are using the GD library. Regards Huggie
-
Does the script upload and resize without outputting anything to the browser? If it does then I'd be willing to bet that it's not the uploading part that's the problem, but more the resizing part. Try to echo something to the screen post upload but pre resize and see if it works for both. Are you using the GD library for resizing? Go here to get an idea of how to calculate the memory usage required... Regards Huggie
-
PHP is case sensitive... Try if ($_POST['Register']) { Regards Huggie
-
This is open to spam as you're coding the email addresses in the page. Crawlers will have a field day. Think about using a name => id type link. Regards Huggie
-
I'd give Google a try... with the follwoing search free +wysiwyg +php Regards Huggie
-
I don't use a Visual tool anymore, other than a browser of course. But I used to use Macromedia (Adobe) Dreamweaver, which can handle PHP I believe. Regards Huggie
-
Change the image table and comment table setup slightly so it's like this: Table Image: ImageID <- unique ImageTitle ImageURL UserID <- unique id from the user table Table Comment CommentID <- unique ImageID <- unique id from the image table CommentBody Regards Huggie EDIT: Beaten to it
-
Take a look at the Array type in the manual. Regards Huggie
-
INACTIVE needs to be in quotes. Otherwise php thinks it's either a constant or a boolean value. As Liam said, include ' ' around INACTIVE and you should be fine. Regards Huggie
-
No, PHP can't fetch any information from your local machine unless your browser offers it to the server. Regards Huggie
-
I agree, I have the w3schools link in my signature. Regards Huggie
-
[SOLVED] MS documents with fopen and fread
HuggieBear replied to alejandro52's topic in PHP Coding Help
In short, yes! You could open the document, read in the contents and then try and format it, but by the time you've learned about COM objects and written the PHP you'd have been quicker to do it manually. Regards Huggie -
[SOLVED] MS documents with fopen and fread
HuggieBear replied to alejandro52's topic in PHP Coding Help
Nothing's going to keep the formatting unless you save your word document as HTML (I believe there's an option when you Save As...) but it'll contain all Microscofs proprietory rubbish! Regards Huggie -
[SOLVED] MS documents with fopen and fread
HuggieBear replied to alejandro52's topic in PHP Coding Help
Mr P!nk, have you tried it before suggesting it? Give it a go and see what happens! Regards Huggie -
Look at ini directives and error handling functions for correct use of display_errors Regards Huggie
-
[SOLVED] MS documents with fopen and fread
HuggieBear replied to alejandro52's topic in PHP Coding Help
I think fopen() is aimed at ASCII data, not Binary data (Like a .doc file). I'd use COM objects to get around this issue. Regards Huggie -
My first question would be... Have you read the manual? This normally clears up lots of the issues. Regards Huggie
-
You could use something like cURL or fsockopen Regards Huggie
-
You're right, 'by' is a reserved word... MySQL 3.23, 4.0, 4.1 Reserved Words MySQL 5.0 Reserved Words MySQL 5.1 Reserved Words Regards Huggie p.s. Make sure you mark this topic as solved