Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. @Mchl Your query confirms what I thought @OP I feel that your code may even require further optimization like $project = $this->getProject($projs["ID"]); What code goes behind this?
  2. I'll second roopurt, use http://php.net/manual/en/book.bc.php
  3. I doubt that that is the true solution all you are doing is sorting by profile + your query is the same as mine except you use sum and order by another field. Try: SELECT t1.Name, sum(t2.Profile + t2.Website) as total FROM table2 AS t2 JOIN table1 AS t1 USING (ID) ORDER BY total DESC LIMIT 5
  4. Alternatively you can store your session's in the database along with the username. If a record exists the user is indicated to be online. Store his last_click_at and last_click_url and you can even indicate at what he is currently looking if a user is idle for to long (last_click_at + max_idle_time < now()) remove his record. Alternate options by using a database: - remote logoff - check double logon You can store session's in your database by using session_set_save_handler
  5. Also mentioned in the manual:
  6. $projekt = mysql_fetch_array(mysql_query("SELECT ID FROM projekte WHERE ID = $projs[0] AND status=$status ORDER BY projnum ASC"), MYSQL_ASSOC); does not work because you pass a certain value and are sorting according to this. You should start your sorting once after the while loop. Second it's dangerous to write: $user = mysql_real_escape_string($user); $status = mysql_real_escape_string($status); $user = (int) $user; $status = (int) $status; Because if there is no active connection to the database mysql_real_escape_string returns false and emits a warning meaning that both $user and $status will equal 0 Also not entirely sure but is this query: SELECT ID FROM projekte t1 JOIN projekte_assigned t2 ON t1.ID = t2.projekt WHERE status = $status Not the same as $sel = mysql_query("SELECT projekt FROM projekte_assigned WHERE user = $user"); while ($projs = mysql_fetch_row($sel)) { $projekt = mysql_fetch_array(mysql_query("SELECT ID FROM projekte WHERE ID = $projs[0] AND status=$status"), MYSQL_ASSOC); If this is the case then you can: SELECT ID FROM projekte t1 JOIN projekte_assigned t2 ON t1.ID = t2.projekt WHERE status = $status ORDER BY projnum ASC
  7. There are a few ways you can do this: define('ROOT_URI', dirname(__FILE__)); include ROOT_URI . '/file.php'; Or set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__)); include 'file.php';
  8. Something like this maybe SELECT t1.Name, max(t2.Profile + t2.Website) as total FROM table2 AS t2 JOIN table1 AS t1 USING (ID) ORDER BY total DESC LIMIT 5
  9. What you are looking for is called a join (http://dev.mysql.com/doc/refman/5.0/en/join.html) SELECT * FROM properties AS p JOIN interiors AS i ON p.IntID = i.id WHERE p.id = $pid
  10. - You may want to add a proper tabindex to your links as the quick links can not be reached by using tab only - Provide a text alternative for images that contain text - Your website is not valid (http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fwww.ul.ac.za%2F) - Nor is your CSS (http://jigsaw.w3.org/css-validator/validator?profile=css21&warning=0&uri=http%3A%2F%2Fwww.ul.ac.za%2F) - Your website is also not accessible (http://www.cynthiasays.com/mynewtester/cynthia.exe?rptmode=2&url1=http%3A%2F%2Fwww.ul.ac.za%2F) and as the website is for a university this is extremely important There are probably more but these are already severe errors
  11. I would not use this approach as what if your customer's name is Alidimagit or some other name you might find hard writing. Instead display all users in a table add a button to edit the user's age which passes the user's id
  12. I think you might be better served if you would try: - The Magento forums http://www.magentocommerce.com/boards - The Magento chat http://www.magentocommerce.com/chat - The Magento wiki http://www.magentocommerce.com/wiki/ Alternatively you can: - Buy the book http://www.magentocommerce.com/support/magento-user-guide-book - Read the whitepaper http://www.magentocommerce.com/whitepaper/ - Find a proffesional near you http://www.magentocommerce.com/jobs/
  13. Make sure you don't publish songs of which you are not the author or don't have permission from the author.
  14. ORDER BY rand() LIMIT 3
  15. Keep everything in one thread http://www.phpfreaks.com/forums/index.php/topic,282176.msg1339126.html#msg1339126
  16. $search = stripslashes($search); Is ok if you want to output it in your title bar and magic_quotes is on. However before you insert it into the query you should addslashes
  17. ignace

    Body background

    I second what haku said I also want to add that if you want to use such a technique you must make sure that it works for all resolutions I for example browse at 1680x1050 (16:10) However you can not create an image that is as wide as 1680. Therefor create your image that holds the effect till where it stops (if using Photoshop you can retrieve the spread) fill the rest of the page with your background color like so: body { background-color: #888; /* to fill the entire viewport */ background-image: url(..); /* your image */ background-repeat: repeat-y; background-position: center; /* center the image */ }
  18. I like the design but it has some flaws. It's not optimized for search engines (everything is an image or a flash object, or atleast most of it); Your navigation is not usable (tabbing through your website does not work); Your contact form has no validation (I can send it empty or anything I like); Add some clause to such things unless you want to ship to China as there is no requirement of prior purchase. All pages have the same text (about us and services); Not sure if you are going to fix this but under Services all text remains the same (More than just great coffee.. -> dull);
  19. I agree with tiberrous. Your design looks unproffesional. Also leave out:
  20. That is because mysql_real_escape_string does not work if there is not active db connection to mysql. oni-kun and monkeypaw probably missed that. Try addslashes as this function mentions that it should be used before db insertions. function cleanFormData($text) { $data = trim($text); $data = strtolower($text); $data = strip_tags($text); //$data = htmlentities($text); // by default converts " into &quote; some password's use this character leave it as-is $data = addslashes($data); // adds a slash before ", ', and backticks return $data; }
  21. @crabfinger don't just write some code without thinking about it always make sure that heavy operations (or soon to be heavy) are lazy-loaded $friend_file = 'friends.txt'; $friend_content = file_get_contents($friend_file); if(isset($_POST['fcode'])) { $friend_code = $_POST[fcode]; $friend_content = $friend_content . "\r\n" . $friend_code; if(file_put_contents($friend_file,$friend_content)) { print $friend_code . ' has been added to the friends file.<hr />'; } } In the above code is the file (friends.txt) data read but not used until the form is submitted.
  22. I believe that after the proposed section as suggested by zeroge: should come:
  23. I estimate 10 tables. And the table structure should have primary keys and foreign keys, the fields should have a proper datatype.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.