Jessica
Staff Alumni-
Posts
8,968 -
Joined
-
Last visited
-
Days Won
41
Everything posted by Jessica
-
That's how I'd do it, that's what usort is for.
-
You could do it in an editor like tinyMCE, by loading the content into it instead of just the page. Otherwise, I don't see how you'd do it. You'd need to use javascript and php for sure, but I don't know what you'd do.
-
Passing variables from function-function in class
Jessica replied to ChadNomad's topic in PHP Coding Help
You would use the $this keyword, yes. <?php Class A{ var $foo; function bar(){ $this->foo = 'Hi'; } function myFunc(){ $this->foo = 'Hello'; } ?> -
Uhm, if you want to write a program in PERL, you might wanna check what forum you're in For PHP, you could use CURL. What do you mean by indexes URLs?
-
PHP wont display properly for my WML files
Jessica replied to oriental_express's topic in PHP Coding Help
I don't know WML, sorry. At least it's working better -
Oh nice. Bookmarked!
-
If you search on php.net you'd find: http://php.net/array_search And then by reading the docs you would find: http://www.php.net/manual/en/function.array-keys.php Try working with those.
-
PHP wont display properly for my WML files
Jessica replied to oriental_express's topic in PHP Coding Help
Search content-type and wml. -
cor doesn't return a value, it echos it. Change echo to return.
-
Go through the string char by char, and use http://php.net/ctype-upper on the individual letters. Create a new string as you go along. If it's uppercase, add a space after it when you add the letter to your new string. Also, you could store the original string as Wind-In-The-Willows and just use str_replace. If you're doing it for URLs or something, it's best to use a hyphen in place of your spaces.
-
Your reply makes no sense. If you're working in Wordpress this might do better in third-party scripts. if register_sidebar is a wordpress function.
-
PHP wont display properly for my WML files
Jessica replied to oriental_express's topic in PHP Coding Help
I think you will have to use PHP to generate the wml, so it will have a .php extension. That is the only way to run php code, with a .php . You would generate the type of the content using: <?php header("Content-type: text/css"); ?> Only I don't know what you'd put for wml files. I bet you can find a list somewhere though. -
You're not printing out those strings anywhere, just setting the variables. Show us more of the relevant code, we don't know what register_sidebar does.
-
[SOLVED] How can I see POSTed variables to debug a background script???
Jessica replied to vozzek's topic in PHP Coding Help
<?php print_r($_POST); ?> -
[SOLVED] im completely new and need some answers
Jessica replied to trueryder's topic in PHP Coding Help
Also, pick up a book on PHP that will explain the basics of how this server-side language actually works. Tutorials you find online assume you already know something about programming and how to use php. -
No problem. And always assume your users are both complete idiots, and amazing hackers. Check EVERYTHING for ANY possible errors and test it out.
-
Check out CURL and regular expressions
-
use str_replace to replace any ,0 with an empty string '' Then check if the very first character of the string is 0 and if so remove it and the subsequent comma. Or you could loop through the array before you implode it and unset any values == 0
-
[SOLVED] Setting a field equal to a count in mysql
Jessica replied to tibberous's topic in PHP Coding Help
No probs -
Adding Image Resize To My Current Upload Script
Jessica replied to sintax63's topic in PHP Coding Help
I use a rather complicated resize function, but I've simplified it here, this might help you with creating a file instead of storing in DB: It will save it as a jpg always, but I bet you can figure out how to change that. <?php if(isset($_FILES['file'])){ $ext = explode('.', $_FILES[$this->id]['name']); $ext = $ext[count($ext)-1]; $newName = 'my file new name.'.$ext; $newLoc = 'new/file/location'; $targetPath = $newLoc.$newName; if(move_uploaded_file($_FILES['file']['tmp_name'], $targetPath)) { $this->savedFileLoc = $f; if($ext == 'jpg'){ $ext = 'jpeg'; } $func = 'imagecreatefrom'.$ext; $photo = $newLoc.$newName; list($width_orig, $height_orig) = getimagesize($photo); $ratio_orig = $width_orig/$height_orig; $maxW = 200; $maxH = 150; if($maxW/$maxH > $ratio_orig){ $newW = $maxW*$ratio_orig; $newH = $maxH; }else{ $newH = $maxH/$ratio_orig; $newW = $maxW; } if($newH <= $height_orig && $newW <= $width_orig){ $image_p = imagecreatetruecolor($newW, $newH); $image = $func($photo); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $newW, $newH, $width_orig, $height_orig); if(imagejpeg($image_p, $path.$newName.'.jpg', 100)){ $file = $newName.'.jpg'; } } } } ?> (I didn't check it for errors, sorry) -
[SOLVED] Setting a field equal to a count in mysql
Jessica replied to tibberous's topic in PHP Coding Help
Did you try removing the ' ' around your sql query? It looks to me like you're just setting it to that string, instead of the result of that query. -
If you want someone to write it for you specifically, you'll probably have to pay them. People are here to help, not do it for you. You could google CURL and find a ton of good tutorials so you can write it, or you can post in freelancing
-
I just posted this on another topic, it's a good tutorial for html forms and php. http://www.tizag.com/phpT/forms.php BTW, The very simple code papaface posted won't allow for any error checking and printing of such error messages, if you only show the form if it's not been posted.