Jump to content

Search the Community

Showing results for tags 'php loop'.

  • 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 3 results

  1. hi, guys im actually following a tutorial here and i'm perplexed with this error, where there is no output for one object inside a loop. since the tutorial is procedural code and im doing it in oop i dont know where im going wrong.please help me. the code for the complete article.php is here: <?php include_once '../includes/dbconfig.inc.php'; $status2view=$project->statusView($session_uname, $f_uname); //gives output on var dump #row vars to extract user's update data. for ($i= 0; $i >=0 ; $i++) { $id=array_column($status2view ,'update_id'); //gives output on var_dump if ($id==NULL) { break; }else { continue; } $status_replies_=$project->reply2StatusView($id[$i]); var_dump($status_replies_); //no output on var_dump while ($row = $status_replies_) { echo "<pre>"; var_dump($row); echo "</pre>"; $status_reply_id=$row['update_id']; $reply_author=$row['author']; $reply_d=htmlentities($row['update_body']); $reply_data= stripslashes($reply_d); $reply_t= htmlentities($row['title']); $reply_title= stripslashes($reply_t); $account_name=$row['account_name']; $reply_date=$row['time']; $reply_delete_button=""; if ($reply_author==$session_uname || $account_name==$session_uname) { $reply_delete_button="<li><span id='$status_reply_id' class='delete_reply_btn glyphicon glyphicon-remove'><a href='#' title='Delete this comment'>Remove X</a></span></li>"; } $status_replies="<div id='".$status_reply_id."' class='replyboxes'><div><b>Reply by<a href='search_results.php?u=".$reply_author."'>".$reply_author."</a>".$reply_date ."<legend>" . "<b class='caret'><button type='button' class='btn btn-danger dropdown-toggle pull-right' data-toggle='dropdown' aria-expanded='true' ><span class='glyphicon glyphicon-edit'></span> <ul class='dropdown-menu'>".$reply_delete_button." " . "<li><a href='#' class='hidden_text_area glyphicon glyphicon-pencil' title='Edit this comment' >Edit</a></li>" . "<li><a href='report.php?u='".$reply_author."'>Report</a><li></ul>" . "</button></b></legend><br>".$reply_data."</div></div>"; } } while ($row1 = $status2view) { for ($j = 0; $j >= 0; $j++) { $updateid=$row1[$j]['update_id']; $account_name=$row1[$j]['account_name']; $os_id=$row1['os_id']; $author=$row1['author']; $post_date=$row1['time']; $title= htmlentities($row1['title']); $data= htmlentities($row1['update_body']); if ($row1==NULL) { break; } $status_list='<fieldset><div id="'.$updateid.'" class="statusboxes"><div>' . '<legend><h3 class="pull-left">'.$title.'</h3><span class="pull-right">'.$statusdeletebutton.'</span></legend><br>' . $data.'<br><b>Posted by<small><a href="search_results.php?u='.$author.'">'.$author.'</a>'.$post_date.'</small></b>' . '<br><hr style="2px dashed #080808">'.$status_replies . '</div></div>'.$statusui_edit.'</fieldset>'; here is the code for the method: public function statusView($session_uname,$f_uname) { $sql="select * from updates where account_name=:either and type='a' or account_name=:either and type='c' order by time desc limit 20"; $stmth=$this->_db->prepare($sql); $stmth->bindValue(":either",($session_uname|$f_uname)); $stmth->execute(); return $stmth->fetchAll(PDO::FETCH_ASSOC); } public function reply2StatusView($updateid){ $stmth= $this->_db->prepare("select * from updates where update_id=:statusid and type='b' order by time asc"); $stmth->bindparam(":statusid", $updateid); $stmth->execute(); return $stmth->fetchAll(PDO::FETCH_ASSOC); }
  2. Hi I am using the following to connect to an external ftp site to collect a txt file which then gets imported into a mysql table. The connection seems a little hit and miss and I want to set up a loop through until the action is successful - can anyone advise how I would add this to my existing script - I have tried a couple of options without success. The existing code is as follows: <?php $today=(gmdate("dmyGi") . ""); // define some variables $local_file = 'IncomingFiles-' . $today . '.txt'; $server_file = 'files.txt'; // set up basic connection $ftp_server="xxx.ftpserver.xxx"; $conn_id = ftp_connect($ftp_server); // login with username and password $ftp_user_name="1234567"; $ftp_user_pass="1234567"; $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // try to download $server_file and save to $local_file if (ftp_get($conn_id, $local_file, $server_file, FTP_ASCII)) { echo "successfully written to filesincoming\n"; } else { echo "there was a problem connecting to the server for the collection of filesincoming"; exit; } I think the issue may be one of the connection timing out so I am not sure whether setting a longish timeout would be a better option but I though that using a loop would allow me to rely more on the script actually completing when I run it as a CRON job eventually. At the moment the run fails to connect about once in every 3 attempts. Any advice would be appreciated.
  3. Hello Can you help me? I have 2 pc's A en B. There is a program that I run. If I run a particular php script then on pc A it hangs, on B it does not. But when I do write statements to an out file I see that both programs have calculated and the script even returns after doing his work to the calling program. So on pc A it does not 'see' it is finished. To help: There is a loop that loops around 2000 times each time after reading a record from a sql database. If I break earlier for instance after 1500 times, then suddenly both programs end normally. So the question. What could happen in a loop, that prevents a program from ending and hangs, while an other pc does not? There is lots of processing after the loop, that is executed in both situations. Both PC use IE but also Firefox does the same. On top of that also IE's version is the same on both PC's. I am out of clues. Can you point me in the right direction? please mail to empieters@gmail.com if you have questions.
×
×
  • 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.