Jump to content

AyKay47

Members
  • Posts

    3,281
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by AyKay47

  1. C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\Epointment\index.php:4 this is where the ouput is started.. wheres that line of code here
  2. <?php $string = "<h3> <span class='author'> Author: </span> <span> <a href='/catalog/list_author_titles?author=John+search=search'>John </a> </span></h3>"; $pattern = "~Author: .*~i"; preg_match($pattern,$string,$matches); foreach($matches as $match){ print $match . "<br />"; } ?>
  3. im not an expert at mysql, don't try to be.. however something is going wrong with your alias of the displaydate field.. so try removing the alias.. mysql_query ("SELECT *,DATE_FORMAT(displaydate,'%Y-%m-%d') FROM `2011-09` WHERE displaydate <= CURDATE() ORDER by day_id DESC") or die(mysql_error());
  4. thas what forms are designed for, sending user data to either another page or the parent page to be sanitized,cleansed,stored, etc..
  5. my mistake.. that error simply means that you r query is failing.. add a die() after the query to receive a specific error.. mysql_query ("SELECT *,DATE_FORMAT(displaydate,'%Y-%m-%d') as thedate FROM `2011-09` WHERE thedate <= CURDATE() ORDER by day_id DESC") or die(mysql_error());
  6. thats saying that you dont have a table called. "2011-09" in your database..which you call in your query
  7. why are you opposed to using a form..? if it's not user input that you are passing, there are a number of different ways to approach this
  8. you can use hidden inputs with jquery or AJAX.. however how would this be dynamic data? im assuming it isn't user input data..
  9. what error..? going off of strictly what you stated.. mysql_query ("SELECT *,DATE_FORMAT(displaydate,'%Y-%m-%d') as thedate FROM `2011-09` WHERE thedate <= CURDATE() ORDER by day_id DESC");
  10. To quote someone else from today "I hate to turn your posts back at you, but . . ." His example shows the scores sorted in reverse order. If the scores are the values then the function to use would arsort() which will sort the values in reverse order and maintain index association. however this might be an example array.. we are not sure if the array will be in reverse order everytime.. I like choosing the order manually here, however if the array is always in reverse order.. then yes arsort() would be a good option.. The OP gave an example of how the records were to be sorted. The only thing that is sorted in that example is the score - in reverse order. I am not going to make wild conclusions based on information that the OP did not provide. Even, ManiacDan had suggested using a reverse sort, he just goofed and provided a function that would sort by the name instead of the score, which is clearly not what the OP is looking for. going off of strictly with what the OP provided, yes the solution given would be the best way to approach this
  11. placing the newline and carriage return in single quotes will parse them literally Edit: however preg_match handles reg ex differently.. read up on what thorpe posted.
  12. you will most likely want to align them using an html table and css.. EDIT: as stated above..
  13. 1. if you only want 40 rows returned, i would use a LIMIT in your query instead of a nested while loop..bad idea. 2. What does a "view source" show about the HTML behavior? 3. where is you "highlightRow()" function even being called here.?
  14. the one that is checked is the one that i linked you to. since im feeling lazy..
  15. ah yes, "range" is a mysql reserved word and is a field name that must be encased in backticks as jcbones stated.. just for more information.. here is a list of reserved words to watch out for.. http://dev.mysql.com/doc/refman/5.5/en/reserved-words.html
  16. To quote someone else from today "I hate to turn your posts back at you, but . . ." His example shows the scores sorted in reverse order. If the scores are the values then the function to use would arsort() which will sort the values in reverse order and maintain index association. however this might be an example array.. we are not sure if the array will be in reverse order everytime.. I like choosing the order manually here, however if the array is always in reverse order.. then yes arsort() would be a good option..
  17. remove the parenthesis around your distinct fields... $sql="SELECT distinct township from linksurv_field_notes WHERE township !='' ORDER BY township DESC";
  18. i notice that you have an unwanted extra semi-colon inside of your sql statement.. remove it.. should be $sql="SELECT distinct(township) from `linksurv_field_notes` WHERE `township`!='' ORDER BY `township` DESC";
  19. true, the solution that i provided would be used to check the PHP side of things.. however if PHP is not the issue here, a mysql check will also need to be put into place to fully understand what is going on.. and as mjdamato suggested, i suspect a loop here as well..
  20. depending on the rest of your code.. you can probably use sort to sort the $result array in the order that you want it.
  21. joins are meant to conserve memory.. doesn't make much sense that this would be slowing you down.. sounds like it could have something to do with code elsewhere.. you can run a code to see how much memory this is actually allocating.. <?php print memory_get_usage() . "<br />"; $sql="SELECT * FROM cars INNER JOIN postcodes ON postcodes.Pcode=cars.Location where id>='1'" $join = mysql_query($sql); if($join){ print memory_get_usage(); } ?>
  22. alright ill explain this using code.. and first off the isset() code you posted needs to be in an if conditional.. alright lets say that you store the password as "asdagdauihdadGFtyda" in your database... when a user types in their password (we will say 123), you will check the md5 hashed version of what they typed in to the database hashed password like so.. <?php $db_password = "asdagdauihdadGFtyda"; //password grabbed from database $password = $_POST['password']; //user typed password if($db_password == md5($password)){ // the password typed matches the $db_password }else{ // passwords don't match } ?> Edit: quick note.. an md5 hash will be 32 characters... the string i chose is simply for example purposes
  23. for some reason strpos() is not locating the first "/", honestly im not sure why... so lets use the reg ex method instead.. <?php $string = "90/_featuredarticles/2011/12"; $pattern = "~[0-9]*/(.*)~i"; preg_match($pattern,$string,$matches); print $matches[1]; //ouputs _featuredarticles/2011/12 ?>
  24. there a several ways to do this you'll find.. I will give one way.. $string = "90/_featuredarticles/2011/12"; $offset = strpos("/",$string); $new_string = substr($string,$offset);
×
×
  • 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.