Jump to content

jcbones

Staff Alumni
  • Posts

    2,653
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by jcbones

  1. It isn't a matter of using a 12 hour clock or a 24 hour clock, it is a matter of how to store it in MySQL. It should be stored in a DATETIME column or a TIMESTAMP column, to do so it will need to be in the 24 hour clock configuration of YYYY-MM-DD HH:MM:SS . This is the preferred way to STORE the date or time, because it can then be accessed, sorted, added, subtracted, differenced, or any other of the many built in functions that MySQL has for dates and times. The neat thing is that one of those functions is a DATE_FORMAT() function, that will return it in any way that you please. What I am trying to tell you, is that you must separate the logic of storing and displaying. Once you have the data stored in an efficient way, you can display it however you want. Perhaps you would want to change how it is displayed in the future, with properly stored data, it is an easy task.
  2. Don't supress errors: $qty= @$_POST['quantity']['$i']; //<- you are supressing errors by using @. You would then find out that your $_POST array is NOT set, because you need a form for that. Add a form to index.php so that you can get the input values back to the page.
  3. }else{ //debugging echo mysql_error(); //end debugging echo 'sorry we could not register you'; }
  4. Your query is failing, and returning a boolean false, not a resource. Check mysql_error() for the failure, then change everything to mysqli or PDO
  5. I would say "DON"T REMOVE THE die()", but change it to trigger_error(). This is so that when you site goes live, it will process it as an error, and store it in the log file with the rest of them.
  6. Sorry, I scanned to quick, thought there was a missing bracket on the if clause. To be honest, you took part of a script that I wrote, and factored in some of your own logic that would in no way work out correctly. The script I showed would dynamically pick up any url in the foreach loop, and link a css file to it. IF and only IF a matching css file was found, in the css directory. The script was changed by you, to load a css file ONLY if a url to a specific website's page was found.
  7. You must be using Chromium. This forum hates Chromium. Once you post a BBCode, it won't post anything else.
  8. Yeah, you have parse errors. You should be working with: error_reporting(-1); ini_set('display_errors',1); Secondly, try commenting your scripts, so that you can follow the logic.
  9. I copy/paste'd your code, and ran it. This is what I got:
  10. [ code ] and [ / code ] should still work.
  11. You need a closing brace, right before ?>. This will finish out your foreach loop. You should have error_reporting on full, and display_errors on, and you would have seen the error.
  12. Try this: <?php $DomDocument = new DOMDocument(); $DomDocument->preserveWhiteSpace = false; $DomDocument->load('http://www. el sitio .com/index.php?option=com_xmap&view=xml&tmpl=component&id=1'); $DomNodeList = $DomDocument->getElementsByTagName('loc'); foreach($DomNodeList as $url) { $file = '/css' . strrchr($url->nodeValue,'/') . '.css'; //get the the string from the last occurrence of / to the end of the string, appended to /css. Edit: append .css to the end of it. if(file_exists($file)) { //then check if that file exists where it is suppose to. echo '<link href="' . $file . ' rel="stylesheet" type="text/css" />'; //if it does, echo the link. } } ?>
  13. Even at that, they can highlight the page, then select view selected source, and it will show the source. Even if loaded with javascript.
  14. You are most likely looking for AJAX. Since the form is acting as it should with the page request.
  15. Change your form: <form action='".$_SERVER['PHP_SELF']."' method='get'><input type='hidden' name='event_id' value='".$this->row['event_id']."' /> <input type='submit' name='show_attendents' id='show_attendents' value='Show Attendents' /> </form> Change your method: if(isset($_GET['show_attendents'])) { $event_id = (int)$_GET['event_id']; And $stmt->execute(array( ':event_id' => $event_id )); See if that gives you anything (errors or otherwise). Please post back!
  16. Un-Tested Edit: I missed something important. There is a need to pass the value types also, which needs to be PUSHED onto the front of the $values array, before the call_user_func_array() function is used. $columnsAndValues = Array("username"=>"userInputedUsername", "password"=>"userInputedPassword"); //array that holds value data. $count = count($columnsAndValues); //count the number of placeholders we need. $markers = array_fill(0,$count,'?'); //fill an array with the number of placeholders. foreach($columnsAndValues as $key => $val){ //go through the array. $columns[] = $key; //assign the columns by keys. $values[] =& $columnsAndValues[$key]; //referencing the values into an array. } $queryString = 'INSERT INTO someTable ('. implode(',',$columns) .') VALUES ('. implode(',',$markers) .');'; //build the query with the columns and placeholders. if(!stmt = $mysqli->prepare($queryString)) { //if the query fails to prepare, then dump an error. trigger_error($mysqli->error,E_USER_ERROR); } if(!empty($values)) { //if the values array isn't empty. call_user_func_array(array($stmt,'bind_param'),$values); //pass everything to the bind_param function. } if($stmt->execute()) { //then execute it. //get your data; }
  17. Never heard of someone setting default POST variables before. Why do you wish to do this?
  18. Because $c will always be true if you set it to three, but I think you want to compare it to three. So you should add another equal sign to that. = //assignment == //comparison === //strict comparison
  19. Select date in format day-month-Year (01-01-2001) from a date column. SELECT DATE_FORMAT(date_column,'%d-%m-%Y') AS date FROM table
  20. What does $fileinfo->extension contain?
  21. IIRC, Innodb doesn't do full text searches, but MyISAM does. That would be the only reason, I can think of, for someone to use MyISAM, if they needed that functionality.
  22. What I see, is this: $place = "1"; //create variable assigning it the number 1: should not be in quotes, but will work that way. $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)){ $place++; //increment the number. $str = $row['type']; $exclude_list = array("LADIES","JUNIOR","SENIOR"); if(!in_array($str, $exclude_list)){ You are incrementing the variable $place, BEFORE checking to see if you are going to exclude the row. You should do it AFTER you make sure the row is NOT EXCLUDED.
  23. Edit, this forum hates Chromium. I'm not typing all that again. I'm sure you can do all this in one query, post the database structure. You should be selecting only the columns you wish to use, less overhead. <?php if(!empty($results2)){foreach($results2 as $res2){ //1st loop?> <?php if(!empty($products3)){ foreach($products3 as $pro3){ //2nd loop?>
  24. Not sure that MySQL can though! Which is what Vinny was sayin`. Edit: I know you can from the MySQL CLI, but I think that is the limitations.
  25. Your database column is set to an integer type. So it will not store strings, or alpha characters.
×
×
  • 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.