Not signed in (Sign In)

Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorclintonia
    • CommentTimeJan 24th 2008
     

    Hi,

    I was just wondering if anyone has ever messed with phpFox. I’ve been thrown to the wolves!! :p

    We have one developer working on a couple modifications, but it’s taking a long time for him/her to finish so they thought that I could just blink my eyes and make things work. While they’re working on their mods, I have to figure out how to change all kinds of things.

    I won’t go into details, it’s too much right now. I just cannot find any documentation on doing anything other than installing the basic package. I found some video tutorials, but you have to pay for them.

    Thanks to anyone who can shed some light.

  1.  

    Never used it. Is it a CMS?

    • CommentAuthorclintonia
    • CommentTimeJan 29th 2008
     

    I’m not sure how you’d classify it. It’s a sort of community site application (a la MySpace), I guess.

    • CommentAuthorclintonia
    • CommentTimeFeb 15th 2008 edited
     

    Hi all,

    Still working on this, but have made some decent progress. I’m trying to give the admin the ability to export certain users out of the DB into a CSV. I’m not on a php5 box (I know…boooo!), so the csv functions are not available. I found a little snippet online, but it’s messing up the data.

    $result = mysql_query($sql) or die(mysql_error()); $csv_output = ""; while($row=mysql_fetch_assoc($result)) { foreach($row as $key=>$value) { if($key = "welcomepack"){$csv_output .= " '". $value ."'";}else{$csv_output .= " '". $value ."',";} } if($key = "welcomepack") { $csv_output .= "\n"; } } header("Content-type: application/vnd.ms-excel"); header("Content-disposition: attachment; filename=csvRide.csv"); print $csv_output; exit;

    http://ridering.net/csv-dir/csvDL.php

    that link will take you to the download.

    If anyone has any thoughts as to why the data is being separated like that, please let me know. I’ve had help from some of the users at Sitepoint, but still no luck.

    Thanks!

  2.  

    I see a couple things you may want to check.
    1. Your if statements will always be true. Try changing if($key = “welcomepack”) to if($key == “welcomepack”)
    2. If you mean for your values to be in single quotes that if fine. If not, change $csv_output .= “ ‘”. $value .”’”; to $csv_output .= “ “. $value;
    3. Are your values delimited by spaces or actually by commas? You may want to change to $csv_output .= “, “. $value;
    4. You will have to check to see if it is the first or last entry and add/remove commas as needed.

    • CommentAuthorclintonia
    • CommentTimeFeb 19th 2008 edited
     

    Thanks,

    I don’t know why there’s only one equals sign in those conditionals…
    $sql = "SELECT * FROM user WHERE type = '6' "; //echo $sql; $result = mysql_query($sql) or die(mysql_error()); $csv_output = ""; while($row=mysql_fetch_assoc($result)) { foreach($row as $key=>$value) { if($key = "welcomepack"){$csv_output .= " '". $value ."'";}else{$csv_output .= " '". $value ."',";} } if($key = "welcomepack") { $csv_output .= "\n"; } } header("Content-type: application/vnd.ms-excel"); header("Content-disposition: attachment; filename=csvRide.csv"); print $csv_output; exit;

    I have the values encased in single quotes so that if there are commas in the data, it doesn’t cause it to separate by those commas in the csv. “welcomepack” is the last field, so that’s why i have that conditional there to check…if it is, don’t put a comma after it. if it isn’t, then put a comma.

    When I print it out on the screen, without the prompt to download, all the data looks fine. It doesn’t cut it up and put it in places it shouldn’t be.

    edit: dammit, the php formatting wipes extra equals signs away…they’re there.

  3.  

    Ok, I see what is happening. Your array is going to have both string indexes and numerical indexes. Maybe use a for loop instead of foreach?

    • CommentAuthorjasonahoule
    • CommentTimeFeb 19th 2008 edited
     
    Another thing I noticed is that your strings have to be in double quotes in order for the commas contained within them to be ignored.
    Here is what I did.

    @<?php
    $con = mysqli_connect("localhost", "root", "", "products");

    $result = $con->query("SELECT * FROM products");

    $csv_output = "";
    $headers = true;
    while($row = mysqli_fetch_array($result))
    {
    if($headers)
    {
    foreach($row as $key=>$values)
    {
    if(is_string($key))
    {
    $csv_output .= "<b>".$key."</b>";
    $csv_output .= ($key == "model") ? "\r\n" : ","; // model is the last column
    }
    }
    $headers = false;
    }
    $count = 10;
    for($i=0; $i<$count; $i++)
    {
    $csv_output .= "\"".$row[$i]."\"";
    $csv_output .= ($i == ($count-1)) ? "\r\n" : ",";
    }
    }

    header("Content-type: application/vnd.ms-excel");
    header("Content-disposition: attachment; filename=csvRide.csv");

    print $csv_output;

    exit;
    ?>@

    Hmm, the formatting doesn't seem to like me.
    • CommentAuthorPasqualeIV
    • CommentTimeFeb 20th 2008
     
    If my products table was 4gb -- this would require a bunch of resources.
    I suggest moving the output to within the while loop.
  4.  
    Good call. That would be a rather large string.
    • CommentAuthorclintonia
    • CommentTimeFeb 22nd 2008
     

    ahh, thank you both.

    •  
      CommentAuthorHydraDavid
    • CommentTimeMar 8th 2008 edited
     

    Not to sound like a killjoy, but couldn’t you just use phpMyAdmin for this? It has excellent CSV support built-in, preventing you from having to reinvent the wheel… Also, with a quick glance at this page in the mySQL 4.1.x Reference Manual, I discovered that ‘mysqldump’ accepts the following flags:

    --fields-terminated-by=..., --fields-enclosed-by=..., --fields-optionally-enclosed-by=..., --fields-escaped-by=...

    So there’s really no need to even bother with PHP. _

    • CommentAuthorclintonia
    • CommentTimeMar 12th 2008
     

    no. it’s not for me, it’s for the client. I don’t want to give the client access to phpMyAdmin.

    • CommentAuthorkimekime
    • CommentTimeAug 5th 2009 edited
     

    Most business owners wedding invitations know well their business preferences as evidenced in wedding invitation their choices of logos,letterhead and exhibits for trade shows. Often, these preferences don’t translate to creative bridesmaid dresses designs of wedding invitation a high professional quality when attempted in-house.

    • CommentAuthorwedding
    • CommentTimeFeb 2nd 2010
     

    So you are thinking about having your wedding during the winter? <a

    href=“http://www.rs2guru.com/”>unique wedding invitations</a>
    If you want a winter wedding, there a few things that you going to need to account for. <a

    href=“http://www.vponsale.com/”>wedding dresses</a>
    With the right planning, winter weddings can be just as beautiful as spring weddings. <a

    href=“http://www.vponsale.com/”>wedding gowns</a>
    In my opinion, they can be more so.<a href=“http://www.vponsale.com/bridesmaid-dresses/”>bridesmaid

    dresses</a> However, with the wrong planning a winter wedding can be ten times more disastrous than the worst

    of springtime weddings. <a href=“http://www.vponsale.com/invitations/”>cheap wedding invitations</a>
    Your wedding could be a winter wonderland or if you are not careful, a winter wasteland.