452 Posted Topics
Re: You can use [readdir](http://php.net/manual/en/function.readdir.php) to read a directory and then while you read it, you could stop reading it when (or if) you find the file you need. For example: <?php $dir = 'folder/yourdir/'; $opendir = opendir($dir); while($entry = readdir($opendir)) { if(is_dir($entry)) continue; // We don't want to list directories. … | |
Re: I once ran into Felipe Ribeiro's spelling corrector class. It can do spelling suggestions like "did you mean... ?". I think it can be useful in this case. You can find it [here](http://www.phpclasses.org/package/4859-PHP-Suggest-corrected-spelling-text-in-pure-PHP.html). It's a pretty nifty piece of work :). ![]() | |
Re: No idea if it works, but maybe this is an idea? function buttonOne() { document.Form1.target = "_blank"; // Submit data to first domain. document.Form1.action = "http:/my domain 1/action.php" document.Form1.submit(); // Submit data to second domain. document.Form1.action = "http:/my domain 2/action.php" document.Form1.submit(); return true; } | |
Hello! I've recently installed Windows 8 and since that moment my XAMPP installation has been acting a bit weird it takes over a second to establish a mysql connection (mysql_connect) where it used to take less than 0.01 seconds.Timed: Timer 1 (mysql_connect): 1.02864 Timer 2 (select_db): 0.00023 I have found … ![]() | |
Re: If you want to place <b> tags around every element in your array, you can use the following: <?php function makeBold(&$input) { // The & sign is used to make live changes to the input value. $input = '<b>' . $input . '</b>'; } // Execute the function for every … ![]() | |
Hello everyone. I was wondering if you could help me with an issue. I currently know pretty much about web development in PHP/Javascript and I would like to start learning a new language (in which I can preferably also do some web development). Which language would you recommend for me … | |
Re: Maybe you could try something like: href="mailto:?subject=Welcome to my site&body=<?php echo urlencode($your_post); ?>" | |
Re: I think you're looking for something like this (still to be worked out, of course): <?php for($i=0; $i<count($records); $i++) { $record = $records[$i]; // Set data. $password = $record['password']; // etc... // Mail the user his login info. mail(...); // You're done! } | |
Re: If you want to obtain just the name of the file, you could also do it as follows: <?php $file = 'folder1/folder2/image.jpg'; $file_name = substr($file, strrpos($file, '/') + 1, strrpos($file, '.') - strrpos($file, '/') - 1); echo $file_name; // Will output "image". ![]() | |
Re: Well, my advice is: why reinvent the wheel? Google offers a great application for tracking your website's visitors and it's called Google Analytics. It's free to use. You should try it :). If you want to keep track of the number of visitors on your website you will have to … | |
Re: What happens when you include a file, is that the contents of the file that is being included are loaded on the place where your *include* function is executed. So, for example, when you have code like: <html> include 'header.php'; ... blablabla ... </html> And header.php looks like this: <head> … | |
Re: Yes sir it appears to be correct :). See [this](http://api.jquery.com/checked-selector/) page for more information. | |
Re: Well, I guess that means you're going to have to save all your menu item information in a database and retrieve it whenever your menu is loaded. Is that enough information? ;) ![]() | |
Re: Well your if(isset($_POST['submitRec'])) is **inside** your if(isset($_POST['submitButton'])) statement, so in order for it to work, $_POST['submitButton'] must be set. This is probably not the case when you submit the second form, so what I think should solve your problem is placing the if() construction that contains the Javascript warning **outside** … | |
Hello there. I am kind of confused. In PHP I substract two unix timestamps from each other. The first: mktime(0, 0, 0, 10, 22, 2012) The second: mktime(24, 0, 0, 10, 28, 2012) For as far as I know the time difference between these two timestamps is exactly 7 days. … ![]() | |
Re: Googling I found something that *might* help you: > Ajax in the traditional sense is XMLHttpRequest, which does not allow you encode and send local files to a server. > The common ways of doing uploading through "ajax" means, is to either use a Flash swf to handle the uploading … | |
Re: I guess the big question here is: what kind of data are we talking about? If we're talking about highly private data, like money transfer records etc., you could consider encrypting it, but, if it is data that is publically available to anyone anyway, why would you even bother encrypting … | |
Re: If you Google well there's plenty of tutorials to start with :). Something like [url]http://www.homeandlearn.co.uk/php/php.html[/url] [url]http://php.net/manual/en/tutorial.php[/url] [url]http://www.webmonkey.com/2010/02/php_tutorial_for_beginners/[/url] | |
Re: You could also use the simplified version of writing to a file, the file_put_contents(*file_name*, *file_contents*) function (click [here](http://php.net/manual/en/function.file-put-contents.php) to see it on php.net) for this purpose. You could then use the input from your form to determine the file name and content. What exactly is going wrong, by the way? … | |
Re: Can you perhaps show us the actual error that you receive? :) I don't quite understand what is going wrong right now. | |
Re: Maybe put /client/ in front of the index.php? No idea though, not so good with URL rewrites :). | |
Re: Mabye $row['serial'] contains some kind of apostrophe that is not allowed in that particular spot? | |
Re: I didn't even know there was anything like an oriental or portrait lay-out in Excel, just thought that depended on the width of your cells :o? | |
Re: Well if you want to execute an action you will **always** have to load a new file or reload the current file. The only exception is if you use AJAX to dynamically load a file (you know, like for example the search completion that Google uses, that's AJAX). So, if … | |
Re: What you're doing is checking if the mysql query is being executed correctly. $tester will be set to *true* if the query could be executed, or to *false* if it could not. You should rather use something like: $results = mysql_fetch_assoc($tester); And then check if $results has any records. If … | |
Re: It looks like what you typed is correct. If you have a form with an <input> field that has the "name" attribute set to "name", then its content is stored in $_POST['name'] (capital letters in the $_POST part!), on the page that is loaded by submitting the form. So it … | |
Re: It means that your select query isn't returning any results, probably due to some kind of error. Maybe you could try to output a mysql_error()? Just put the following statement before the return functions: echo mysql_error(); and see what it does. | |
Re: PHP is almost never used to alter a website's appearance. It's designed to run in the background, before the HTML gets outputted. The only way I know in which PHP does change a website's appearance, is for example when forum posts are retrieved from a database and outputted to the … | |
Re: Hey there. I think the array_walk_recursive function might work for you. Check it out here on the php.net website: [http://www.php.net/manual/en/function.array-walk-recursive.php](http://www.php.net/manual/en/function.array-walk-recursive.php) You'll have to write a custom function to check the values of your array keys, though. | |
Re: Every time the user sends a gift, you can insert a record of that into a tracking table. Then you can retrieve all gifts that were sent in the past 24 hours. E.g. SELECT COUNT(id) FROM gifts WHERE time_sent < 24 hours. Then if the count is two or more, … ![]() | |
Hello there. I would like to know if there is a way to write files to my server without CHmodding a certain directory. I have an auto-update script that downloads a .ZIP from my main server, and then extracts those file to the corresponding directories on the current server. However, … | |
Re: It appears to be a problem with your $custom[0]->value indeed. Have you tried to use [CODE]var_dump($custom);[/CODE] to see what's actually in $custom? | |
Re: If you have a multiple-steps form, you could consider temporarily saving form information in a [URL="http://www.tizag.com/phpT/phpsessions.php"]session[/URL]. If you don't know which information your post data contains, you can print the post data on your screen as follows: [CODE]<?php print_r($_POST); ?>[/CODE] This will print all the data the user has submitted … | |
| |
Re: Try using mysql_real_escape_string. You may be inserting a special character that messes up your PHP code. Try [CODE]$query = mysql_query('INSERT INTO Improv ( ID, Impressions, Appearance, Use, Content, Comments, Date ) VALUES ( NULL, "' . mysql_real_escape_string($Impressions) . '", "' . mysql_real_escape_string($Appearance', "' mysql_real_escape_string($Use) . '", "' . mysql_real_escape_string($Content) . … | |
Re: I have no problems viewing your page, but I seem to be unable to click the Enter Site button: it moves away when I try to click it :P. Also after I have entered, the background does not fill up the entire screen as it does on the intro page. | |
![]() | Re: Is there a specific need to show it as JSON? Also, if you want to display it as HTML output, why not just make your headers output it as HTML? |
Re: If they have logged in you could create a session that says that the user is logged in, and then on the other page, if the session exists, you could show the download links? Of course this is just a simple suggestion, I have yet to mention security etc. ;) | |
Re: If you want to work with password encryption in your PHP / MySQL setup, you should take in account the following: When a user registers, a password is inserted into the database. If you clean this password with for example [I]stripslashes[/I], like in your case, you should execute the [B]exact … ![]() | |
Re: Most of the times, such an error also reports on which line in your script the error is occurring. Does it not? | |
Re: I think you should look into the MySQL COUNT() function. For example [CODE]$q = 'SELECT COUNT(id) AS number_of_something FROM table WHERE conditions';[/CODE] This returns a certain count. Hopefully it's what you are looking for ^^. ![]() | |
Re: As Baig says, to run PHP on your local machine you need to be running a server. This can also be done locally, for example by installing XAMPP ([url]http://www.apachefriends.org/en/xampp.html[/url]). Once installed, you should move your project to the /htdocs folder, which is located in your XAMPP folder. Then start up … | |
Re: [url]http://stackoverflow.com/questions/8685318/performance-between-dom-parsing-and-regex[/url] | |
Re: I've never done it and I don't know the best way to do it, but if you can't think of another solution, I'm fairly sure this should do the trick: Don't even use a real <select> box. I would maybe create it, but place some div over it that, when … | |
Re: It might be me, but I don't completely understand what your question is. Or, better said, I understand your question, but the context is kind of unclear to me. | |
Re: Here's a good tutorial on regular expressions: [url]http://www.phpro.org/tutorials/Introduction-to-PHP-Regex.html[/url] In your case, I think you're looking for something like [CODE]preg_match('/^[0-9A-Za-z_\-]+$/', .....)[/CODE] Which returns true if the input string contains nothing more than letters, numbers, underscores and dashes, or indeed, like pritaeas says [CODE]preg_match('/^[\w-]+$/', .....)[/CODE] which is similair to that. | |
Re: Make use of the mysql_real_escape_string() function to escape certain special characters: [url]http://nl3.php.net/manual/en/function.mysql-real-escape-string.php[/url] Also you can convert all HTML characters to their HTML encoded equivalents. For example < would become < This is done with the htmlentities() function: [url]http://nl3.php.net/manual/en/function.htmlentities.php[/url] You can decode this with the html_entity_decode() function: [url]http://nl3.php.net/manual/en/function.html-entity-decode.php[/url] | |
Re: Well I must say that it's kind of unclear to me which part of the code you want us to look at, but what usually works is finding the current quantity of the item in your shopping cart, and then substracting or adding a certain value from or to that … | |
Hello there, I'm running into a minor problem. I want to execute an onKeyUp action after a short delay when a key is released. So for example when the user gets his finger off the "y" button, I want to execute an action related to that "Y" after 1 second. … | |
On my site there is a horizontal menu. When I hover over a menu button, which is a <div>, a <div> inside that <div> is shown with control options for that button (for example to edit the button text). This is done with Javascript (jQuery). It uses $.hover. So, when … |
The End.