ignace
Moderators-
Posts
6,457 -
Joined
-
Last visited
-
Days Won
26
Everything posted by ignace
-
[SOLVED] Looping Through Results - Produces Duplicates !!
ignace replied to Jexx's topic in PHP Coding Help
I think this should work: $array = array(..);//your stored result $sizeof = sizeof($array); for ($i = 0; $i < $sizeof; ++$i) { $v1 = $array[$i]; for ($j = $i + 1; $j <= $sizeof; ++$j) { $v2 = $array[$j]; if (!strcasecmp($v1, $v2)) { $array[$j] = null; } } } $array = array_values($array); -
SMTP needs to be installed.
-
$lines = file('path/to/file.txt'); $urls = array(); foreach ($lines as $line) { list($user, $pass, $url) = explode(':', $line); $urls[] = $url; }
-
You can use the Zend_Form component from the Zend framework. It provides validators for most popular fields. http://framework.zend.com/manual/en/zend.form.html
-
Hide field if value is empty/null/equal to something
ignace replied to Ortix's topic in PHP Coding Help
You don't need to apologise if you don't understand some of the terminology. Just ask and we will clarify or if you <3 Google like I do, you can prefix whatever you don't understand with 'define:' like: http://www.google.com/search?q=define%3Aterminology -
A programmer is someone who writes computer software. So you are by definition a programmer.
-
Unless you wrap it inside an array: return array($hour_1,$min_1,$hour_name,$min_name); acess using: list($hour_1, $min_1, $hour_name, $min_name) = min2hrmin(..);//assuming you want to overwrite $hour_1, .. use different variable names otherwise Don't calculate $hour twice: $hour = $min / 60; $hour_1 = floor($hour/*not $min / 60*/); if($hour_1 < 1) Always returns false as $min >= 60 && $min <= 999, thus $hour_1 is always >= 1
-
HAHA seems like we all are very competitive and eager to show off our skills The whole fun part about this virtual competition is that only the OP is actually gaining something from this
-
Aren't you forgetting something? $gUser = mysql_query("SELECT * FROM test WHERE username='".$username."' AND password='".md5($password)."' LIMIT 1") or die(mysql_error());
-
This is well covered in the manual: http://www.php.net/manual/en/features.file-upload.multiple.php
-
I hope so altough his code says otherwise. if ($myIPSplit[0] == 100 || $myIPSplit[0] == 200) {
-
I'm not blocking the entire range from 0-200. I just used the IP's in my original post as an example. Not 0-200, 100.111.0.0-200.111.255.255 and Daniel now gave you code to block ip's in the range: 100.111.222.333-200.111.222.333 but even that still blocks a million or more users from visiting your website.
-
If you block 100.111.0.0-200.111.255.255 you would be blocking: from: 100.111.0.0->01100100.01101111.00000000.00000000 to: 200.111.255.255->11001000.0110111.11111111.11111111 So you will be blocking roughly: 3,604,481 users.
-
Hide field if value is empty/null/equal to something
ignace replied to Ortix's topic in PHP Coding Help
Please post all relevant code including queries etc.. -
None of these algorithms are implemented by default in PHP. Find a tutorial using Google or buy a book who goes into detail about the subject.
-
You can set it as solved by clicking 'Solved' below left above 'Quick Reply'
-
All it takes is an implementation of the Interpreter pattern
-
[SOLVED] Custom Built Radar Weather Tracker
ignace replied to barryhayden's topic in PHP Coding Help
What does echo $buffer output? -
[SOLVED] Need a way to let users upload music, images, ...
ignace replied to DEVILofDARKNESS's topic in PHP Coding Help
If it fits your needs. -
$email_addresses = array(..); if (!empty($_POST['mail_to']) { $mail_to = (int) $_POST['mail_to']; if (isset($email_addresses[$mail_to])) { $email_address = $email_addresses[$mail_to]; mail($email_address, ..); } } else { foreach ($email_addresses as $key => $email_address) { echo '<option value="', $key, '">', substr($email_address, 0, $pos = strpos($email_address, '@') ? $pos : null), '</option>'; } }
-
No that just changes the result set from numerical + associative to associative only
-
if(!($db = @ mysql_connect('localhost', username', 'pass'))) should be: if(!($db = @ mysql_connect('localhost', 'username', 'pass'))) What is the problem you are encountering?
-
[SOLVED] First button not working, but the others do
ignace replied to TGWSE_GY's topic in PHP Coding Help
You can't do that. This will echo: <form method="post" action="maineditor.php?section=edit_get_news"><input type="hidden" value="1" name="id" id="id"><input type="submit" value="EDIT ARTICLE"></form> <form method="post" action="maineditor.php?section=edit_get_news"><input type="hidden" value="2" name="id" id="id"><input type="submit" value="EDIT ARTICLE"></form> <form method="post" action="maineditor.php?section=edit_get_news"><input type="hidden" value="3" name="id" id="id"><input type="submit" value="EDIT ARTICLE"></form> both name and id need to contain a unique value. $results = mysql_query($query) or (mysql_error()); probably needs to be: $results = mysql_query($query) or die(mysql_error()); otherwise if the query fails mysql_error() is called but the script continues processing. Whereby $resultsarray = mysql_fetch_assoc($results) Will throw an E_WARNING: Invalid result resource provided to mysql_fetch_assoc() -
[SOLVED] Problem with includes from dbase in php script
ignace replied to dossie's topic in PHP Coding Help
First of all: add the while inside the if ($result ..) otherwise your while will execute even if your if failed. You can even extend to make sure there is something to loop over. $result = mysql_query($query); if ($result && mysql_num_rows($result)) { while ($row = mysql_fetch_assoc($result)) { .. } } Second: $query = 'SELECT * FROM affiliates WHERE id="4"'; Implies your result will be one row which makes the while redundant: $result = mysql_query($query); if ($result && mysql_num_rows($result)) { $rij = mysql_fetch_assoc($result); // this include doesn't work include('../dbaseincludes/metainclude.php'); // this echo gives the good information but when I try to get it into an include it doesn't work echo "{$rij['town']}"; // these things I need in 3 different includes echo "<h4>{$rij['name']}</h4>"; echo "adress: {$rij['adress']}<br>"; echo "website: <a href={$rij['siteUrl']} target=_blank>{$rij['name']}</a>"; echo "<br><br>"; echo "<h4>Opinion</h4>"; echo "<a href={$rij['siteUrl']} target=_blank>Click here for opinions</a>"; echo "<br><br>"; echo "<h4>Is {$rij['name']} not what you're looking for?</h4>"; echo "<a href={$rij['more']}>Click here for more opinions</a>"; // this goes allright include('../tip.php'); echo "</div>"; echo "<!-- end #welcome -->"; include('../onderaan3.php'); echo "</div>"; echo "</body>"; echo "</html>"; } P.S. Groeten vanuit Belgiƫ -
[SOLVED] Looping Through Results - Produces Duplicates !!
ignace replied to Jexx's topic in PHP Coding Help
Store the results instead of displaying them directly go over the result check if a duplicate exist, if one exists unset() it.