Jump to content

btherl

Staff Alumni
  • Posts

    3,893
  • Joined

  • Last visited

Everything posted by btherl

  1. Try removing the quotes from now(). The string 'now()' is in invalid format for a date, but the value returned by the function now() will be a date.
  2. Can you post the exact command you use and the exact error message? I'm not too familiar with postgres in XP, but I may be able to help.
  3. Your queries should look like this: $res = mysql_query(...) or die(mysql_error()); Right now you're checking for the error in the wrong place, although it works by luck. As for finding the error, try rewriting your queries again like this, so you can inspect the query you are executing: $sql = "SELECT ..."; $res = mysql_query($sql) or die("Error in $sql\n" . mysql_error()); Then you can see the query which failed. If you can't find the syntax error in the query, post the query here for us to look at.
  4. md5decrypter.com doesn't actually do decryption. It looks for an input which hashes to the same value. There may be any number of other inputs which give the same md5 hash. To call that decryption is misleading.
  5. It may also be your firewall preventing access. If you have any firewall software installed, try disabling it for a moment to test it (or enabling access to port 3307). Another thing to try is running "telnet 198.168.123.112 3307" from the command prompt (that's Start -> Run in XP). If the connection fails, then either it is being blocked, or the server is configured not to accept connections on that IP. Unfortunately I can't help with getting the server to accept connections if it doesn't, since I'm not that familiar with mysql.
  6. Hi Brian, I'm Brian Sometimes it's the easiest things that are the hardest to spot.. In your include file, you set $user, but in Login.php you use $username. That results in an empty username being passed, which somewhere gets changed to a default "ODBC" username.
  7. Looks fine to me except for the incrementing.. that'll give you L2 -> L20. Just start with $i = 0 and that will fix it. You can also use either foreach (range(1,20) as $i) { $allowed_fields[] = 'L' . $i; } or a C style for loop: for ($i = 1; $i <= 20; $i++) { $allowed_fields[] = 'L' . $i; }
  8. It really depends on who you're up against. If you have a small user base, don't bother with advanced techniques of bot detection. If your images are sufficiently complex that someone would have to put some effort into defeating the mechanism, then you're already safe from 99% of spammers. Most of them want methods that work on hundreds of sites, or one large sites, and will not bother with a small site.
  9. Can you put var_dump($_POST) or print_r($_POST) at the top of your script, and verify that only the fields you expect to be blank are actually blank? I suspect it's just that your input is not what you expect.
  10. Hi, The problem is there is an extra space in your code. Possibly it was introduced during cut and paste. The correct code is: $pcodesearch=mysql_query('SELECT `postalcode` FROM `pcode` WHERE `postalcode` REGEXP \'^[a-z]{1}[0-9]{1,2}\' LIMIT 0, 30 ')or die(mysql_error()); Notice the space between the first \ and ' is gone.
  11. I'm not suggesting you add that to your script. I'm just demonstrating that if you say "0 or die", then php will die. In your script you call "mysql_num_rows() or die()". But if there are 0 rows returned, php will die, because 0 is "equal" to false in php. Was validUser() ever tested on its own?
  12. Hi magic, I took a closer look at your code.. try the following short script $a = 0 or die("0 is treated as false by 'or'\n"); Then look at your validUser() method
  13. Perhaps I'm misunderstanding something, but would not using the browser's back button solve the problem? In general, you can't rely on the back button, as it will display the page as it was retreived earlier.
  14. I still don't understand the problem. Checking if $row[2] == "" will succeed (and NOT go to the else branch) in the following cases: 1. $row[2] is "" 2. $row[2] is 0 3. $row[2] is '0' 4. $row[2] is null 5. $row[2] is not set 6. $row is not an array And perhaps others I've forgotten. If you want to check for exact equality, rather than the "loose" equality of ==, you should use ===, like this: if ($row[2] === "" || $row[2] === " ") { ...
  15. Those two pieces of code you posted do different things. I did a few tests and can't find any circumstance where php 5.2.1 acts differently from 4.3.10 Both versions of php match 0, null and "unset" as being equal to "", which is what normally would happen. Can you show var_dump($row) for the case where that if statement acts differently to what you expect?
  16. Does this summarize what you want? "All records for each fire which engine 11 responded to". Algorithmically: 1. Fetch fire identifier (PK) for each fire responded to by engine 11 2. Fetch all records for each fire from step 1 Normally it would be done using a subquery. Instead, you can use a temporary table. Someone more familiar with mysql could give you the details, but I imagine you would create the temporary table containing PKs of all fires responded to by engine 11, and then join with that temp table to get your final list of records. Or, you could join once again with your data tables with different aliases to get the data you want. In that second join, you would NOT apply the condition on engines. As a result, you would get all rows you wanted from that second join. It seems messier than the temp table approach, but logical. Essentially, the first joins would restrict the data to engine 11. Then the second join with the same tables would do the "expand by" that you want, as you are joining on the set of restricted PKs, but without the engine restriction applied to the second join of those table. As for writing the actual query, I need to see your table definitions. The query is mindbending enough without them.. Aha, artacus did it while I was busy typing Nice job.
  17. Can you guys give some examples of else statements that aren't working as expected? I don't see anything in the bug reports that resembles this.
  18. You need to call mysql_fetch_assoc() once for each row. Each time you call it, it will return the next row. Typcially it looks like this: while ($row = mysql_fetch_assoc($result)) { // do stuff with $row }
  19. Hmm.. this ought to work: $res = mysql_query(...); while ($row = mysql_fetch_assoc($res)) { extract($row, EXTR_OVERWRITE); } But that will only work for a single row.. Actually, I don't really understand what you want Since using $fieldName = $row['fieldName'] will only ever work with a single row at one time. I'm not sure where you want the data to go after that.. The method above means you don't need to make any record of which columns are in the table. But there is the question of how those variables get back to the calling function. Usually I return an array like this: $arr = array( 'fieldName' => $fieldVal, 'fieldName2' => $fieldVal2, );
  20. As a start I would suggest one table listing the lessons and one table containing all the objects (or possibly one image table and one hypertext table). Then you would also have a table that links lessons and their objects together. There are efficiency advantages to having smaller tables and one for each lesson, but the administration can get quite messy. As for where to start, look for some tutorials and complete them. The topic is too large to cover here.
  21. I don't see why it's not possible. You can use functions like extract() and array_map(), or just foreach loops. What I do is I write functions which do a particular task with the database, which may involve several tables, but which acts as a single unit. I don't make interfaces for each table, as I rarely use any table in more than one or two different ways. I work at a different level of abstraction.
  22. It sounds like your web server is not configured to run php.
  23. Call mysql_real_escape_string() on every string that you pass to the database. For non-string data, you will have to do other checks. To get an idea of what's going on, try printing your data before and after escaping, as well as the query. Try inputs which include characters like ', ", ;
  24. Ok.. I don't understand what you are asking. What do you expect to happen? What is actually happening? Some advice: Check all your mysql_query() for errors like this: if ($resultprop === false) { die("Error in $sqlprop: " . mysql_error()); }
  25. Reposting with formatting.. <?php $allprop_id = explode(",", $prop_id1); for($i = 0; $i < $selected; $i++) { $test = $allprop_id[$i]; echo "$test "; // displaying the correct values of $test for the current values of $i $sqlprop = "SELECT * FROM property where prop_id ='$test'"; $resultprop = mysql_query($sqlprop); while ($row=mysql_fetch_assoc($resultprop)) { $email=$row["$email"]; $prop_id = $row["$prop_id"] ...........; $sqlfn_new = "INSERT INTO enquiry (email, prop_id, ......) VALUES('$email, '$prop_id', ......)"; $resultfn_new = mysql_query($sqlfn_new); // inserting the same first values all again echo "$test "; // keep on displaying the same value of $test for $i = 1 } echo "$test "; // display the correct values of $test for the current values of $i } ?>
×
×
  • 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.