Jump to content

cags

Staff Alumni
  • Posts

    3,217
  • Joined

  • Last visited

Everything posted by cags

  1. Your going to have to give more information. The latest table information displayed doesn't seem to have any relevance to your question you originally posed. Is this a seperate table that in some way relates to the orginal?
  2. There is no advantage of using the option you proposed since the example I gave is case insensitive anyway. That's not to say preg_match couldn't allow for more advance filtering. The problem with both the example given by MatthewJ and the one given by myself is you *might* get false possitives. If for example you wish to filter out ass, it will return "This is a class" as containing a banned word. You could try placing spaces either side but then it will not pickup words followed by grammatical characters. If you wish to filter all these cases then preg_match would be the only sensible option, but it won't be the simplest match string if you wish to filter effectively.
  3. I don't understand the question. The whole point of the approach is you eliminate the need for the switch statement because each page is it's own independent page. So you have no need of varying the include based on the requested page.
  4. Well ORDER BY should be at the end also since date is a keyword you might wan't to also put it in backticks $query="SELECT * FROM `calls` WHERE `status` = '1' AND `priority` != 1 ORDER BY `date` ";
  5. It's not technically an 'error' perse, it's a notice. Basically it's telling you that you are trying to access an item in an array using the key REQUEST_URI, and there is no item in the array with that key. Generally you can surpress the notice by checking... isset($_SERVER['REQUEST_URI']) ...before using the value. Though it seems odd that particular key wouldn't exist.
  6. If theDate is the name of a column in the table that contains the date's you wish to order by, that is the correct syntax.
  7. Something like.. <?php function check_words($str){ $bad = array('fuck','shit','ass','cunt','dick','penis','whore','douche','clit','boob','nipple','sex','http://'); foreach($bad as $word) { if (stristr($str, $word)){ return true; } } } ?> ... will return true if there is a bad word in the string.
  8. Oddly enough your pseudo code is almost exactly how it is. The exclaimation part means not, and they empty() function checks if the string provided is empty. if(!empty($_POST['name'])) { $name = trim($_POST['name']); }
  9. Is the type of Physician_ID integer? If so try... mysql_query("SELECT * FROM physicians WHERE Physician_ID=" . $_POST['pat5']) or die (mysql_error());
  10. You could loop through the array passing preg_match an item at a time. foreach($items as $item) { preg_match(); } But if your simply checking words and no complex patterns you might be better off using stristr instead of preg_match, depends on the approach your after.
  11. I divide by 18 because thats the same as dividing by 9 then dividing by two. It obviously assumes that you will always have 9 items, but since this is a table which should have a fixed structure this should always be the case. LEFT JOIN will return all rows from the left table, even if there are no matching values in the right table. That's the whole point of a left join, if you only want rows where they match, omit the LEFT keyword.
  12. I believe your option of searching for specific words will be the only real option. There is no characteristic that is specific to postitive or negative terms such as these (to my knowledge).
  13. Yes, but the location of the script that's running the code is irrelevant, the important factor is where the top level script is. Assuming in your example change.php is the top level page then the relative path to data.txt is '../data/data.txt'. But that will only work if change.php is the top level script, not the file being included.
  14. str_replace("," ," ",($row_rsseller['price'])); Will put a space (whitespace) in your string, causing problems, whereas... str_replace("," ,"",($row_rsseller['price'])); ...will replace the comma with nothing so it should work fine. If you were having problems it's more than likely the way your using the function not the function thats at fault.
  15. As a stop-gap, you could put... extract($_POST); ... at the top of your script. But you would run into the same potential security issues that led to register globals no longer being the default.
  16. I believe the path should be relative to the Main file, not the included file. So if you have -root --file1.php --includes ---file2.php --files ---data.txt And file1.php is include'ing file2.php, with file2.php being the script that is accessing data.txt. The path would be 'files/data.txt'.
  17. As PHP is not a syncronous technology, that is to say there is not a permanent flow of data between the client and the server, you will probably need to track the time period since the user last accessed a page and logout after a period of time. So your active_users table will have a field for last_access, whenever a visitor views a page that displays a list of active_users you would compare the current time to the last_access time for all active users and remove any that have been longer than your timeout period before displaying the list.
  18. I'm confused. The use of... echo str_replace("," ,"",($row_rsseller['price'])); ... seems to me to indicate you are removing commas from the item before outputting it to the form, this has nothing to do with adding it to the database. The use of str_replace() (in the exact format you have) should work, providing you are doing it to the value your inserting into the database.
  19. I understand it's a learning forum, which is why I explained how to solve your problem. If I do it for you then you will have a piece of code that works, but you will have learnt exactly f*ck all and will likely have the same problem the next time you come across a similar situation. The fact is if you don't understand the example you could have asked for clarification but instead you called me a dick. Very mature. If you wish to build a garden wall it's ok to ask somebody how to build a wall, but don't expect them to built it for you.
  20. The simplest way is to not use spaces in the url. If you are dymanically creating links use urlencode to convert spaces to a different character.
  21. I'm a dick because I won't write your code for you? Fair enough.
  22. No, I will not write your code for you. To fetch variables that have been submitted by a form with the method of post you would do... // if <input type="text" name="username" /> and you want to access the username, you use $_POST['username']
  23. At the top of both pages you would need to join a session (call session_start()). Then in the first page you would $_SESSION['title'] = $_POST['title']; $_SESSION['name'] = $_POST['name']; $_SESSION['insurance'] = $_POST['insurance']; $_SESSION['address'] = $_POST['address']; $_SESSION['phone'] = $_POST['phone']; $_SESSION['email'] = $_POST['title']; $_SESSION['registration'] = $_POST['registration']; $_SESSION['comments'] = $_POST['comments']; In the second page you would then use the $_SESSION array to retrieve the values in much the same way you were trying to use the $_POST array.
  24. I don't understand the question? From your description it sounds like you wish to search your php files for occurances of the asterisk. That being the case I can't see why you wouldn't just use any text editor and use the Find function, as I see no real point in searching a php file with php. Perhaps I'm not understanding you.
  25. If you mean after forwarding to an independ page then it wouldn't have passed the values on. If you are using the header() function to redirect then the $_POST array would be empty. You need to persist the data. The simplest way of doing this would probably be starting a session and saving them in the $_SESSION array.
×
×
  • 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.