ignace
Moderators-
Posts
6,457 -
Joined
-
Last visited
-
Days Won
26
Everything posted by ignace
-
Didn't knew that, thank you
-
[SOLVED] PHP Date Issue for auto payment reminder
ignace replied to jarvis's topic in PHP Coding Help
What prints: print $row['date'];? -
Have you added an { after if (!empty($_GET['master_id']))? in the body of if (!empty($_GET['master_id']))
-
if ?username=someUsername then it will pre-select the user from the list otherwise it will not.
-
This may have several reasons, however have you made changes in your db like the next auto_increment value for table phpbb_topics?
-
[SOLVED] Delete table1.row inner join != table2.row
ignace replied to quasiman's topic in PHP Coding Help
Oeps my bad forgot that the subquery could only return one value, sorry -
[SOLVED] PHP Date Issue for auto payment reminder
ignace replied to jarvis's topic in PHP Coding Help
$todays_date = time(); echo $todays_date .' todays'; echo '<hr/>'; $joined_date = strtotime('01 Juli 2009'); echo $joined_date .' joined'; echo '<hr>'; $dateDiff = $todays_date - $joined_date; echo $dateDiff .' date diff'; echo '<hr>'; $time_convert = (60*60*24); echo $time_convert . ' time convert'; $fullDays = floor($dateDiff/$time_convert); echo '<hr>'; echo "Differernce is $fullDays days"; gives me (on 22 Juli 2009): 1248271225 todays -------------------------- 1246446540 joined -------------------------- 1824685 date diff -------------------------- 86400 time convert -------------------------- Differernce is 21 days -
Just extend what alex wrote: // create an array of permitted MIME types $permitted = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/png','application/msword', 'application/vnd.ms-word');
-
class Core implements ArrayAccess, Countable, Iterator/*SPL Flavored*/ { protected $_modules = array(); public function loadModules($modulePattern = '*.mod.php') { foreach (glob($modulePattern) as $moduleFile) { require_once($moduleFile); $filename = pathinfo($moduleFile, PATHINFO_FILENAME); $className = ucfirst($filename); if (class_exists($className)) { $object = new $className($this);//TODO: use reflection to identify the parent if ($object instanceof Core) { $this->addModule($object); } } } } public function addModule(Core $module) { $moduleClassName = get_class($module); $this->_modules[$moduleClassName] = $module; } public function moduleIsLoaded($moduleName) { return array_key_exists($moduleName, $this->_modules); } public function getModule($moduleName) { return $this->_modules[$moduleName]; } //TODO: implement ArrayAccess, Countable and Iterator methods }
-
error_reporting(E_ALL); ini_set('display_errors', TRUE); And go to the page as not logged in and you'd get something like: Notice: undefined index 'UserID'. You should always program in a logic manner not first use a variable and afterwards question if it actually even exists? It doesn't matter for the reasons I use it, I only need fetch_array currently. You use the double of memory then is actually required in a small application this may not be a problem however in bigger applications you may consume just that too much memory. Yeah, I thought that may have been the reason for the error, and I never got around to editing it out before posting it here. Also, although 999999999999 is over the max, it just converts it into the max, because I tested it and in the database it says: 2147483647 Because PHP chopped it for you to it's maximum integer size (PHP_INT_MAX). In my opinion it's bad practice and if you'll ever work in a bank let me know so I don't deposit there Besides you are creating a game type which is known for his million users with their billion dollar accounts, they may get disappointed when it suddenly drops from 16 billion to 2 billion Have you tought about that? I didn't wanted to offend you and it surely shows that you are ambigious about what you do, however modesty is much more appreciated I can say that I'm the #1 programmer however some may disagree (and some will call me a liar, which I probably am ) HAHA
-
$ID= $_SESSION['UserID']; $ID= mysql_real_escape_string($ID); if(!isset($_SESSION['UserID'])) { echo "Sorry, you must be logged in to view this page."; include('bottom.php'); exit; } should be: if(!isset($_SESSION['UserID'])) { echo "Sorry, you must be logged in to view this page."; include('bottom.php'); exit; } $ID= $_SESSION['UserID']; $ID= mysql_real_escape_string($ID); Because if !isset($_SESSION['UserID']) then $ID= $_SESSION['UserID']; throws an e_notice: undefined index UserID Use mysql_fetch_assoc() instead of mysql_fetch_array() as it gives you both a numerical as an associative array back or atleast use MYSQL_NUM or MYSQL_ASSOC as a second optional parameter. Also you pull this information 3 times: $Result1= mysql_query("SELECT * FROM users WHERE ID='$ID'"); While $Result1 still holds the information you need and instead of re-using this information you query the db instead. Not yet
-
How about a switch ten? $WNEXP=9999999999999999; Can't be used as it exceeds the integer (and possibly float) which means you'll get a negative number for $WNEXP. Use PHP_INT_MAX instead or keep this information db-based.
-
Can be, but it's not the proper way to check if their are any new messages. Memory overkill more likely.
-
$linkarray = $tspider->parse_array($stag, $etag); exit(print_r($linkarray, true)); returns Array ()
-
$current = mysql_query("SELECT * FROM users WHERE id = '".$id."'")or die(mysql_error()); $current = mysql_fetch_array($current); Must come before the if statement like $row in my example oterhwise you'll load it twice.
-
Here is a better version: http://pastebin.com/f12cbc64c. It assumes this directory structure: modules - yourModuleName - controllerName - actionName.php - index.php // every controllerName directory must contain a index.php or it will direct you to /default/error/error(.php) - default - error error.php - index index.php index.php //code from http://pastebin.com/f12cbc64c A starter's edition can be downloaded here: http://rapidshare.com/files/256867366/babysteps.zip (Don't mind the name it's part of a project of mine)
-
$sql = "SELECT * from tblProduct where PrID=' . $PrIDs['CartPrID'] . '"; should be: $sql = 'SELECT * from tblProduct where PrID=' . $PrIDs['CartPrID'];
-
please post your code
-
compare the new values against the retrieved values: <?php //.. $row = mysql_fetch_assoc($result); //.. if (!empty($_POST)) { //validate if ($row['..'] !== $_POST['..']) { $set .= 'field = ' . $_POST['..']; } $query = "UPDATE table SET $set WHERE id = .."; //query.. } ?> <form action="" ..> <input type="text" name=".. " value="<?php print $row['..']; ?>" ..
-
Your navigation shouldn't be in your for() loop. If you want to know if their are new unread messages then use rhodesa's query: http://www.phpfreaks.com/forums/index.php/topic,261409.msg1230839.html#msg1230839. Thus remove the for() loop altogether + any variables you had for it.
-
error_reporting(E_ALL); ini_set('display_errors', TRUE);
-
changing image format using MagickSetImageFormat.
ignace replied to Methok's topic in PHP Coding Help
To what points $path? -
[SOLVED] MYSQL Insert Data from PHP XML DOM
ignace replied to CorruptBlood's topic in PHP Coding Help
Actually not you forgot to add an auto_increment to your primary id so it inserts the first row and throws sql error on all others something like: duplicate entry '0' for key '.. -
$elr[id] to answers[$elr[id]] access using: $_POST['answers'][..] = (a|b|c|..)
-
$a1 = $_POST[1]; $a2 = $_POST[2]; $a3 = $_POST[3]; Doesn't work. Therefor this never gets executed: if ($a1 == 'b'){ $correct = $correct + 1; } if ($a2 == 'b'){ $correct = $correct + 1; } if ($a3 == 'a'){ $correct = $correct + 1; } $correct doesn't get defined and when you divide it by 3 it has the value 0 (null to integer = 0) divided by 3 = 0 * 100 = 0. $s3 = 0; The reason that you also get 33 is because it somehow passes one if statement whereby $correct = 1 / 3 = 0.333333.. * 100 = round(33.333333..) = 33. Edit: I'm currently figuring out which if statement can pass and how.