WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Query working on localhost but not online (13 posts)

  1. jract7
    Member
    Posted 2 years ago #

    I have a Export CSV button and everything was working fine on my localhost. But when I put my site online, the export_csv() function quit working...

    I'm using ABSPATH in the filename and it echos the correct file and doesn't die when I call fopen.... seems to be in order... no errors show up when I $wpdb->show_errors();

    I've tracked it down to the query function...

    $query = "SELECT * FROM wp_jsadb";
    $results = $wpdb->get_results( $query,  ARRAY_A );

    it is only passing "Array" back as a result...
    So when I run my results through the foreach statement, I get nothing...but interestingly enough... the function also quits working when in that foreach statement... I'm lost...

    Like I said, it worked fine on my localhost (WP 3.2.1)

    So is there some different things going on in the older versions of wordpress that would effect how my function works? Something i'm missing here?

    Any advice would be greatly appreciated

  2. jract7
    Member
    Posted 2 years ago #

    Any of you ppl actually help other ppl on this site... or just ignore everyone unless its a super simple up your ass question? I need some fn help... I've asked 5 questions on this forum so far and only 1 person has been nice enough to help... couldn't answer my question, but at least he chimed in and tried. When i scoure the forums/codex or google for five days for information i can never find shit about anything complex... ur fuckn codex is miss leading on so many points...syntax on some of this shit is off the wall... do I have to pay someone to get some real help? I see a ton of ppl that never get answers to their questions.... You ppl n charge of wordpress have a fantasic piece of software... really amazing... but you might work on pr a little. Sorry, just pissed that I dig and dig and dig and never get anyone to help... I have to code, re-code, for five fn days to solve a simple little problem that my lack of knowledge presents... I've worked with many programming languages, 1000s of dollars in software with various teams and I have never, never ran into a fn worse community or harder software to get help with. Instead of coming out with 50 versions that webhosts can't even keep up with, why in the hell don't you ppl make your fn community a little better. Can I really get some fucking help from you ppl? Do I need to pay for it? i will, I have deadlines to meet and I'm a C++/VB programmer, so all of this stuff is new to me. If more info is needed, then ask for it... be a help... not a bunch of assholes that are either too good to help, or just don't want to share some piece of info that they could make money off of. Just a thought...

  3. ClaytonJames
    Member
    Posted 2 years ago #

    Is it possible that your question(s) have been so uniquely specific to your own project that it accidentally renders the details of your repeated requests so obtuse to others that they just don't understand how they can best serve your interests? Try changing your approach a little. Break your issues down into sentences with words limited to two syllables or less. That way, you will be making it simple for all the folks that are volunteering their time here to understand, and it might improve your response rate. It's not your fault. Really. They didn't understand that you were on a deadline.

    Break what you need into an easy to follow outline and attack it a piece at a time. You know... organize your thoughts. Do it like you're talking to children. Seriously, give it a try.

    [edit] Or you could hire somebody. http://jobs.wordpress.net/

  4. Big Bagel
    Member
    Posted 2 years ago #

    Your original question is obtuse. I have no idea what your export_csv() function looks like or how it works and thus can't provide any suggestions on why it's not working. What I can tell you is that the query you're running will most likely return an array of arrays . Use var_dump() or print_r() to see exactly how the returned array is structured so you can properly access its information.

    This is a volunteer-run forum and you're asking specific questions about advanced topics while providing little to no useful background information. We are not your personal code monkeys. Try waiting more than a day before you go on a disrespectful tirade about the same people you're asking for help.

  5. jract7
    Member
    Posted 2 years ago #

    Alright... i've dug enough to figure out that the file is not being handled correctly.

    Can fopen, open a http address that points to the filename?

    [Code moderated as per the Forum Rules. Please use the pastebin]

  6. Jackson
    Member
    Posted 2 years ago #

    Can fopen, open a http address that points to the filename?

    Yes, but some server configurations will disable it. You can use the HTTP API to grab a remote file's contents.

    http://codex.wordpress.org/HTTP_API

    PS - You code was moderated in your last post.

  7. jract7
    Member
    Posted 2 years ago #

    code from pastebin to see what I'm trying to do...

    http://pastebin.com/embed_js.php?i=VpnwJuSg
    Btw...this is in a plugin, not in my functions.php or anything.

    @jackson... thank you, I'll try that

  8. Jackson
    Member
    Posted 2 years ago #

    You cannot write to a file opened via HTTP, only read it.

    "Resource ID #114" refers to the resource created by opening the file via fopen, there's just no way for it to write to a remote file via HTTP.

    Check out plugin_dir_path to get the filesystem path to the plugins folder:
    http://codex.wordpress.org/Function_Reference/plugin_dir_path

    You also might want to checkout the filesystem API, well documented by Otto here : http://ottopress.com/2011/tutorial-using-the-wp_filesystem/

  9. jract7
    Member
    Posted 2 years ago #

    Awesome Jackson! Sending me on the right path... I thank you very, very much!

  10. Jackson
    Member
    Posted 2 years ago #

    Perhaps now you'll agree your profanity laced tirade was out of line? and incredibly offensive... You'll always attract more flies with honey rather than vinegar.

    If you are patient and state your problem clearly usually someone will try and help you. Very rarely will they offer to help if you call them a bunch of a-holes.

    Good luck!

  11. jract7
    Member
    Posted 2 years ago #

    Yeah, it was out of line, agreed; and my apologies to those I offended.

  12. jract7
    Member
    Posted 2 years ago #

    So after reading through the examples/info you gave me jackson, I'm beginning to think... I need to rethink this whole process...lol. I have the WP_Filesystem up and running. It will read the data to the .txt file, but not to the .csv...I'm sure I can figure that out... but my response to how the WP_Filesystem works brings up a few concerns....

    1st, all my users will need this functionality from the front end and none of them have/nor need admin level access, so writing with the WP_Filesystm API would make things much difficult. Were talking 50+ employees... All of them getting ftp access is rediculious.

    2nd, I do not really need to access that csv file for anything more than writing the data from the query. I mean that file is just a placeholder for the data on the local server so I could link to it and they could download... so i need it streamed and really it doesn't have to touch a server file.

  13. jract7
    Member
    Posted 2 years ago #

    Hahahahahahahahaha

    Here; this is perfectly simple:

    http://xavisys.com/howto-create-stream-csv-php/

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags