Search found 45 matches
- Wed Aug 13, 2008 10:59 am
- Forum: PHP - Code
- Topic: PHP Cron script stops in the middle unexpectedly
- Replies: 0
- Views: 329
PHP Cron script stops in the middle unexpectedly
I have a cron php script set to run. The script itself take very long to complete, about 40-50 minutes. It uses passthru() to run the linux command wget to download a file, and to output the progress. When I run the page trough the browser it runs about 40-50 minutes until it completes. When I let c...
- Wed Aug 06, 2008 6:44 pm
- Forum: PHP - Code
- Topic: Multidimensional Associative Named Key Arrays
- Replies: 2
- Views: 231
Re: Multidimensional Associative Named Key Arrays
Try something like this: $val_array = array( 'username' => array('string', 3, 4), 'username' => array('username'), 'password' => array('string', 4, 3), 'confirmPassword' => array('string', 4, 3), 'firstName' => array('string'), 'lastName' => array('string'), 'membe...
- Mon Aug 04, 2008 5:47 pm
- Forum: PHP - Code
- Topic: replace small tag with pixel size
- Replies: 3
- Views: 311
Re: replace small tag with pixel size
The <SMALL> tag is shorthand for <FONT SIZE="-1">. The sizes vary a lot accross browsers and OS's. A table sowing them can be found here: http://www.netmechanic.com/news/vol3/design_no8.htm.
- Mon Aug 04, 2008 12:35 pm
- Forum: Databases
- Topic: SELECT from MULTIPLE tables (not JOIN)
- Replies: 5
- Views: 471
Re: SELECT from MULTIPLE tables (not JOIN)
Thanks EverLearning!
- Mon Aug 04, 2008 12:14 pm
- Forum: Databases
- Topic: SELECT from MULTIPLE tables (not JOIN)
- Replies: 5
- Views: 471
SELECT from MULTIPLE tables (not JOIN)
This might be easy, but google didn't help. I need to select rows from 2 tables but not to join them (I need to append one to the other), I want to select them as if I selected them from the first, then selected them from the second, and do an ORDER BY then a LIMIT. For example, 2 tables (and their ...
- Mon Jul 28, 2008 6:55 pm
- Forum: PHP - Code
- Topic: php redirect
- Replies: 7
- Views: 650
Re: php redirect
We did not give you the complete solution, but we did give you the biggest piece of the puzzle. Here, add this to the beginning of whatever page you want you check in: if(preg_match('#^https?://www\.#i', $_SERVER['REQUEST_URI']) { header("HTTP/1.0 301 Moved Permanently"); exit(); }
- Mon Jul 28, 2008 6:49 pm
- Forum: PHP - Code
- Topic: Not extracting files use phpZip
- Replies: 2
- Views: 265
Re: Not extracting files use phpZip
Try extracting a normal zip file, not an uploaded one to see that the zip unarchiving functions do indeed work as expected.
- Mon Jul 28, 2008 6:14 pm
- Forum: PHP - Code
- Topic: Indent PHP Echoes With HTML
- Replies: 2
- Views: 192
Re: Indent PHP Echoes With HTML
PHP only lines are not outputted at all. You should always keep your html and php on different lines, so that the html lines contain their own tabs: <div> <? if($someUglyVariable) { ?> <b>I HAVE A TABS BEFORE ME!!</b> <? } ?> </div> Except small php insertion codes, or ugly but practical cases w...
- Mon Jul 28, 2008 5:52 pm
- Forum: PHP - Code
- Topic: php redirect
- Replies: 7
- Views: 650
Re: php redirect
As jaoudestudios points out, header redirects trough Location header is bad SEO practice. Instead send the 301 status code response:
Code: Select all
header("HTTP/1.0 301 Moved Permanently");- Mon Jul 28, 2008 5:49 pm
- Forum: PHP - Code
- Topic: How can retrieve Special Characters from a database table
- Replies: 2
- Views: 195
Re: How can retrieve Special Characters from a database table
Usually the best way is to always work with UTF-8 encoding. Simply call this after you connect to the database (it sets the default encoding). Also make sure the text encodings in the database are all set to utf-8.
Code: Select all
mysql_query('SET NAMES utf8');- Thu Jul 24, 2008 7:40 am
- Forum: PHP - Code
- Topic: strip_tags in PHP
- Replies: 4
- Views: 186
Re: strip_tags in PHP
It's the length check you do on the string:
The string"<p>Test paragraph.</p><!-- Comment --> Other text" is 49 chars in length.
You might want to check the length after you've stripped the tags.
Code: Select all
if(empty($val) or strlen($val) > 40)You might want to check the length after you've stripped the tags.
- Thu Jul 24, 2008 7:33 am
- Forum: PHP - Code
- Topic: Numeric value getting through
- Replies: 3
- Views: 239
Re: Numeric value getting through
You've already checked for the v_number in the database, the second check should simply be of the number of rows returned by the statement. Replace this line: if (isset($_POST['v_number_1']) && ($_POST['v_number_1'])=== $row_GetVouchers1['v_number']) { with this if (isset($_POST['v_number_1'...
- Thu Jul 24, 2008 7:29 am
- Forum: PHP - Code
- Topic: String Replace Problem
- Replies: 3
- Views: 218
Re: String Replace Problem
You could do a negative look-behind regexp:
The (?<! ) is the negative look-behind group.
Code: Select all
$output = preg_replace('#(?<!-)Edu-Cess#', '0', $input);- Thu Jul 24, 2008 7:24 am
- Forum: PHP - Code
- Topic: strip_tags in PHP
- Replies: 4
- Views: 186
Re: strip_tags in PHP
You have set the <form>'s action to "secureTextBox.php", however you have the php code on the same page as the form. Is the script's name "secureTextBox.php" ? You should leave action="" or not set it at all if you want it to go to the same page, in case you ever change...
- Thu Jul 24, 2008 7:16 am
- Forum: PHP - Code
- Topic: Numeric value getting through
- Replies: 3
- Views: 239
Re: Numeric value getting through
What does 'lets it pass' mean? Does it print 'is valid' or 'not valid'?however 0 lets it pass