Search found 118 matches

by mmj
Mon Jan 19, 2009 4:54 pm
Forum: Regex
Topic: [RegExp] Match /a(b|c)/ or /(b|c)a/
Replies: 2
Views: 1363

Re: [RegExp] Match /a(b|c)/ or /(b|c)a/

Thanks for the tip. :)
by mmj
Sat Jan 17, 2009 6:38 am
Forum: Regex
Topic: [RegExp] Match /a(b|c)/ or /(b|c)a/
Replies: 2
Views: 1363

[RegExp] Match /a(b|c)/ or /(b|c)a/

I currently am just writing the subpattern twice, e.g.

Code: Select all

/a(b|c)|(b|c)a/
Is it possible to do write this without putting the subpattern twice?

Something like pseudo-code: match a at ^ or $ of subpattern.

TIA

Edit: oops, never noticed this forum. Thanks admin
by mmj
Mon Dec 29, 2008 11:41 am
Forum: PHP - Code
Topic: Deleting images
Replies: 4
Views: 225

Re: Deleting images

You'd have to make a form then loop thought the checked check boxes and call unlink.
by mmj
Fri Dec 26, 2008 9:45 am
Forum: PHP - Code
Topic: What is the best way to include HTML in php scripts?
Replies: 13
Views: 993

Re: What is the best way to include HTML in php scripts?

the way i do it is insted of putting the echo command i end the php block and enter my html and then open it up again <?php if($cookies){?> <b>heloo</b> <?php } ?> Yeah, thats a good method. Also the alternative control structures syntax is used frequently with this method.
by mmj
Tue Dec 23, 2008 9:24 am
Forum: PHP - Code
Topic: fwrite without overwriting
Replies: 6
Views: 467

Re: fwrite without overwriting

:banghead: :madblow: Is there some sort of communication barrier at work here? 8O mea culpa, I guess I should have been more descriptive in my first post. Basically I just want to confirm what is said in this thread: http://www.usenet-forums.com/php-language/17479-write-middle-file-without-overwriti...
by mmj
Mon Dec 22, 2008 11:01 am
Forum: PHP - Code
Topic: fwrite without overwriting
Replies: 6
Views: 467

Re: fwrite without overwriting

Okay, if data.txt has "12567" in it then I do this: <?php $fp = fopen('data.txt', 'r+'); fseek($fp, 2); fwrite($fp, '34'); fclose($fp); ?> I want "1234567" not "12347". Basically I don't want to overwrite the data which the cursor is currently located at. Note: this exa...
by mmj
Mon Dec 22, 2008 5:08 am
Forum: PHP - Code
Topic: fwrite without overwriting
Replies: 6
Views: 467

Re: fwrite without overwriting

Mark Baker wrote:

Code: Select all

 
$initialData = file_get_contents('myFile.txt');
$newData = "New First Line\n".$initialData."New Last Line\n";
file_put_contents('myFile.txt',$newData);
 
I mean the other way around. =)
by mmj
Sun Dec 21, 2008 2:02 pm
Forum: PHP - Code
Topic: Can anyone see a problem with this? - Newb Question
Replies: 10
Views: 558

Re: Can anyone see a problem with this? - Newb Question

[quote]

Code: Select all

$seql="SELECT Level_access FROM $tbl_name WHERE Username='$Username' and Password='$Password'";
$reesult=mysql_query($sql1);
[quote]

Unless you set $sql1 in a different location thats your problem.
by mmj
Sun Dec 21, 2008 1:56 pm
Forum: PHP - Code
Topic: fwrite without overwriting
Replies: 6
Views: 467

fwrite without overwriting

How can I add text before the end and after the beginning of a file without overwriting data?

Seems like my only option is to split the file up then put it back together later on. :banghead:
by mmj
Sat Dec 20, 2008 2:16 pm
Forum: PHP - Code
Topic: Need some help with this upload script
Replies: 5
Views: 357

Re: Need some help with this upload script

Try removing one of the dots from $dir.
by mmj
Sat Dec 20, 2008 11:20 am
Forum: PHP - Code
Topic: Need some help with this upload script
Replies: 5
Views: 357

Re: Need some help with this upload script

Code: Select all

$filename = $_POST['mod'].'_'.$userid.'_'.date('dmy');
by mmj
Sat Dec 20, 2008 11:12 am
Forum: PHP - Code
Topic: WHy is this valid?
Replies: 8
Views: 300

Re: WHy is this valid?

I once tried

Code: Select all

array(, 'item')
wanted to the first element to be empty. Didn't work though, so I set it to null.
by mmj
Sat Dec 13, 2008 1:48 pm
Forum: PHP - Code
Topic: Using fopen(), fread(), fseek() for data in memory instead?
Replies: 10
Views: 2266

Re: Using fopen(), fread(), fseek() for data in memory instead?

On a project I was recently working on I had to upload POST data to an FTP server, and since the ftp_[f]put functions only support files I used tmpfile(), which did the job quite nicely.
by mmj
Tue Dec 09, 2008 8:29 am
Forum: PHP - Code
Topic: Current HTML Page Title
Replies: 18
Views: 941

Re: Current HTML Page Title

millsy007 wrote:Thats great thanks :D
( Just a note for some reason I had to change it to: strpos($contents, '</title>') - 9); to stop a rogue > appearing!? )
NP.

Hmm, thats strange, 8 should be the right number.

Are you sure you don't have this? <</title>