Jump to content

btherl

Staff Alumni
  • Posts

    3,893
  • Joined

  • Last visited

Everything posted by btherl

  1. For storing in the database, mysql_real_escape_string() is the right function. For when you want to display the data again, see fert's comment above
  2. You need to connect to the database first. Also change the following line so you can see errors: $result = mysql_query("SELECT * FROM `uploaded_files` WHERE `date_added` <= ".$stamp) or die(mysql_error());
  3. You forgot to ask your question
  4. Do you mean something like this? while (true) { print "Hello\n"; sleep(60*10); }
  5. Zend optimizer may have modified your php.ini and possible moved it somewhere else (I'm unclear on how it works in windows). You might want to check all your copies of php.ini on your system and see if anything looks like it's missing.
  6. Well, "it depends" Is the code so sensitive that someone who already has access to your database would gain additional power or information by having access to that code?
  7. Where do you have an option of ANSI or UTF8? What browser and OS are you using? "octet-stream" means that there is no character encoding, because no interpretation of the data should be done. So really you should never be asked what encoding to use if you are downloading an octet stream.
  8. It's saying that you're not giving the parser a valid XML document. Have you checked that $data is really XML? In any case, your loop will limit by number of characters read, not by xml elements. To limit by xml elements you should put the counter inside your tag handlers. You can use static variables or global variables to keep track of the count, same as you are doing with variables like $tag, $description, etc
  9. ikanku, remove the var_dump() you added and add this code outside your ExecuteQuery (on the line before): print "\$this->incident looks like this: ";var_dump($this->incident);print "<br>\n"; print "\$this->incident->startDateTime looks like this: ";var_dump($this->incident->startDateTime);print "<br>\n"; $this->dao->ExecuteQuery( ... And see what it outputs. It should tell you exactly which thing is not an object. Then you need to work out why it isn't an object.
  10. Do you set $filler to empty if the price is >= 10000, after setting it to " " for a previous value?
  11. You can copy the information over.. or you can access DB1 from the same script that accesses DB2. Without more information I can't advise you on details. One option would be to trigger copying of the information only when someone needs the data. FYI, many people think only one mysql database can be used from one script. In fact, you can connect to as many as you want, but you must pass the right "handle" (that you get from mysql_connect()) with each query, to say which database you want to use.
  12. Try using mysql_real_escape_string() on the data item before you put it in your mysql query. Single quotes are part of mysql's syntax.
  13. btherl

    SELECT * ?

    It probably won't affect the speed to fetch data from disk, as the entire record will be in a single page. But it may affect the speed to send data over the network (if you are doing that). And if you have a large result set, you will notice that more. If the mysql server is on the same machine as your script, you probably won't notice much difference.
  14. What you need is a "left outer join", or "left join" for short. That means "Return rows from the left table even if there's none in the right table". Here is the whole statement in join style: Select * from ahsg_directory JOIN ahsg_directory_category ON (dir_id = dirc_dir_id) JOIN ahsg_subcategory ON (dirc_sub_id = sub_id) LEFT JOIN ahsg_directory_location ON (dir_id = sloc_dir_id) WHERE sub_id = '3' and (sloc_default = 1 OR sloc_default IS NULL) I added another condition "sloc_default IS NULL" which will let you get rows where the left join produced nulls in that table.
  15. You need to set $i =0 inside the outer loop, otherwise it will not be reset for the second time the inner loop runs.
  16. What is the use you have in mind? Then we can offer an appropriate solution.
  17. That makes it difficult.. as we can't see output from the script. Are you able to call your script directly for testing purposes?
  18. I think it may be due to now() arithmetic.. check out the manual here: "NOW() Returns the current date and time as a value in 'YYYY-MM-DD HH:MM:SS' or YYYYMMDDHHMMSS format, depending on whether the function is used in a string or numeric context. The value is expressed in the current time zone. mysql> SELECT NOW(); -> '1997-12-15 23:50:26' mysql> SELECT NOW() + 0; -> 19971215235026" That indicates to me that now() - 15 doesn't do what you think it does, as the date is not in "number of seconds" format. Here's the reference for mysql dates and times: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html
  19. You should only send the 401 header if authentication fails. The rest of your script runs even though you have indicated failure with the headers, which is why the session vars are set.
  20. Two issues could be relevant here.. Often the command line and web PHP use different executables. Also, they often use different copies of php.ini So either one of those could cause the problem. I can't give you any more detailed help as I'm not too familiar with php on windows.
  21. Do things change if you alter the magic "15" in your select query? I suspect this may be a timing issue. Try dropping it to 10 or 5 and see if you get more single results.
  22. That is so horribly complex! I suggest you seperate out the lists and the "set active" components of your code. Like this: $topmenu = array( '4.php' => 'Statistics', '9.php' => 'GUESS', ); $html = make_active($topmenu, '4.php'); print $html; function make_active($menu, $active) { foreach ($menu as $p => $t) { if ($p == $active) { print "<li><a class=\"main_nav_active_item\" href=\"$p\">$t[/url]</li>"; } else { print "<li><a class=\"main_nav_item\" href=\"$p\">$t[/url]</li>"; } } } Does that make sense from the example alone? The idea is to make it so you only need to put each of your menus once in your code, and then you generate the version of the menu with a specific active item (the $active argument to make_active()).
  23. Replace $result = mysql_query($query); with $result = mysql_query($query) or die("Error in $query\n" . mysql_error()); And remove the "@" from mysql_result(). If you don't get any errors, add this line below the mysql_result() line: var_dump($clb_id); and post what you see
  24. Can you post the actual error message? It may that you need to use mysql_real_escape_string() on each of your column values before using them in the insert query.
  25. Can you post the code that gave you the syntax error?
×
×
  • 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.