
mkoga
Members-
Posts
51 -
Joined
-
Last visited
Never
Everything posted by mkoga
-
Although I prefer to format on Mysql side of things. Here is a clean PHP solution: <?php echo date('d-m-Y', strtotime('2008-03-14')); //prints out 14-03-2008 ?>
-
Fulltext Keyword search across multiple tables should I do...
mkoga replied to cooldude832's topic in MySQL Help
One way to handle such a complex search is to index them with lucene. The zend framework has an implementation of it: http://framework.zend.com/manual/en/zend.search.lucene.html along with tutorials. -
On osx the terminal should have ssh by default. I'm currently using Aptana, similar ftp features as dreamweaver. The only thing is that Aptana is based on eclipse which can be a RAM beast. If someone could offer a better alternative with similar features that would be awesome.
-
Why not store page content in the db? Or skipping the db and map url data to files. Try taking a look at some other cms to see what they are doing. I've looked at drupal before, it gave a lot of insight.
-
If you are going to use the data in the controller before passing it to the model, then by all means, validate it. I like to keep validation in the model so if more than one controller uses the same model, you only need to write validation code once. Also depending on the framework you use, if any, you should probably screen input before the data hits the controller. Just to cover Sql Injection and XSS. Hope that helps.
-
I'm planning on sending some emails 10 seconds apart from each other until an email queue is complete. Does anyone have an opinion on which would be better for performance? I could sleep(10) after each email sent or run a cron job every 10 seconds. I would rather use a cron job, but I would have to keep the cron job running every 10 seconds 24/7 unless I did an exec('crontab') call. I guess what it basically comes down to is which is better: running one really long php instance or running a bunch of really short php instances? Any thoughts?
-
print $_SESSION['userid'] to see what value you're sending to the database.
-
awesome! never knew about the toPrecision() method. thanks.
-
make sure that $data contains a correct path to the image. try printing it out to the screen just to check.
-
more like: document.getElementById('tot').innerHTML = pad(vT);
-
You can run vT through this function and use the return value as the innerHTML.
-
try something like this: function pad(num) { var result = num; if (result.indexOf('.') != -1) { var tmp[] = num.split('.'); var suffix = tmp[1]; if (suffix.length < 1) { suffix = "00"; } else if (suffix.length == 1) { suffix += "0"; } else if (suffix.length > 2) { suffix = suffix.substring(0, 2); } result = tmp[0] + "." + suffix; } else { result += ".00"; } return result; }
-
[SOLVED] Can someone PLEASE help me debug this
mkoga replied to HaLo2FrEeEk's topic in PHP Coding Help
I believe you have to specify the scope with the global keyword. <?php $myVar = array(); function doSomething() { global $myVar; $myVar[] = 'do something'; } ?> -
OR is correct. cooldude832's suggestion returned nothing?
-
oops, read the $_SESSION['LOGGEDIN'] == FALSE a little too fast.
-
A possible solution would be to use Headers to send binary data from the database.
-
Also cleaner indentation would help recognize blocks a little easier.
-
It is possible that the problem is that your positions are relative, try changing to absolute and see if that helps.
-
If you destory the session with session_destroy(), can you still store in the global variable $_SESSION?
-
[SOLVED] Preventing identical email and username registrations?
mkoga replied to christofurr's topic in PHP Coding Help
shouldn't it be: <?php $takenick = mysql_query("SELECT Nickname FROM Froobs WHERE Nickname = '{$_POST['nick']}'"); $takemail = mysql_query("SELECT Email_Address FROM Froobs WHERE Email_Address = '{$_POST['email']}'"); if (mysql_num_rows($takenick)) {$error = "1";} if (mysql_num_rows($takemail)) {$error = "2";} if ($error != "1" && $error != "2") { /*Execute database input*/ } ?> -
It might be a good idea to use firebug on firefox to profile your site. That way you can see exactly what is taking the longest to load. Firebug: https://addons.mozilla.org/en-US/firefox/addon/1843
-
you'd have to use javascript: function gotoUrl(url) { document.location = url; } function startTimer() { setTimeout("gotoUrl('<?php echo $url; ?>')", 5000); } then just call startTimer to start the 5 sec count down. hope this helps.
-
It's tough to say without seeing the page in it's entirety. I would suggest placing an alert('here') in the swapImages function just to see if the code is even reaching the function.
-
I saw this on ajaxian. It could be interesting to try. It's called phpQuery which is a php port of jQuery. It looks like you should be able to select elements by css selectors and return them as a php object. Here's the link to the project: http://wiadomosc.info/plainTemplate/ If anyone tries this out, let me know what you think.
-
You could try: $str = 'text goes here'; $encoded = base64_encode($str); $decoded = base64_decode($encoded);