while-loop

php unsuccessful while loop within prepared statements

﹥>﹥吖頭↗ 提交于 2019-12-25 04:07:26
问题 code below is a part of my sitemap.xml file. My aim is to write the last modified date of my approved articles. There are 2 possibilities for this data. If article has no approved comment, then lastmod is the approval date of the article. If article has at least 1 approved comment, then lastmod is the approval date of the last approved comment. Errors in my output are: There are some articles in my db that has no comments but also these commentless articles get the approval date of last

Repeated in the table Smarty + Php

假如想象 提交于 2019-12-25 03:36:40
问题 I have a problem in in the table The problem is to repeat I want when it reaches 4 rows to the table is transferred to the new line Code PHP : // for : $tr = 1; while($row = mysql_fetch_array($post_tv)){ $show[] = $row; if ($tr == 4){ $tr == 1; } $tr++; $marsosmarty->assign("show",$show); $marsosmarty->assign("tr",$tr); } Code Html smarty : <td width="91"><table width="100" height="100" border="0" cellpadding="1" cellspacing="1" bgcolor="#666666"> <tbody><tr> {section name=table loop=$show}

PHP - problem with nested mysql_fetch_array() driving me crazy

走远了吗. 提交于 2019-12-25 03:24:53
问题 The MySQL query: SELECT title,alias,parent FROM '._prefix.'categories WHERE (language = \''._language.'\' || language = \'all\') && status = \'published\' ORDER BY rank ASC The Result (from phpMyAdmin): title | alias | parent Home | home | 0 Todo | todo | 0 Multiuser| todo_mu | 21 Modulsys | todo_mod | 21 The PHP: while($c = mysql_fetch_array($category_result)) { if($c['parent'] == 0) { $output .= '<li><a href="'._rewrite_string.$c['alias'].'" title="'.$c['title'].'">'.$c['title'].'</a>';

While Loop Won't loop C++

只谈情不闲聊 提交于 2019-12-25 02:57:56
问题 I can't seem to figure out why this while loop stopped looping. It was doing fine before I moved some code around. Now I got something else working and it just doesn't loop. I've also tried making quit a bool set to true and tried to have it loop while it was true until the user hit 4 to exit in which case it would turn it to false but that didn't work. I also tried adding a while loop to the function of showMenu but that also didn't work. I know it must be something simple I just can't catch

nightwatch js while loop

纵然是瞬间 提交于 2019-12-25 02:55:28
问题 I'm new to node and nightwatch. Been working with Selenium for a number of years but my company has moved over to all things node. Anyway, in nightwatch I am trying to click a link while its visible and loop and keep clicking it until it is not. Here is what my code looks like. Any suggestions would be much appreciated! "Cart Cleanup": function (browser) { browser .url(environment + '/ShoppingBag') .waitForElementVisible('div.cart-top-message', 190000) .pause(3000) .element('class name',

Delay execution while file uploading

社会主义新天地 提交于 2019-12-25 02:53:52
问题 My form uploads a file to be added to a mail created with PHPMailer. Unfortunately, the mail isn't being sent and I think that might be because it's being sent too soon in execution. So what I wanted to do was to add in a small loop to effectively pause further execution until the file has been uploaded: while (!move_uploaded_file($_FILES['upload'][$first_name.' CV'], $target_path)) { sleep(1); if (move_uploaded_file($_FILES['upload'][$first_name.' CV'], $target_path)) { echo "The file ".

Strange behaviour in a while loop with a date compare in PHP

大兔子大兔子 提交于 2019-12-25 02:46:49
问题 Hi I am trying to create a simple while loop that pulls an associative array from a database in PHP. In essence I want to then do a compare on the date pulled from the database with the current date. Here is the catch. Different sections (represented in a table) have different deadlines. So I need to modify the pulled date from the database by subtracting certain amounts of days. I have done this with different variables but I get some weird results which are not the ones I have specified. Am

Make FileReader read every fourth line with a loop

☆樱花仙子☆ 提交于 2019-12-25 02:31:49
问题 My problems is that I have to arrange, when searching for a customer, arrange the while loop to only examine every fourth line read. This is the code I already have on this problem: BufferedReader br = new BufferedReader(new FileReader("Customers.txt")); String line; while ((line = br.readLine()) != null) { ... } br.close(); Does anybody know what needs to be at the place of "..."? Thanks! 回答1: Just call br.readLine() 3 times at the end of the loop, discarding the output: BufferedReader br =

Checking if a customers name is already in a txt file with FileReader

♀尐吖头ヾ 提交于 2019-12-25 02:26:25
问题 My problem is that I have to write code to check if a customers name is already in my txt file (Customers.txt). As you can see, I write my customers name ,every fourth line in my txt File. I would like to have the input of a customers name with SimpleInOutDialog en then that inputs needs to be compared with al the customers name in my txt file. How do I need to do this? The code that I already have is below. //make SimpleInOutDialog SimpleInOutDialog input = new SimpleInOutDialog("Customers")

PHP grouping items in a loop

余生颓废 提交于 2019-12-25 02:19:16
问题 In a loop, I want to wrap first 5 items in a li , and after that every 6 items in a li . I'm trying following code, but it is not working properly, it wraps first 5 items in a li , and after that it wraps only every sixth item in the li, but 7th - 12th without li. $i = 0; while ($i < 19){ $i++; if($i == 1 ){ echo '<li>'; } if (($i > 5) AND ( $i % 6 == 0)){echo "<li>";} echo "<div>item " . $i . "</div>"; if( $i == 5 ){ echo '</li>'; } if(($i > 5) AND ( $i % 6 == 0)) { echo "</li>"; } } if ($i