Jump to content

Search the Community

Showing results for tags 'order'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 7 results

  1. I have a Mysql table where I store prices of a product. I have the values in "varchar" format because I needed to include "decimals" in the prices(for eg. 15.30) and "int" doesn't allow that. Having done that, when ever I filter the products by prices in Ascending or Descending order, they don't show up in proper order. It seems like the decimal in the prices is messing up the order. Is there a way to fix this so that the php query can filter the prices in proper order despite the decimals? Here's the eg of the query. $get_records = $db->prepare("SELECT * FROM records ORDER BY records.price DESC");
  2. Hi friends, I'm using Kalins pdf in Wordpress. Where in the code below can I arrange these comments using "ORDER by comment_date DESC"? I have tried for weeks and I keep getting blank pages. I'll appreciate your input: function commentCallback($matches) { if(defined("KALINS_PDF_ COMMENT_CALLBACK")){ return call_user_func(KALINS_PDF_COMMENT_CALLBACK); } global $post; $comments = get_comments('status=approve&post_id=' .$post->ID); $commentString = $matches[2]; foreach($comments as $comment) { if($comment->comment_author_url == ""){ $authorString = $comment->comment_author; }else{ $authorString = '<a href="' .$comment->comment_author_url .'" >' .$comment->comment_author ."</a>"; } $commentString = $commentString .'<p>' .$authorString ." - " .get_comment_date(null, $comment->comment_ID) ." @ " .get_comment_date(get_option('time_format'), $comment->comment_ID) ."<br />" . $comment->comment_content ."</p>"; } //get_comment_date('m-d-Y @ g:i A', $comment->comment_ID) return $commentString .$matches[4]; }
  3. Hello! My name is Razvan and I work as a (front-end) web developer in Bucharest, Romania. I am using the Simple Staff List Word Press plugin on THIS page. I have used the guidance here to sort staff members by full name. I need to order them by last name. For this, even though I am new to PHP, I have written the code below: <?php $name = "Firstname Middlename Lastname"; $name_parts = explode(' ',$name); $no_of_parts = sizeof($name_parts); $last_name_index = $no_of_parts - 1; $last_name = $name_parts[$last_name_index]; $first_names = chop($name,$last_name); $reverse_name = $last_name . ' ' . $first_names; ?> It is made to move the last name at the beginning of the full name, store the result in the $reverse_name, and then sort by $reverse_name. It does move the last name at the beginning of the full name, but I can't do this 2 things: 1) Use the value of the staff member post title as value for the $name variable; 2) Use $reverse_name for sorting. Can anyone give me a hint on what to change in the plugin files to achieve this goal, please? Thank you! Razvan Zamfir
  4. Hi first tyvm for reading my help request me and my friend ar trying to build a order form (see png file ^^) so the main idea is some on go to order form.php in that order form they fil in thear info like name, adress you know ^^ thean here is the treaky part at the and of the form they kan add products to there order by selecting it or search it from the drop down list the items in the dropdown list come from msql the client can add more or delete items by clicking - or + whean the clint click send the client need to get a mail whit there a list of what theay have orderd and there unic order number wel so far we can do that but we wont to send another list to the company of order where the added products in the order ar sorted out based on the product id number this is what we have so far http://clientconstruction.publishvision.nl/valeri/ tyvm again voor anyone who read this ^^
  5. Hi all, I have a strange problem. I am using the MySQL query SELECT * FROM crh_log WHERE logdetix=$detix ORDER BY logix ASC I have this exact query in two scripts, each gives a different result. logix is the primary key to the table. There are two rows that satisfy this query. One script returns the rows on ascending order of logix, the other is the reverse. I've tried ORDER BY different variables and in one script it never makes a difference - it's as if MySQL is ignoring the ORDER by clause. The MySQL code in the code snippets in attached file are identical. The only difference is that logix is displayed in the able in one script and not in the other.
  6. Hello guys. I execute a query and then put the records into array, the query has ORDER BY .... why I don't have the same order in the array?, If I execute the query, the record one it's no the same that $arreglo[0]. $stmt = $this->db->prepare('SELECT a.id_torneo, b.tor_nombre, a.id_jornada, a.id_juego, a.cal_fecha_hora, id_arbitro, a.cal_estatus, a.cal_default, c.id_equipo, d.equ_nombre, c.enc_locvis, e.id_jugador, e.jug_nombre_pila, e.jug_apellido_pat, e.jug_apellido_mat, e.jug_representante, e.jug_numero, jug_fechimp_reg FROM calendario a, torneo b, encuentro c, equipo d, jugador e WHERE a.id_cliente =? AND a.id_sucursal = ? AND date(a. cal_fecha_hora)= date(?) AND a.id_cliente = b.id_cliente AND a.id_sucursal = b.id_sucursal AND a.id_torneo = b.id_torneo AND a.id_cliente = c.id_cliente AND a.id_sucursal = c.id_sucursal AND a.id_torneo = c.id_torneo AND a.id_jornada = c.id_jornada AND a.id_juego = c.id_juego AND a.id_cliente = d.id_cliente AND c.id_sucursal = d.id_sucursal AND c.id_torneo = d.id_torneo AND c.id_equipo = d.id_equipo AND d.id_cliente = e.id_cliente AND d.id_sucursal = e.id_sucursal AND d.id_torneo = e.id_torneo AND d.id_equipo = e.id_equipo AND e.jug_estatus = "A" ORDER BY 5,11') or die(mysqli_error($this->db)); $stmt->bind_param("iis", $cliente, $sucursal, $fecha); $stmt->execute(); $stmt->bind_result($id_torneo, $tor_nombre, $id_jornada, $id_juego, $fecha_partido, $id_arbitro, $cal_estatus, $cal_default, $id_equipo, $equipo_nombre, $locvis, $id_jugador, $jug_nombre, $jug_apellidop, $jug_apellidom, $jug_rep, $jug_playera, $jug_fechareg); $arreglo = array() ; $contador = 0; while ($stmt->fetch()) { $arreglo[$contador] = array("id_torneo"=>$id_torneo,"torneo_nombre"=>$tor_nombre,"id_jornada"=>$id_jornada,"id_juego"=>$id_juego,"fecha_partido"=>$fecha_partido,"id_arbitro"=>$id_arbitro,"cal_estatus"=>$cal_estatus,"cal_default"=>$cal_default,"id_equipo"=>$id_equipo,"equipo_nombre"=>$equipo_nombre,"locvis"=>$locvis,"id_jugador"=>$id_jugador,"jug_nombre"=>$jug_nombre,"jug_apellidop"=>$jug_apellidop,"jug_apellidom"=>$jug_apellidom,"jug_rep"=>$jug_rep,"jug_player"=>$jug_playera,"jug_fechareg"=>$jug_fechareg); $contador++; }
  7. I am currently using the plugin WP-CommentNavi for comments pagination but whenever a page is clicked it goes to the highest comments page (oldest comments). My comments are purposely displayed newest first and therefore I need the default pagination page to be 1 whenever a link is clicked. I notice there is the same default for other pagination plugins too whereby the highest pagination page (ie if there are 5 pages) page 5 is displayed. At the moment when I load page tellhi####.com/newcastle the page that will be loaded is tellhi####.com/newcastle/comment-page-2/ whereas I want tellhi####.com/newcastle/comment-page-1/ to be loaded I can't be sure this is the relevant code to what I am trying to achieve but I feel the answer might lie in here (below). If not, please tell me and disregard this code. ### Function: Comment Navigation: Boxed Style Paging function wp_commentnavi($before = '', $after = '') { global $wp_query; $comments_per_page = intval(get_query_var('comments_per_page')); $paged = intval(get_query_var('cpage')); $commentnavi_options = get_option('commentnavi_options'); $numcomments = intval($wp_query->comment_count); $max_page = intval($wp_query->max_num_comment_pages); if(empty($paged) || $paged == 0) { $paged = 1; } $pages_to_show = intval($commentnavi_options['num_pages']); $pages_to_show_minus_1 = $pages_to_show-1; $half_page_start = floor($pages_to_show_minus_1/2); $half_page_end = ceil($pages_to_show_minus_1/2); $start_page = $paged - $half_page_start; if($start_page <= 0) { $start_page = 1; } $end_page = $paged + $half_page_end; if(($end_page - $start_page) != $pages_to_show_minus_1) { $end_page = $start_page + $pages_to_show_minus_1; } if($end_page > $max_page) { $start_page = $max_page - $pages_to_show_minus_1; $end_page = $max_page; } if($start_page <= 0) { $start_page = 1; } if($max_page > 1 || intval($commentnavi_options['always_show']) == 1) { $pages_text = str_replace("%CURRENT_PAGE%", number_format_i18n($paged), $commentnavi_options['pages_text']); $pages_text = str_replace("%TOTAL_PAGES%", number_format_i18n($max_page), $pages_text); echo $before.'<div class="wp-commentnavi">'."\n"; switch(intval($commentnavi_options['style'])) { case 1: if(!empty($pages_text)) { echo '<span class="pages">'.$pages_text.'</span>'; } if ($start_page >= 2 && $pages_to_show < $max_page) { $first_page_text = str_replace("%TOTAL_PAGES%", number_format_i18n($max_page), $commentnavi_options['first_text']); echo '<a href="'.clean_url(get_comments_pagenum_link()).'" class="first" title="'.$first_page_text.'">'.$first_page_text.'</a>'; if(!empty($commentnavi_options['dotleft_text'])) { echo '<span class="extend">'.$commentnavi_options['dotleft_text'].'</span>'; } } previous_comments_link($commentnavi_options['prev_text']); for($i = $start_page; $i <= $end_page; $i++) { if($i == $paged) { $current_page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $commentnavi_options['current_text']); echo '<span class="current">'.$current_page_text.'</span>'; } else { $page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $commentnavi_options['page_text']); echo '<a href="'.clean_url(get_comments_pagenum_link($i)).'" class="page" title="'.$page_text.'">'.$page_text.'</a>'; } } next_comments_link($commentnavi_options['next_text'], $max_page); if ($end_page < $max_page) { if(!empty($commentnavi_options['dotright_text'])) { echo '<span class="extend">'.$commentnavi_options['dotright_text'].'</span>'; } $last_page_text = str_replace("%TOTAL_PAGES%", number_format_i18n($max_page), $commentnavi_options['last_text']); echo '<a href="'.clean_url(get_comments_pagenum_link($max_page)).'" class="last" title="'.$last_page_text.'">'.$last_page_text.'</a>'; } break; case 2; echo '<form action="'.admin_url('admin.php?page='.plugin_basename(__FILE__)).'" method="get">'."\n"; echo '<select size="1" onchange="document.location.href = this.options[this.selectedIndex].value;">'."\n"; for($i = 1; $i <= $max_page; $i++) { $page_num = $i; if($page_num == 1) { $page_num = 0; } if($i == $paged) { $current_page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $commentnavi_options['current_text']); echo '<option value="'.clean_url(get_comments_pagenum_link($page_num)).'" selected="selected" class="current">'.$current_page_text."</option>\n"; } else { $page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $commentnavi_options['page_text']); echo '<option value="'.clean_url(get_comments_pagenum_link($page_num)).'">'.$page_text."</option>\n"; } } echo "</select>\n"; echo "</form>\n"; break; } echo '</div>'.$after."\n"; } } In short I need, anytime a page is clicked, for the comments pagination to be on page 1, not the highest page available. Just so you know I have tried the discussion settings on the wordpress dashboard. Nothing on google either! Failing a full answer, does anyone know the actual php code that determines what pagination page is loaded by default? I received this response via an e-mail but due to my PHP knowledge am unable to implement it, any ideas? ... Just reverse the loop. That'll fix it. Here's the relevant part: http://pastie.org/8166399 You need to go back, i.e. use $i-- Hope I have been clear in my question! Thanks in advance, Paul
×
×
  • 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.