Jump to content

0x00

Members
  • Posts

    120
  • Joined

  • Last visited

Everything posted by 0x00

  1. yes, because each forum will be using different tables
  2. for this test i create a table with: $s = "CREATE TABLE test_math (x int not null, y int not null )"; then add some data, say: $s = "INSERT INTO test_math VALUES (2, 1), (2, , (2, 3), (2, 5), (2, 7), (2, 4), (2, 6), (2, 2) "; heres my first query... $s = "SELECT x, y, POW(x,y) as z FROM test_math WHERE (POW(x,y) > 16) ORDER BY POW(x,y)"; i can refine it like this... $s = "SELECT x, y, POW(x,y) as z FROM test_math WHERE (POW(x,y) > 16) ORDER BY z"; but is there a way to just do the math once? say like this (no it doesnt work!) $s = "SELECT x, y, POW(x,y) as z FROM test_math WHERE (z > 16) ORDER BY z";
  3. 0x00

    results

    that doesnt work... im currently looking at subqueries, but not sure if its what i need? $query = "SELECT value1, value2, x FROM test_oh WHERE ( (SELECT (value1 * value2) FROM test_oh AS x) >= 300) "; p.s. this also throws an error...
  4. 0x00

    results

    hey, say i have a table such as this - CREATE TABLE test_oh (value1 int not null, value2 int not null) and did a query like so - $query = "SELECT value1, value2 FROM test_oh WHERE (value1 * value2 >= 300) "; how without redoing the calculation could i also get the result, say a bit like this (but not) - $query = "SELECT value1, value2, x FROM test_oh WHERE (value1 * value2 >= 300) as x "; thanx
  5. That doesn't cover the brief. It's inefficient, yes use's some efficiency in places. But my answer to which you (in a lot of posts) say 'try my code', only added 2/3 short lines, less than 2 mins whilst watching 'The Company'. There's some good posts in linuxquestions about efficient coding, for me I have classes for making tables, forms, pagination, email, img uploads and i've not had to touch them (other than php upgrades) for over 3 years, and are very pier reviewed, by experts, university lecturers, banks and the such like. So when you say everyone, do you mean you at 19 and your pal at 18, I've been coding longer than you are old, I remember ZX when it came out, lollipop. P.S. Voodoo just calls you kiddie scripters...
  6. As you'll also notice, it's not really one's code, yet a slight amendment. It succinctly meets the requirement outlined in said brief. If you wanna get atomic, then your 'echo's' don't need brackets, why use escape sequences when there are adequate alternatives. You use multiple if statements which could be incorporated with else's. You $arr multiple times, a bit wasteful don't you think? In C your told you only ever need to use for statements, so both the do I used and your while are wasteful when we get down to it. Yes with my classes I avoid associative arrays for multiple reasons and agree with yours. If we want to get finitikie then you should of setup some css tags for table definitions and others would say, why waste your time with tables at all... To finish, as stated in first post, I wasn't even at a computer with server to test with, and if I hadn't had a few, wouldn't of even risen to this... Just glad i'm also not using my real user! FN: Your boss has just posted to support you, he also should read whole post, and also remember this is a teaching forum. Not so highbrow... Merry Christmas!
  7. Point 2, yep, didn't see that. It was a copy paste once back in forum. Point 1, yep, move it to end of section and change logic to >= or subtract one from it... Whichever position you come from, it's still a whole lotta code less than yours!
  8. Would 'SCRIPT_FILENAME' help? It's just that my cms doesn't use absolute ref's... sorry you did state that you required that!
  9. ? Have you tried it ? What do you mean by point 2? Where? + Your extra code doesn'y do it! P.S. $c doesn't actually refer to an object, it's just a counter, yes you could rewrite it to get rid of one ++ per row, but hey it's Saturday night and i'm at the movies...
  10. I've only had to use 'ob_start()' once and it was short and sweet, yours however is trapped within if statements, and I see no finish to it? But i'm unsure on this usage, so, http://uk3.php.net/manual/en/function.ob-start.php If you say nothing at all is being printed, just maybe...
  11. Isn't that correct?
  12. use as many $_GET and $_POST as you want... (e.g. can use 'get' in form, as in example): <form action="apage.phtml?id=0x00&page=thatone" method="post"> To re-iterate, to use multiple, just separate them with '&'...
  13. Here's another way based on your code: <?php print "<table width='100%' border='0' cellspacing='0' cellpadding='4'>\n<tr>\n"; $c = 0; do { $c++; print "<td><img src='"./photos/sm-display/<?php echo $row_display_cat_photos['small_url']."' alt='IMG'></td>\n"; if($c > 3) { $c = 0; print "</tr><tr>\n"; } } while ($row_display_cat_photos = mysql_fetch_assoc($display_cat_photos)); print "</tr></table>\n"; ?> Here's the phpfreaks snippit way: http://www.phpfreaks.com/forums/index.php/topic,95426.0.html
  14. Personally i'd generate it all from same page, just using different 'get' statements to indicate the stage were at and using session variables to store the intermediate data so that it wasn't getting transferred back and forth. If i'm doing something a bit more orwellian then i'd actually put it all to database, linked to session, then i'd be able to look back and rate how competent they are at filling in forms, before properly assigning new data and aptitude summary.
  15. Do you mean a regular link? <a href='".$_SERVER['HTTP_REFERER']."'>BACK</a> You don't really need to use the '$_GET' system... unless your using mod_rewrite...
  16. Once the comment has successfully been posted into the database, (you should already have the tutorial id), use the id to display the appropriate page. This can be done by including the tutorial page used to display it, or by redirecting using 'header()', http://uk3.php.net/manual/en/function.header.php
  17. Why? You wanted a button!
  18. Also you might like to use either 'include_once()' or 'require_once()' instead of 'include()', http://uk3.php.net/manual/en/function.include-once.php
  19. Not the most elegant but: table width="100%" border="0" cellspacing="0" cellpadding="4"> <tr> <?php $c = 0; do { print '<td><img src="/photos/sm-display/<?php echo $row_display_cat_photos['small_url']; ?>" /></td>'; if(($c % 4) > 4) { $c = 0; print '</tr><tr>'; } $c++; } while ($row_display_cat_photos = mysql_fetch_assoc($display_cat_photos)); print '</tr></table>'; ?> P.S. This is untested...
  20. It is easy. The concept is to just get a selection of results. Which results is offset by a passed page variable that is multiplied by the quantity of results. Then you want to make a set of links...
  21. Thought could use it, look here, http://www.w3schools.com/html/tryit.asp?filename=tryhtml_button and this for more on forms (and other web standards), http://www.w3schools.com/html/html_forms.asp
  22. The concept is known as 'pagination': http://www.phpfreaks.com/quickcode_cats/33/Pagination.php
  23. To get where the request came from use: $_SERVER['HTTP_REFERER']
  24. You've already done it, just don't put any elements in... <form action="lastpage.html" method="post" > <input type="submit" value="Back" /> </form>
  25. Well if someone was to post a file into an area which is processed by the web server before displaying it, and they were to put in some php, then that would get executed (or any other language the server is set up to interpret). That should cover the extent of your question.
×
×
  • 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.