SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Apr 2012
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to export these data in csv file can any one modify this to get in csv file

    <?php
    $username = "root";
    $password = "";
    $hostname = "localhost";
    $ctr=0;//connection to the database
    $dbhandle = mysql_connect($hostname, $username, $password)
    or die("Unable to connect to MySQL");
    //echo "Connected to MySQL<br>";

    //select a database to work with
    $selected = mysql_select_db("mysql",$dbhandle)
    or die("Could not select databse indianh3_jml1");
    $data = (mysql_query("select jos_vm_product.product_name, jos_vm_product.product_s_desc, jos_vm_product_price.product_price, concat('http://www.indianhairmanufacturer.com/components/com_virtuemart/shop_image/product/',product_full_image) as product_fimage from jos_vm_product, jos_vm_product_price WHERE jos_vm_product_price.product_id = jos_vm_product.product_id order by product_parent_id,jos_vm_product.product_id ")) or die(mysql_error());
    $info = mysql_fetch_array( $data );
    ?>
    <table border=1>
    <tr>
    <td>title</td>
    <td>descriptions</td>
    <td>image1</td>
    <td>Price</td>
    </tr>
    <?php
    while($info = mysql_fetch_array( $data ))
    {
    echo "<tr><td>";
    Print $info['product_name'];
    echo "</td><td>";
    Print $info['product_s_desc'];
    echo "</td><td>";
    Print $info['product_fimage'];
    echo "</td><td>";
    Print $info['product_price'];
    echo "</td></tr>";
    }
    Print "</table>";
    mysql_close($dbhandle);
    ?>

  2. #2
    SitePoint Enthusiast
    Join Date
    Apr 2004
    Location
    Michigan
    Posts
    79
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •