Jump to content

rbvinc

Members
  • Posts

    35
  • Joined

  • Last visited

Posts posted by rbvinc

  1. Agreed Sirs. Thank you all, took your suggestions. One last help 'PLEASE'. I got this connection,

     

    select * from countryTable where country ='USA' 

     

    All below listed data is there, now I am trying to get/display in a table rest of these rows data with loop. Like,

     

    COUNTRY - STATE - CITY - SCHOOL#

    USA - Pennsylvania - Pittsburgh - 124

    USA - Pennsylvania - Harrisburg - 126

    USA - Pennsylvania - Strougtsburg - 177

    so on....

     

    Please help.

  2. Please see code below, all connections working. but some how when I select with 'where' is not working.

    Please fix this, as well I want to display other records in table. Thank you,

     

    I can display 'country' on this page when I submit from 'form' selectoion. But could not get rest of the data

    for that country. Error is 'syntax' error.

     

     

    $query = "select * from countryTable where country  = ".$_post['country']. " order by country asc";

     

     

     

     

     

  3. Jesirose, if can, please modify my code, make work,

    it will be a lifetime Thank you, I tried could not follow.

    Once I cross this, then I am on my own please.

    I will be help to other people.

     

    Thank you in advance.

  4. Erdy, I know it is wrong, but this what I have.....

     

    Output to be,

     

    Canada

    . companyone

    . companytwo

    . companythree

     

    USA

    . xyz company

    . zy company

    . xz comapy

     

    so on...

     

    ****************************** *************

    <?php

    $con = mysql_connect("localhost","root","test");

    if (!$con)

      {

      die('Could not connect: ' . mysql_error());

      }

     

    mysql_select_db("northwind", $con);

     

    $result = mysql_query("SELECT distinct country FROM customers order by country");

     

    echo "<table border='1'>

    <tr>

    <th>Country</th>

    </tr>";

     

    while($row = mysql_fetch_array($result))

     

      {

    echo "<tr bgcolor='#808080'>";

    echo "<td>" . $row['country'] . " </td>";

     

    echo "</tr>"; 

    echo "</table>";

     

    $result1 = mysql_query("SELECT * FROM customers where country = " . $row['country'] . " order by country");

     

    echo "<table border='1'>

    <tr>

     

    <th colspan='2'>Company Name</th>

     

    </tr>";

     

     

      echo "<tr>";

    if ($result1)

      {

     

     

    echo "<td>" . $row['Region'] . " </td>";

    echo "<td>" . $row['country'] . " </td>";

     

      }

    echo "</tr>"; 

    echo "</table>";

     

    }

     

     

    mysql_close($con);

    ?>

     

     

  5. It is not copy and paste, I am so good with ASP, I copied ASP code, modified into PHP, to do the same process, and besides learning PHP, since got stuck I came here for help. If can please do help. This is not commercial. I am usinging northwind.mdb sample database for learning.

     

    Thank you,

     

  6. I have about 100 records, but my loop is looping so many times, returning

    1000+ repeated records. I need something like this. Help me out please with new code. Thanks.

     

     

    Canada

    . companyone

    . companytwo

    . companythree

     

    USA

    . xyz company

    . zy company

    . xz comapy

     

    so on...

     

     

  7. Sorry...

    ************

     

     

    <?php

    $con = mysql_connect("localhost","root","test");

    if (!$con)

      {

      die('Could not connect: ' . mysql_error());

      }

     

    mysql_select_db("northwind", $con);

     

    $result = mysql_query("SELECT Country FROM customers order by country");

     

    echo "<table border='1'>

    <tr>

    <th>Country</th>

    </tr>";

     

    while($row = mysql_fetch_array($result))

      {

    echo "<tr>";

    echo "<td>" . $row['Country'] . " </td>";

     

     

     

    $result1 = mysql_query("SELECT * FROM customers where country = " . $row['Country'] . " order by CompanyName");

     

    echo "<table border='1'>

    <tr>

     

    <th>Company Name</th>

    <th>Country</th>

    </tr>";

     

    while($row = mysql_fetch_array($result1))

      {

    echo "<tr>";

     

    echo "<td>" . $row['CompanyName'] . " </td>";

    echo "<td>" . $row['Country'] . " </td>";

    echo "</tr>";

      }

    echo "</table>";

     

    }

    echo "</tr>"; 

    echo "</table>";

     

    mysql_close($con);

    ?>

  8. I am new, learing PHP. What I am trying to do is, first I want to put country,

    under each counrty I want to put companynames. Below is my code. Can some one fixit it please for me. Thank you. Example below,

     

    Canada

    . companyone

    . companytwo

    . companythree

     

    USA

    . xyz company

    . zy company

    . xz comapy

     

    so on...

     

     

  9. I am using MS Access, winxp, ASP. The following code works fine in ASP when I select only one country. If check two or more countries, it does not work. Can you please modify the following code to work in PHP if I select 1 or 2 or 3 or more countries. Thank you in advance.

     

    PLEASE NEED PHP CODE.

     

    ----------

    <html>
    <head>
    <title>Untitled</title>
    </head>
    
    <body>
    
    <% if request.form("country") = "" then %>
    
    <form action='aspformdata.asp' method="post">
    <input type="checkbox" name="COUNTRY" value="USA">USA<br>
    <input type="checkbox" name="COUNTRY" value="Canada">Canada<br>
    <input type="checkbox" name="COUNTRY" value="Denmark">Denmark<br>
    <input type="checkbox" name="COUNTRY" value="China">China<br>
    <input type="checkbox" name="COUNTRY" value="Japan">Japan<br>
    <input type='submit' name='submit' value='Submit'>
    </form>
    
    <% Else  %>
    
    <%
    set cn = server.createObject("ADODB.Connection")
    cn.open "dsn=northwind"
    
    courntry = request.form("country")
    %>
    
    <%
    sql = "select * from customers where country = '" & request.form("country") & "' order by country"
    set rs = server.createObject("ADODB.RecordSet")
    rs.open sql, cn
    %>
    
    <table>
    <tr>
    <td> CompanyName</font></td><td> City</font></td><td> State</font></td>
    </tr>
    
    
    <%
    Do Until rs.EOF
    %>					
    <tr>
    <td> <%= rs("CompanyName")%></font> </td>
    <td> <%= rs("City")%></font></td>
    <td> <%= rs("State")%></font> </td>
    </tr>
    
    <%
    rs.movenext
    loop
    %>
    
    <% End if%>
    </table>
    </body>
    </html>
    
    
    
    

  10. Need help please.

     

    I have customers from various countries. I want to display country name as header, under each country I want to that countries customers id, customers name, customers phone, etc.. (Like grouping or section of each country with their customers info. and need a <br> for each country).

     

    Need sql statement please.

     

    Thank you in advance.

     

     

  11. I have list of files in a folder, I update these files periodically. I want to display only latest files or today's (date=today) with URL link to that new files with that file name as url link.

     

    example..

    <a href="/newfiles_10042010/newfile_10042010.php">newfile_10042010</a>

     

    Please publish sample code or tutorial links.

     

    Thank you,

     

  12. I 'googled' the followind code, "php / folders / href" links.

    With "Respect" to who ever created this, I am trying to

    learn php / folders / href links. Thank you to you.

     

    This code does all the job all the way, but at the end, the

    file names are not ending up with <a href=....> link,

    where I can click on these last step files and open it.

    (Mostly I have pdf files). As well image is not showing

    at the end step infront of the file name. (This code

    involves Javascript also).

     

    Need expertise help to do what I am looking for.

    Please check the code and please fix it.

    Thank you in advance.

    *********************

     

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

     

    <html>

    <head>

    <title>Untitled</title>

    <link rel="STYLESHEET" type="text/css" href="css/cbStyles.css">

    </head>

     

    <body bgcolor="#ffefd5">

     

     

    <?

     

    //default directory when the text field has no input

     

    $def='C:/';

     

    // directory path can be either absolute or relative

     

    function lister($dirPath){

     

    // open the specified directory and check if it's opened successfully

     

    if ($handle=opendir($dirPath)) {

     

    // keep reading the directory entries 'til the end

     

    while (false !== ($file = readdir($handle))) {

     

    // just skip the reference to current and parent directory

     

    if ($file != "." && $file != "..") {

     

    if (is_dir("$dirPath/$file")) {

     

    // found a directory, do something with it?

     

    echo '<img src="icons/fRed.png"/><a href="#" onclick="javascript: r(\''.$dirPath.$file.'/\'); d()">'.$file.'</a><br/>';

     

    } else {

     

    // found an ordinary file

     

    $extensions=array('doc','jpg','png','pdf','xls');

     

    $ext=$file;

     

    $pos=strrpos($ext,'.');

     

    $ext=substr(substr($ext,$pos),1);

     

    if(in_array(strtolower($ext),$extensions)){

     

    echo '<img src="icons/'.$ext.'.png"/>  '.$file.'<br/>';

     

    }else{

     

    echo '<img src="icons/aGreen.png"/>  '.$file.'<br/>';

     

    }

     

    }

     

    }

     

    }

     

    // ALWAYS remember to close what you opened

     

    closedir($handle);

     

    }

     

    }

     

    ?>

     

    <html>

     

    <head>

     

    <title>List Contents</title>

     

    <link rel="icon" href="icons/logoRoundPurple.png"/>

     

    <link rel="stylesheet" href="style.css"/>

     

    <script type="text/javascript">

     

    function r(dir){

     

    document.lister.directory.value=dir;

     

    }

     

    function d(){

     

    document.lister.submit();

     

    }

     

    </script>

     

    </head>

     

    <body><br/>

     

    <table class="cells"><tr>

     

    <td class="navi">

     

    <div class="container">

     

    <form method="post" autocomplete="off" name="lister">

     

    Directory:<br/>

     

    <input type="text" name="directory"/><br/><br/>

     

    <input type="submit" name="list" value="LIST"/>

     

    </form>

     

    <br/><br/>

     

    </div>

     

    </td>

     

    <td class="content">

     

    You are currently at:<br/>

     

    <div class="breadcrumbs" id="crum">

     

    <?php

     

    #show the breadscrumbs so as to navigate to the last directory.

     

    $path=explode('/',$_POST['directory']);

     

    $it=count($path);

     

    for($i=1;$i<$it;$i++){

     

    echo '<a href="#" onclick="r(\'';

     

    for($j=0;$j<$i;$j++){

     

    echo $path[$j].'/';

     

    }

     

    echo '\'); d();">';

     

    echo '<font color=red>'.$path[$i-1].'</font>';

     

    echo '</a>  <img src="icons/bBlue.png"/>';

     

    }

     

    ?>

     

    </div>

     

    address: <input type="text" style="height: 22px; width: 600px;" value="<?=$_POST['directory']?>"/>

     

    <br/>

     

    <br/>

     

    <?php

     

    if($_POST['directory']==''){

     

    lister($def);

     

    }else{

     

    lister($_POST['directory']);

     

    }

     

    ?>

     

    </td>

     

    </tr>

    </table>

     

    </body>

     

    </html>

     

     

     

  13. Full code here,

     

     

    <?php

     

    foreach (glob("/newsa/testpdf/", GLOB_ONLYDIR) as $dir)

    {   

    $folder = explode("/", $dir);   

    $folder = $folder[count($folder)-1];   

    echo $folder . "<br />";   

     

    foreach (glob($dir . "/*.pdf") as $file)

     

    {     

    $file = basename($file);       

    echo "<a href='$file'>$file</a><br />";   

    }

    }

     

    ?>

     

  14. Sorry to bother,

    I ran it, blank screen showing when I ran it, thought

    I have two pdf files in that folder.

    C:\Inetpub\wwwroot\newsa\testpdf

     

    Error on this new line code,

    foreach (glob($dir . "/*.pdf") as $file)

     

    Please note, I have php version, PHP Version 4.3.11

     

    Thank you,

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