logo
down
shadow

display file name in while loop without url


display file name in while loop without url

By : lek
Date : November 22 2020, 10:54 AM
it fixes the issue I want to display only the file name without displaying the url. I want to replace the file name instead of 'document '. , I included $next1 = basename($next);
code :
while($fet=mysql_fetch_assoc($sql1))
        { 
         $i=$i+1;
         $next=$fet['f_name'];
         $next1 = basename($next);
         echo '<h4><a class="astext" href="'.$next.'" title="'.$next.'" target="_blank" download>'.$next1.'</a></h4>';
        }


Share : facebook icon twitter icon
Loop through values and display in a pdf file

Loop through values and display in a pdf file


By : dou
Date : March 29 2020, 07:55 AM
this will help You don't need a nested loop, you just need to change the value you subtract from $y each time. You can do it like so:
code :

$placeholder = 500; // initial value
for ($i = 0; $i quotation_details); $i++)
{
  pdf_show_xy($pdf, $this->quotation_details[$i]['name_searched'] , 70, $y - $placeholder);
  $placeholder = $placeholder - 20;
}
MySQL / PHP - Display all data from a table in a while loop without the loop being in the template file

MySQL / PHP - Display all data from a table in a while loop without the loop being in the template file


By : user2444199
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , First of all, your code will result in $data1 and $data2 containing only information from the last row of your table because you overwrite the variables in every iteration. To prevent this, you should do something like this:
code :
$posts = []; // this is where a new array is created
while($postsData = mysqli_fetch_array($posts)) {
    $posts[] = $postsData; // adds the current record to the array
}
<ul>
{% for item in posts %}
    <li>{{ post.data1 }} - {{ post.data2 }}</li>
{% endfor %}
</ul>
echo $twig->render('page.twig', array('posts' => $posts));
Loop through database and display them in new file

Loop through database and display them in new file


By : Eric Gathogo
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , It is all a matter of just looping the items (in this case table rows) that need to be looped:
code :
$select_report = $conn->prepare("SELECT test_db FROM report");
$select_report->execute();
$html_report = "
                <!DOCTYPE html>
                <html>
                <head>
                <title>Sales report</head>
                </head>
                <body>
                  <div class='container'>
                    <table>
                        <thead>";

while ($result_report = $select_report->fetch(PDO::FETCH_ASSOC)){
   // concatenate rows
   $html_report .= "<tr>
                             <th>test</th>
                           </tr>
                        </thead>
                        <tbody>
                           <tr>
                             <th>". $result_report["test_db"] ."</th>
                           </tr>
                        </tbody>";
}
// outside of loop    
$html_report .= "</table>
                  </div>
               </body>
               </html>
                  ";

$myfile = fopen("report - ".date("m, d, s").".html", "w") or die("Unable to open file!");

fwrite($myfile, $html_report);
fclose($myfile);
Loop through an XML file and display in a table

Loop through an XML file and display in a table


By : Ning Li
Date : March 29 2020, 07:55 AM
I wish this help you Use only one dom foreach() loop on outside since ctype data is pulled from same xml source. However, still follow the structure of @michi's answer to your earlier question (such as initializing dom objects outside loop).
code :
$newdom = new DOMDocument('1.0', 'utf-8');
$newdom->formatOutput = true;
$newdom->preserveWhiteSpace = false;

$xpath = new DOMXPath($dom); 

<table border=1>
     <tr><th>Concept Name</th><th>Relation Type</th><th>CoGui XML</th><th>CharGer XML</th></tr>

     <?php 
     foreach ($dom->getElementsByTagName("ctype") as $ctype) { 
     ?>  
        <tr><td><?php echo $ctype->getAttribute('label'); ?></td><td></td>

        <?php               
        $newdom->loadXML("<cogxml><support><conceptTypes /><relationTypes /></support></cogxml>");    
        $newnode = $newdom->importNode($ctype, true);
        $newdom->getElementsByTagName("conceptTypes")->item(0)->appendChild($newnode);

        $id = $ctype->getAttribute('id');

        foreach ($xpath->query("//cogxml/support/conceptTypes/order[@id1='$id']") as $order) {
            $newnode = $newdom->importNode($order, true);
            $newdom->getElementsByTagName("conceptTypes")->item(0)->appendChild($newnode);
        }    

        foreach ($xpath->query("//cogxml/support/relationTypes/rtype[contains(@idSignature, '$id')]") as $rtype) {
            $newnode = $newdom->importNode($rtype, true);
            $newdom->getElementsByTagName("relationTypes")->item(0)->appendChild($newnode);
        }?>
        <td><xmp><?php  echo $newdom->saveXML(); ?></xmp></td><td></td></tr><?php 
     }?>

