Jump to content

premiso

Members
  • Posts

    6,951
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by premiso

  1. <?php $currentYear = date("Y"); for ($year=$currentYear;$year>($currentYear-20);$year++) { echo $year . "<br />"; } ?> Should do it.
  2. I am not sure if there is a better way to do it, I am sure there is but this would work: preg_match('/(^[0-9]*)/i', $user, $matches); if ($matches[1] != $user) return array(false, "Username must contain at least 1 Numeric (123) character.");
  3. A few questions, where are those variables coming from? A form? If so you should really be escaping the data with mysql_real_escape_string. You should also access them with $_POST or $_GET. The or die(mysql_error); should be added after the mysql_query click on the links I posted for examples.
  4. Your not filtering the post input. If a person knows your host structure they can basically read any file on your server with that script. I would suggest validating the url input to avoid this issue.
  5. where band LIKE '%$query%' Use the like operator. You probably want to split the incoming data at the space and then use that as keywords. Just an fyi.
  6. There is no kitty like a drunk kitty!
  7. Could you clarify this? The end user only see's one column populated in the dropdown. I can't seem to work out why we're calling on two as per the query. I know this is the correct way but I just don't understand it. @Mchl: Ah, I see. Very neat indeed. Still at the dropdown junction though You pull 2, the display value then the passed value which is usually an id. This is common practice.
  8. Use parenthesis to group it, just like math. Order of Operations. So if (x and x) OR (x and y) return the results.
  9. You need a semi colon after this line: ftp_chdir($ftp_connect, "/u/ssc/price/");
  10. Yes, but this was known since 2002, programmers just cannot write books very well. The issue of register_globals is just really sinking in and being acted on.
  11. Obviously that will not work, look at the format. $date = date("Y-m-d H:i:s") It should enter properly using that.
  12. You need to use $_POST['formfieldname'] to access them.
  13. You would use Javascript or AJAX. PHP cannot do this alone. And a tip, let go of the shift key, no one likes titles in all caps.
  14. Ummm.... $query = "SELECT message, terms FROM xxx WHERE MATCH (terms) AGAINST (message)"; $result = mysql_query($query); while($row = mysql_fetch_assoc($result)) { echo "Terms : {$row['terms']}<br>"; } That is how you would do it...
  15. mysql_query("INSERT INTO xxx (name, message, created) VALUES ('$name', '$message', NOW()) SELECT message, terms FROM xxx WHERE MATCH (terms) AGAINST (message)") or die(mysql_error()); to mysql_query("INSERT INTO xxx (name, message, created) VALUES ('$name', '$message', NOW())"); $query = "SELECT message, terms FROM xxx WHERE MATCH (terms) AGAINST (message)";
  16. Easy, you just use the timestamp to pull up the month you want.
  17. i'm not matching words in query, i'm trying to match any word in the user submitted 'message' field with any word (over 4 chars) in the 'text' field. Gotcha, so you are using single quotes around the message field being returned from the form? You also need to separate the INSERT and SELECT query. You have them as one. Separate t out ad see what happens.
  18. How many rows do you have in your db? Also you need single quotes around terms and messages. If you have less than 5 fields and at least 3 of those fields have terms or messages in it, that will not return them. Fulltext indexing has that as a rule, if the results return 50% of the rows, no rows are returned. I would read up on the full text so you know what to expect.
  19. Your better off using a CRON job or Scheduled task for this. PHP is not meant to do this type of stuff.
  20. Like this: <?php $conn = mysql_connect($dbhost, $dbuser, $dbpass); mysql_select_db($dbname) or die ('Error connecting to mysql'); ?> Did you try it? Yes, like that.
  21. use mysql_select_db after mysql_connect
  22. What do you mean split those felds into different variables? When you post the form? Add a : inbetween them, then on form processing use split or explode it at : to put the different values into an array and access by index of 0 or 1.
  23. http://us.php.net/manual/en/function.ziparchive-close.php Found that, use that instead.
  24. You want url rewriting. I would look into that. robots.txt will not fix this.
  25. You know pritnig out the actual error message may help. <?php if(isset($_POST['submit'])) { include 'config.php'; include 'opendb.php'; $home = $_POST['home']; $mot = $_POST['mot']; $pf = $_POST['pf']; $fi = $_POST['fi']; $loc = $_POST['loc']; $con = $_POST['con']; $ms = $_POST['ms']; $dis = $_POST['dis']; $query = "INSERT INTO cms (home, team, form, financial, location, contact, mission, disclaimer) VALUES ('$home', '$mot', '$pf', '$fi', '$loc', '$con', '$ms', '$dis')"; mysql_query($query) or die('No worky: ' . mysql_error()); include 'closedb.php'; echo "Worky!"; } ?> mysql_error would help you. My bet is you have a ' single quote in your data coming in and mysql_real_escape_string that data will probably fix it.
×
×
  • 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.