452 Posted Topics

Member Avatar for navi18

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. …

Member Avatar for navi18
0
2K
Member Avatar for dancks

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 :).

Member Avatar for diafol
0
352
Member Avatar for HunainHafeez

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; }

Member Avatar for minitauros
0
235
Member Avatar for minitauros

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 …

Member Avatar for LastMitch
0
272
Member Avatar for cussel

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 …

Member Avatar for diafol
0
247
Member Avatar for minitauros

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 …

Member Avatar for minitauros
0
225
Member Avatar for technoknol

Maybe you could try something like: href="mailto:?subject=Welcome to my site&body=<?php echo urlencode($your_post); ?>"

Member Avatar for technoknol
0
149
Member Avatar for harsha.netpem

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! }

Member Avatar for pritaeas
0
163
Member Avatar for freakvista

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".

Member Avatar for diafol
0
205
Member Avatar for cssweb

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 …

Member Avatar for jkon
0
201
Member Avatar for keven.pirritano

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> …

Member Avatar for minitauros
0
9K
Member Avatar for Violet_82

Yes sir it appears to be correct :). See [this](http://api.jquery.com/checked-selector/) page for more information.

Member Avatar for minitauros
0
260
Member Avatar for Avtar1234_1

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? ;)

Member Avatar for LastMitch
0
130
Member Avatar for scholarwithfire

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** …

Member Avatar for mmcdonald
0
288
Member Avatar for minitauros

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. …

Member Avatar for diafol
0
240
Member Avatar for websponge

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 …

Member Avatar for websponge
0
612
Member Avatar for gotboots

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 …

Member Avatar for debasisdas
0
252
Member Avatar for sharathg.satya

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]

Member Avatar for emoviefreak
-1
122
Member Avatar for Tko_1

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? …

Member Avatar for Tko_1
0
168
Member Avatar for sankster

Can you perhaps show us the actual error that you receive? :) I don't quite understand what is going wrong right now.

Member Avatar for sankster
0
964
Member Avatar for anita.kcx

Maybe put /client/ in front of the index.php? No idea though, not so good with URL rewrites :).

Member Avatar for blocblue
0
126
Member Avatar for shhh

Mabye $row['serial'] contains some kind of apostrophe that is not allowed in that particular spot?

Member Avatar for minitauros
-1
80
Member Avatar for ecinevenice

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?

Member Avatar for blocblue
0
181
Member Avatar for karolismf

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 …

Member Avatar for minitauros
0
124
Member Avatar for hwoarang69

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 …

Member Avatar for minitauros
0
105
Member Avatar for sk8ergirl

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 …

Member Avatar for minitauros
0
231
Member Avatar for eoop.org

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.

Member Avatar for tyson567
0
209
Member Avatar for BenzZz

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 …

Member Avatar for Ausopenxcell
0
155
Member Avatar for veledrom

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.

Member Avatar for veledrom
0
159
Member Avatar for mrhankey

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, …

Member Avatar for diafol
0
81
Member Avatar for minitauros

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, …

Member Avatar for minitauros
0
220
Member Avatar for vienem

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?

Member Avatar for vienem
0
180
Member Avatar for mohamedasif18

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 …

Member Avatar for mohamedasif18
0
1K
Member Avatar for Stickie
Member Avatar for Octet

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) . …

Member Avatar for Octet
0
294
Member Avatar for xuweisen

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.

Member Avatar for xuweisen
0
129
Member Avatar for jpknoob

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?

Member Avatar for ko ko
0
270
Member Avatar for INF-P

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. ;)

Member Avatar for INF-P
0
207
Member Avatar for Aser Gado

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 …

Member Avatar for diafol
0
143
Member Avatar for Warl30ck

Most of the times, such an error also reports on which line in your script the error is occurring. Does it not?

Member Avatar for vaultdweller123
0
302
Member Avatar for HecGL35

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 ^^.

Member Avatar for diafol
0
177
Member Avatar for Riteman

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 …

Member Avatar for minitauros
0
203
Member Avatar for Aamit

[url]http://stackoverflow.com/questions/8685318/performance-between-dom-parsing-and-regex[/url]

Member Avatar for pritaeas
0
178
Member Avatar for lsvife

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 …

Member Avatar for pritaeas
0
193
Member Avatar for PF2G

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.

Member Avatar for pritaeas
0
152
Member Avatar for baig772

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.

Member Avatar for baig772
0
156
Member Avatar for RazorRamon

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 &lt; 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]

Member Avatar for minitauros
0
282
Member Avatar for refresher

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 …

Member Avatar for minitauros
0
3K
Member Avatar for minitauros

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. …

Member Avatar for Seesharp
0
6K
Member Avatar for minitauros

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 …

Member Avatar for Airshow
0
178

The End.