452 Posted Topics
I would like to execute some Javascript after the document has loaded and even after the document.onload functions have been executed. Situation: I'm loading a text-edit field through ajax. When the user submits the form, he is redirected to a PHP file. That PHP file redirects him back to "file.php" … | |
The case: On my site there are four profile types: persons, artists, companies and events. A user can create multiple profiles. Each profile can be connected to another profile. So a person-profile can for example connect to an artist-profile, but also to an event-profile, and an event-profile can connect to … | |
What I would like to do is to create a repeating pattern inside a rewriterule. For example: RewriteRule ^([\w]+)/([\w]+)/(([\w]+)/([\w]+))*/?$ index.php?p=$1&s=$2(&$4=$5)* Breaking it down: On every page my ?p=BLA refers to a certain page, and every &s=BLA refers to a certain subpage. The rewriterule for this would obviously be: RewriteRule ^([\w]+)/([\w]+)/?$ … | |
What I would like to do is to create a repeating pattern inside a rewriterule. For example: RewriteRule ^([\w]+)/([\w]+)/[B](([\w]+)/([\w]+))*[/B]/?$ index.php?p=$1&s=$2[B](&$4=$5)*[/B] Breaking it down: On every page my ?p=BLA refers to a certain page, and every &s=BLA refers to a certain subpage. The rewriterule for this would obviously be: RewriteRule ^([\w]+)/([\w]+)/?$ … | |
Okay so me and a friend of mine are discussing the following: If you have 1. a table with 10 fields, each a varchar(255) or 2. a table with 10 fields, each a varchar(1billion) [B]Which would be better, performance wise?[/B] I say it won't matter, because MySQL reads the field … | |
In the ZEND Reference Guide I saw this: [CODE]$select = $db->select()->from('posts')->order('date_created DESC');[/CODE] Now I'm wondering: what does that second arrow do? What does using more than one arrow when working with an object do? And can I use it all the times? For example [CODE]$myclass->function()->anotherfunction()->hello;[/CODE]? | |
I'm wondering: Why would I need to use a static variable? When I initiate a class, that class remembers the value of a variable I declare in that class anyway, right? What does the [I]static[/I] part add to that? For example, what's the difference between [CODE]class Hello { public $variable; … | |
Re: Do you want to produce the HTML of the invoice, or a PHP part? | |
Re: Seems like you forgot to close your [I]end[/I] tag on line 7, for starters. Edit: Nvm, I see it :). | |
Re: [CODE]function randomHash($length) { if (!$length) $length = 6; $array = array_merge(range('A', 'Z'), range('a', 'z'), range(0, 9)); for($i=0; $i<$length; $i++) { $random = mt_rand(0, count($array)-1); $random_hash .= $array[$random]; } return $random_hash; }[/CODE] This creates a random hash with the length of $length. Add it to your database with a simple insert … | |
Re: For example you could create a 128 length password field for a sha512 hash, which is much more secure than a sha1 hash. You would compare the form result with the database result, and if it matches, the user will be logged in. Something like: [CODE]$password = hash('sha512', $_POST['password']); // … | |
Re: Just a wild guess, but maybe you could explode on a special character (the enter character, \n)? That would return an array of which each key would contain a line of text. | |
Re: Just check whether your checkboxes are checked or not, and if yes, what their value is? All checkboxes and their values can be found in the $_POST data. :) | |
Re: I don't know everything about regexps, but a dot should be escaped, or it will be treated as "any character". A dot matches any charachter if it is not escaped properly. Same goes for the comma and dash, backslash and ', in other words, all characters that have a function … | |
Re: You could try: preg_match('/^\+?55[0-9]+$/', $string); \+? means: a + 0 or 1 times, 55: both need to be present [0-9]+, any number, 1 or more times. | |
Re: It's for example to show other coders that are working on the same project as you how they should use your class. | |
Re: Yes, you can create a graph using commands like imageline etc. ([url]http://php.net/manual/en/function.imageline.php[/url]) You should search for a PHP Graph tutorial! :) | |
Re: It means that PHP can't find the file specified. Are you pointing to the right file? | |
Re: To start at a value other than 1, add AUTO_INCREMENT xxxxx to a create query, like CREATE TABLE bla (this and that) AUTO_INCREMENT 1000 | |
Re: Change [L] to [L,R] might work. I'm not a .htaccess pro but I know that the R stands for "Redirect", so that's the first thing that comes into my mind when I read your issue. | |
Re: What cereal says. You need to add an underscore between the $ and SERVER, which makes it $_SERVER instead of $SERVER. | |
Re: Your form appears not to have an input named "Notes" - that's the index PHP says you're missing, and that might be the problem. | |
Re: You mean uploading all files in a folder and attatching it to an email? | |
Hello there, I'm trying to create a rewrite condition for a set of rewrite rules. Currently this is what I have: HTML and CSS Syntax (Toggle Plain Text) [CODE]RewriteCond %{HTTP_HOST} ^/?forum [NC] RewriteRule ^([\w]+)/([\w]+)/?$ index.php?p=$1&s=$2 [NC,L,C] RewriteRule ^([\w]+)/?$ index.php?p=$1 [NC,L][/CODE] What I want is to have the following uri, [url]http://www.mywebsite.com/page1/page2[/url], … | |
Re: May I ask why you're using two tables to display only one banner? | |
Hello there, I'm trying to create a rewrite condition for a set of rewrite rules. Currently this is what I have: [CODE]RewriteCond %{HTTP_HOST} ^/?forum [NC] RewriteRule ^([\w]+)/([\w]+)/?$ index.php?p=$1&s=$2 [NC,L,C] RewriteRule ^([\w]+)/?$ index.php?p=$1 [NC,L][/CODE] What I want is to redirect [url]http://www.mywebsite.com/PAGE1/PAGE2[/url] to [url]http://www.mywebsite.com/index.php?p=PAGE1&s=PAGE2[/url], except when the URI starts with "forum" (for … | |
Re: You could try finding a tutorial somewhere? :) I'd suggest [url]www.good-tutorials.com[/url] | |
Re: The error must almost certainly be in the data you specified to connect to your MySQL database. For example you could have set a wrong username, password, host, etc. to connect to your database. Make sure you double check it, and then try again :). | |
Re: You could make a full horizontally oriented image, maybe. What I mean is for example when you retrieve data from your database, you coun't how many boxes you're gonna have to make for each column, then you place those boxes underneath eachother (you will need to calculate where you're gonna … | |
Re: The "var" prefix was used in PHP 4. In PHP 5, you don't need to use the word "var" to declare a variable. In PHP 5, however, a warning will be generated if error handling is set to E_STRICT. ![]() | |
Re: Can't you just select the amount of votes that an option has received from the [I]pollvotes[/I] column, and then display the result behind the poll option? ![]() | |
Because using the <base> tag is giving me some problems lately, I'm curious about what the best solution is to use together with mod rewrite. I use mod rewrite a lot, and the <base> tag helps me to keep the links to my css files, for example, working. I link … | |
Because using the <base> tag is giving me some problems lately, I'm curious about what the best solution is to use together with mod rewrite. I use mod rewrite a lot, and the <base> tag helps me to keep the links to my css files, for example, working. I link … | |
Re: It's not completely clear to me what your question is. Are you asking what SQL command you should use, are you asking what Javascript code you should use, or are you asking something else? | |
Re: Almost every time such an odd problem occured in one of my projects, it was like only one letter or one line that was written wrong or contained a spelling mistake that was causing the problem. You really need to check EVERYTHING very closely. session_start(); should be the first line … | |
![]() | Re: I'm using Google Webfonts myself, but it's too bad that not all browsers know how to work with custom fonts :(. ![]() |
Re: It should be: [CODE]if (!preg_match("/^[A-Za-z0-9]{3, 20}$/i", $_POST['brugernavn']))[/CODE] The {3, 20} part checks if the length is between 3 and 20 characters. | |
Re: I think you can achieve what I [B]think[/B] you want to achieve by creating a .htaccess file. Try seaching Google for htaccess tutorials or something like that :). With a .htaccess file you can rewrite your URI's. For example [url]http://www.example.com/index.php?query=hello[/url] could be displayed as [url]http://www.example.com/index/hello[/url]. | |
Re: Sha1 is safer than md5, and it's also built in in PHP, so why not use sha1? :) Where md5 returns a 32 character long encrypted hash, sha1 returns a 40 character long encrypted hash. It may not seem like that's a lot of difference, but it is! ![]() | |
Re: For security you should at least do both: create a .htacces file AND check if the user visiting the page is allowed to perform the actions he is about to perform (by, for example, matching his user rank - which was set when he logged in - against the user … ![]() | |
Re: If you put a "From:...." in your $headers, there's no need to add it again in your additional parameters :). | |
Hello. I'm not so good at Javascript, but I tried to write some code to obtain some form values and write those to a query string to use in AJAX. It seems to be working partially, but I don't understand what is going wrong. What happens is that in the … | |
Re: It's indeed what Zero13 says. Your function needs an id to make use of the getElementById function. However, you're not sending the id to the function when you call it in your HTML. You could try replacing onClick="getId(id);" by onClick="getId(this.id);" if you want to send the id from the element … ![]() | |
Re: Usually, as Ardav says, visitors cannot even see your PHP code. Have you ever tried right clicking a website -> view source? Do you see PHP code there? :) (If that's what you mean). | |
Hello, I'm encountering an AJAX problem when I try to execute multiple AJAX requests at the same time. What I want to do is delete a message and display the status (succes or failure) of that in [I]div1[/I], and refresh the messages on the page in [I]div2[/I]. This needs (for … | |
Re: Well, the variables you're using in these lines of code [CODE]$body_message = 'From: '.[color="red"]$field_name[/color]."\n"; $body_message .= 'E-mail: '.[color="red"]$field_email[/color]."\n"; $body_message .= 'Message: '.[color="red"]$field_message[/color];[/CODE] have not been defined in the code that precedes it (for as far as I can see), and therefore will be [COLOR="Red"]null[/COLOR] (if what I see here is … | |
Re: Lines 28 - 30: [CODE]if($err!=""){ echo "Error in $sql: $err\n"; echo "Invoice Prep completed";[/CODE] You place an opening bracket there, but you never close it. | |
Re: Well, I don't think there's much difference between executing 4 different queries in one query and executing 4 different queries apart from eachother. I've never tried it, but I don't think executing 4 counts in one query will work. Besides that, COUNT just counts the rows that are selected, so … | |
Re: Perhaps you should read about extending classes :). Child classes implement all functions of their parent. So if you have for example child class getUserByRid, which is the child of getUserByUid, it would look like: [CODE]class getUserByUid { // code.. } class getUserByRid extends getUserByUid { // this one contains … |
The End.