Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

Posts posted by wildteen88

  1. Not really sure what you mean but try

    <?php
    
    $query = mysql_query("SELECT
    
    societati.denumire_soc,
    incasari.Data_Facturii,
    incasari.Nr_Factura,
    incasari.ARTICOLNUME,
    incasari.Valoare_factura,
    incasari.suma_achitata,
    incasari.modalitate_plata,
    incasari.data_achitat
    
    
    FROM
    incasari
    Inner Join societati ON societati.id_vip = incasari.PartID
    WHERE incasari.inspectorid = $vipid
    
    ORDER BY societati.denumire_soc ASC, incasari.Data_Facturii ASC, incasari.Nr_Factura ASC
    ") or die (mysql_error());
    
    $query_data = array();
    $htmloutput = '';
    
    while ($row = mysql_fetch_array($query))
    {
        // group the results by tye Nr_Factura column
        $query_data[ $row["Nr_Factura"] ][] = $row;
    }
    
    
    $htmloutput .= '<br/>
    
    
    <div id="wrapper3" align="center">
    
    <center><h2>Situatie autorizatii societati comerciale</h2></center>
    
    <table width="100%" border="1" cellspacing="0 cellpadding="5">
        <tr>
           <td class="colhead">Nr crt</td>
           <td class="colhead">Denumire societate</td>
           <td class="colhead">Data Factura</td>
           <td class="colhead">Nr Factura</td>
           <td class="colhead">Articol</td>
           <td class="colhead">Valoare Factura</td>
           <td class="colhead">Suma Achitata</td>
           <td class="colhead">Modalitate Plata</td>
           <td class="colhead">Data Plata</td>
           <td class="colhead">Count</td>
        
        </tr>';
    
    
    $nrfactura = NULL;
    $tmpCount = 0;
    $row_span = 0;
    
    // render the table. Applying row span to the Nr_fatcutura column
    foreach($query_data as $allduprows)
    {
        // calculate the how many rows need to be spanned
        $row_span = count($allduprows); 
    
        foreach($allduprows as $row_key => $row)
        {
            if($nrfactura == $row["Nr_Factura"])
            {
                $facturanumar = '';
                $utilizator = '';
                $datafacturii = '';
                
            }
            elseif($nrfactura !=$row["Nr_Factura"])
            {
                
                $facturanumar = $row["Nr_Factura"];
                $utilizator = $row["denumire_soc"];
                $datafacturii = $row["Data_Facturii"];
                  $tmpCount ++;
            }
            
            $htmloutput .= 
    '<tr>
        <td class="societati">'.$tmpCount.'</td>   
        <td class="societati">'.$utilizator.'</td>
        <td class="societati">'.$datafacturii.'</td>';
        
        // apply the row span to the 'Nr Factura' column
        if($row_span > 1 && $row_key == 0)
        {
            $htmloutput .= '
        <td class="societati" rowspan="'.$row_span.'">'.$facturanumar.'</td>';
        }
        elseif($row_span <= 1)
        {
            $htmloutput .= '
        <td class="societati">'.$facturanumar.'</td>';
        }
        
        
            $htmloutput .= '
        <td class="societati">'.$row["ARTICOLNUME"].'</td>
        <td class="societati">'.$row["Valoare_factura"].'</td>
        <td class="societati">'.$row["suma_achitata"].'</td>
        <td class="societati">'.$row["modalitate_plata"].'</td>
        <td class="societati">'.$row["data_achitat"].'</td>
        <td>'.$row_span.'</td>
    </tr>';
    
            $nrfactura = $row["Nr_Factura"];    
        }
    }
    
    $htmloutput .= '</table>';
    
    echo $htmloutput;
    
    ?>

  2. Your curl script is working. The problem is that the url

    http://affiliates.beso.com/product-search/content?publisherId=57085&categoryId=&keyword=paintball%20mask&showDesc=imageDescriptionText&col=4&row=4&placementid=1&minMarkdown=0&w=140&h=160

     

    Is only returning this html code

    <?xml version='1.0' encoding='UTF-8'?> 
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    <html xml:lang="en" lang="en"> 
        <head> 
            <link rel="stylesheet" type="text/css" href="http://img13.beso-images.com/s2static/us/pb/6706a675/local/css/common/product_gallery.css"/> 
            <script type="text/javascript" src="http://img13.beso-images.com/s2static/us/pb/6706a675/local/js/widget/content.js"> </script> 
            <script type="text/javascript" src="http://img13.beso-images.com/s2static/us/pb/6706a675/local/js/widget/util.js"> </script> 
        </head> 
        <body onload="BesoWidget.searchForProducts();" id="iframe-body"> 
            <form name="config"> 
                <input id="sho.publisherId" type="hidden" value="25225"> </input> 
                <input id="sho.apiKey" type="hidden" value="638b348a826889501ea9d18d8984ab44"> </input> 
                <input id="sho.serverTimeout" type="hidden" value="5000"> </input> 
                <input id="sho.serverUrl" type="hidden" value="http://catalog.bizrate.com"> </input> 
                <input id="sz.assetid" type="hidden" value="2795"> </input> 
            </form> 
        </body> 
    
    </html>

    The list of products appears to be being listed dynamically using JavaScript.

  3. if you're storing the url of the image in your database then you do not need to the following

    $image_path = getimagesize($row['images']);
      header ('Content-Type: ' . image_type_to_mime_type($image_path[2]));
      echo "<p id='images'>", $image_path = getimagesize($row['images']) . "</p>";;

     

    You'd just pass $row['images'] to your img tag

    echo '<p id="images"><img src="' . $row['images'] . '" /></p>';

     

  4. The code in that tutorial is what you'll need to use in order to make page links. There is no built-in function that will do this for you. The code is actually very simple. You will only need to modify a cople of lines of code to make it work with your code.

     

    The first bit of code you need to modify is this part

    // find out how many rows are in the table 
    $sql = "SELECT COUNT(*) FROM numbers";
    $result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR);
    $r = mysql_fetch_row($result);
    $numrows = $r[0];

    You will only need to edit the sql query ($sql = "SELECT COUNT(*) FROM numbers";) so it returns the number of threads in the current forum.

     

    The next bit you edit

    // get the info from the db 
    $sql = "SELECT id, number FROM numbers LIMIT $offset, $rowsperpage";
    $result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR);
    
    // while there are rows to be fetched...
    while ($list = mysql_fetch_assoc($result)) {
       // echo data
       echo $list['id'] . " : " . $list['number'] . "<br />";
    } // end while

    In the above block you can just replace the query ($sql) which your current query for getting the threads.  Just add LIMIT $offset, $rowsperpage to the end of your query And finally replace the while loop which your loop for displaying the threads.

     

  5. You'd justwrap your login form in an if statement which checks to see if the user is logged in. If they're not logged in they display the login form. If they are logged in show the "hello user" text

     

    Example code.

    <?php
    if($your_variable_here_to_determin_whether_the_user_is_logged_in)
    {
        // display "hello user text";
        echo "Hello, $username...."; // change $username to your username variable
    }
    else
    {
    ?>
    your login form html here
    <?php
    }
    ?>

  6. You need to give is_dir the full path to the folder. You cant just give is_dir the name of the folder. Change your code to

     

    $search_path = '/home/*******/public_html/images/';
    $contents =  scandir($search_path);
    
    foreach ($contents as $content) {
    if (is_dir ("$search_path/$content")) {
    echo "$search_path/$content is a directory<br>";
    }
    
    else {
    echo "$search_path/$content is NOT a directory<br>";
    }}

     

  7. mysql_fetch_array expects a result resource, not the number of rows your query returns. A result resource is returnedby mysql_query. So you need to pass thee $select variable to mysql_fetch_array, not the $r variable

    $select=mysql_query("SELECT * FROM search WHERE id='".$_GET['id']."'");
       $r = mysql_num_rows($select);
       
                while($row= mysql_fetch_array($r)){

     

    Change $row= mysql_fetch_array($r) to $row= mysql_fetch_array($select) in hyperlink_results.php

     

    Also when developing your scripts you should configure PHP so error_reporting is set to E_ALL and set  display_errors to on. You can do this either within your php.ini or within your scripts using

    error_reporting(E_ALL);
    ini_set('display_errors', 1);

    Enabling these two directives will display any PHP errors on screen rather than a blank screen.

  8. First, mysql_query does not return an array of results but a result resource. You'll need to use a while loop with mysql_fetch_assoc to loop through the results your query returns.

     

    $sql = "SELECT * FROM Games";
    $res = mysql_query($sql) or die(mysql_error());
    if(mysql_num_rows($res) == 0) die("No records found");
    
    // loop through the results returned by your query
    while($data = mysql_fetch_assoc($res))
    {
        $title=$data['gametitle'];
    ?>
    
    <div id="gametitle">
    <?php echo $title ?>
    </div>
    
    <?php
    }
    ?>

×
×
  • 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.