</table>
Trying to loop and display a JSON file with PHP

Trying to loop and display a JSON file with PHP


By : user2826638
Date : March 29 2020, 07:55 AM
will help you You also iterate over the 2nd array Clientes. You could access the array directly and only iterate over that data:
code :
$jsondata = file_get_contents("clitest.json");
$json = json_decode($jsondata, true);
$pessoa = $json["Clientes"]["Pessoa"];
foreach ($pessoa as $key => $value){
  echo $value["nome"] . " " . $value["endereco"];
  echo "<br>";
}
$jsondata = file_get_contents("clitest.json");
$json = json_decode($jsondata, true);
foreach ($json as $key1 => $value){
  if ($key1 == "Clientes") {
    foreach ($value as $key2 => $val){
      if ($key2 == "Pessoa") {
        foreach ($val as $key3 => $v){
          echo $v["nome"] . " " . $v["endereco"];
          echo "<br>";
        }
      }
    }
  }
}

Related Posts Related Posts :
  • How to add Smarty templating engine to CodeIgniters 3 framework?
  • Am I maxing out possible data insert
  • Redirect to homepage without changing address bar URL
  • What is the best user-Id Value for a MySql "users" table
  • PHP $_COOKIE is only available in one directory
  • php regular expressions documantation
  • cannot import too large sql file to mysql
  • not getting appilcation/json in content-type in header
  • Only the first data display from my database but other shows but not on a table
  • Is it possible to have a print button link as the content of the mail
  • how to extract full mail address in imap php
  • Alternative to output buffering to put eval'd code into a variable
  • how to run wordpress php snippet mysql update command from ssh and/ultimately cron
  • how to get xml tag by name
  • ModSecurity maximum post limits (PCRE limit errors)
  • Call controller/action in event listener
  • How to improve performance of contacting WebService?
  • PHP nest variable in echoed string that contains a HTML tag in the end
  • Multiple Ajax request for PHP framework
  • Debug Info from Moodle Plugin
  • passing variables through page
  • Passing PHP $result data to Javascript
  • cakePHP File Download was not found or not readable
  • batch waiting until script finishes
  • PHP variables and anchors in URL
  • php eTag generation using php
  • How to check whether the array is an Integer or Not?
  • Is it possible to install Doctrine without PEAR or Composer? If so, how?
  • Call view script of (parent) Abstract controller Zend
  • Curl PHP cannot display amazon
  • Symfony, getters and setters vs magic methods
  • Using 'continue' PHP instruction outside the loop
  • AJAX POST return data not appearing
  • Can I query relations using an INNER JOIN instead of two queries in Eloquent?
  • Looping through dynamic form fields and inserting into database
  • My php code can't select mysql auto_increment value
  • Store Angularjs form data in database using php
  • I want to run my sh file continuously even if I close my Putty connection
  • file_get_contents equivalent for gzipped files
  • Include PHP file with jQuery
  • php curl headers do not return from website?
  • How to find out, if facebook ID is a user, group or page
  • Connect webhost database to android database
  • preg_match get div content with class
  • Upload multiple files in Laravel 4
  • Count array numbers in multidimensional array
  • PHP Date diff with a difference
  • Search Customer by custom field in Netsuite
  • Is it possible to hide/encode/encrypt php source code and let others have the system?
  • list items to be displayed using php code and array
  • check if row exists mysqli
  • PHP errors loading MySQL
  • setup PostgreSQL with Laravel in MAMP
  • PHP - CodeIgniter Notifications
  • Encrypting a password column in a SQL database
  • New to PHP, trying to extract information from another website
  • JavaScript AmChart to Image for Email
  • Is javascript validation enough to keep my forms secure?
  • Regex extract variables from [shortcode]
  • Download a .mp3 link and save it to computer with PHP
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org