Jump to content

king arthur

Members
  • Posts

    335
  • Joined

  • Last visited

    Never

Everything posted by king arthur

  1. Where are the included files? Are they in a different directory? You can work around the problem by using require_once() instead of include() but you should try and figure out why the functions aren't defined and fix that properly.
  2. Because you have omitted the day and year parameters they will default to now. Since it's currently 30th June, and you can't have a 30th February, mktime() converts it into March for you.
  3. It may be something like, the production server has register_globals turned on, and the installation on your laptop doesn't. Check each by running phpInfo().
  4. $id does not appear to be defined, therefore your mysql query will return zero rows, therefore your while loop will never execute.
  5. In your class.php, you need class mysql { var $connection; function Connect($host, $name, $pass, $db){ $this->connection = mysql_connect("$host", "$name", "$pass"); mysql_select_db("$db", $this->connection); }
  6. Simply run a piece of javascript that disables the submit button, before your form. If javascript is not enabled the button will be left enabled.
  7. If you have this on every page, then your curr_page variable will always be set. So copying it to last_page before setting it, will always give you the previous page except when the visitor first lands on your site.
  8. Well not necessarily, you could possibly pass the session ID to the javascript which then loads in a dummy image script with the session ID as a parameter, the image script performs the necessary functionality then creates a 1x1 pixel image which never gets used.
  9. You will need the javascript "onclose" event for that. There is no way on the face of it that the server on its own can tell what the user does with his browser.
  10. JS is a client side language - it runs in the browser, so the page has to load for the browser to be able to parse it. What is it you're trying to do?
  11. Well, what code have you written, what does it do and what error messages are displayed if any? The code sample I gave was just an example of how to do it, something for you to base your solution on not to take as being a fully working script!
  12. Something like: $query = "select * from users where sn='$user'"; $result = mysql_query($query) or die(mysql_error()); if(mysql_num_rows($result) > 0 { header("Location:error.php"); } where error.php is the page that handles that eventuality.
  13. You've replaced the semi-colon again! So the IF statement will do nothing and the mysql function will always run regardless.
  14. Actually he will want to use && instead of || if you write it like that. "If $user is not empty AND $pass is not empty, THEN put them in the database".
  15. Remove the semi-colon from the end of the first line.
  16. Simply add a GET variable to the URL in the link. Use this GEt variable to determine the string with the "order by" clause in it. I usually use a switch statement for this kind of thing. For example, at the top of your code: <?PHP $order = $_GET["orderby"]; switch($order) { case "date": $order_clause = " order by start_date"; break; case "title": $order_clause = " order by title"; break; default: $order_clause = ""; break; } $db = mysql_connect("localhost","root","pass") or die("Problem connecting"); mysql_select_db("testing") or die("Problem selecting database"); $query = "SELECT * FROM teaching" . $order_clause; I've assumed two columns in your databse called "start_date" and "title" there, obviously insert the real names if those aren't right. Also I've only done cases for two columns, you may or may not want others. Further down, echo "<TABLE class=\"maintable\" BORDER=1 frame=box width=100% CELLPADDING=0 CELLSPACING=1 >\n"; echo "<TR bgcolor=\"lightblue\"> <TD>Start Date <a href="thispage.php?orderby=date">(order by)</a></TD> <TD>Title <a href="thispage.php?orderby=title">(order by)</a></TD> <TD>Education</TD> <TD>Institution</TD> </TR>\n"; Replace "thispage.php" in the links with the actual name of your script. And again, I've only put those two in. Try something like that, it's how I do it.
  17. You shouldn't need to do all that stuff with the different queries to get the rows. Just use $query_rsFiles = "SELECT * FROM xl_members_files WHERE public = 'Yes' AND username = '$username' limit $startRow_rsFiles, $maxRows_rsFiles"; Your main problem however is that I see no loop anywhere that iterates through the rows returned?
  18. Looks like your problem is here $sql="SELECT * FROM users"; $result=mysql_query($sql); You are selecting all the rows in the users table, and presumably the first row is for user "admin". How is the user id passed in to this script, as you will need to rewrite that query to only fetch the required row.
  19. What are you using to test the page? It's possible, although unlikely, that the browser has security settings set so that it does not accept the session cookie. If this is the case and you have session.use_only_cookies set, then you will lose the session between pages. Also I think to include a file you need the syntax: include ("chartfunktions.php");
  20. I seem to remember a problem like this, try using relative URLs instead of absolute ones.
  21. It looks to me like you are getting confused with your code structure there. I think what you want to achieve might be accomplished with a single query with a simple join on the two tables, and a single while loop. Currently you are going through the first while loop and not actually doing anything with each row, so in the second loop the if statement will always be using the final result from the first one.
  22. It's not much good posting snippets of code from each page and leaving out other critical parts, we can't see how what you've posted actually works or how it might not be working.
  23. No you can't. Your first while loop will loop through all the rows in the result resource until there are none left, hence your second while loop will not find any more rows to loop through.
×
×
  • 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.