Forum Replies Created

Viewing 15 replies - 1 through 15 (of 17 total)
  • Forum: Fixing WordPress
    In reply to: Streaming a CSV
    Thread Starter jract7

    (@jract7)

    The answer was to call the code inside(at the top) of my page template using the $_POST function… That is not the solution I was looking for.. but it will work for now.

    If anyone has an idea how to email that also.. that would be a great help

    Thread Starter jract7

    (@jract7)

    I would… but the end result of all of this is to have a process setup to where you can dynamically build tables, display them on any page with a shortcode. Be able to enter/mark new data based on users info and have the ability to download that from the front and back end via permissions. And if a company would decide, aahh I don’t like that theme… then I’d be digging through pages trying to disect code, not to mention this would be a simplified answer to where most form plugins stop. If the ability to plug and play this stuff is there… why would you restrict yourself to a single page template or theme… more dynamic the better.

    Thread Starter jract7

    (@jract7)

    Hahahahahahahahaha

    Here; this is perfectly simple:

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

    Thread Starter jract7

    (@jract7)

    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.

    Thread Starter jract7

    (@jract7)

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

    Thread Starter jract7

    (@jract7)

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

    Thread Starter jract7

    (@jract7)

    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

    Thread Starter jract7

    (@jract7)

    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]

    Thread Starter jract7

    (@jract7)

    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…

    Can’t help you with the non-standard table…
    You can make a button to delete rows on the front end…
    Put this in your page template…I made a new template to show/deal with tables.

    <a href="">
           <input type="submit" name="Whitetemp" value=" Delete Data " onclick="<?php delete_data_func(); ?>" />
    </a>

    Then make a function to delete your row in your table either in your functions.php or in a plugin

    function delete_data_func()	{
    	global $wpdb;
    	$wpdb->query(" DELETE FROM your_table_name WHERE ID = '1' ");
    }

    WHERE ID is the row/entry’s ID that you want to delete

    Thread Starter jract7

    (@jract7)

    function jsadb_install()
    {
    global $wpdb;
    $table = $wpdb->prefix.’jsadb’;
    if($wpdb->get_var(“show tables like ‘$table'”) != $table_name)
    {
    $sql = “CREATE TABLE”.$table.”
    (
    id INT(9) NOT NULL AUTO_INCREMENT,
    postdate VARCHAR(10) NOT NULL,
    name VARCHAR(50) NOT NULL,
    posttitle VARCHAR(64) NOT NULL,
    UNIQUE KEY id (id)
    );
    “;

    require_once(ABSPATH . ‘wp-admin/includes/upgrade.php’);
    dbDelta($sql);
    }
    }
    register_activation_hook( __FILE__, ‘jsadb_install’ );

    Forum: Hacks
    In reply to: table setup with $wpdb
    Thread Starter jract7

    (@jract7)

    …this is the code…

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

    Forum: Hacks
    In reply to: table setup with $wpdb
    Thread Starter jract7

    (@jract7)

    Yeah, if you are referring to: $jsa_user_name, $jsa_post_title… it echos the user’s login name and post title correctly…
    Then I query on another page with:

    global $wpdb;
    $table_name = $wpdb->prefix . "jsadb";
    		foreach( $wpdb->get_results("SELECT * FROM '$table_name'") as $key => $row)
    		{
    			$my_column = $row->column_name;
    		}

    just to check and nothing shows up…so I added this to make sure the table is there:
    if($wpdb->get_var("show tables like '$table_name'") != $table_name)
    and it never finds the table…
    So I guess its not being created or I’m insert and get_results completely wrong… but per all the examples, i don’t see a problem anywhere. lol, or I’ve stared at it so long I’ve over looked something.

    Thread Starter jract7

    (@jract7)

    So I’m slowly answering my own question… so I thought I’d post to help others out if they are looking to do the same…

    Please correct me if I’m wrong on any of these points, I’d hate to be misleading or confusing, but this is the way I understand it…

    1) Use a plugin… Writing_a_Plugin
    All the half-arse leads into the good WP documention can really throw you for a loop. You can create a dynamic table in the wp database…

    ->Copy the index.php in your “wp_content/plugin directory”
    ->Name it whatever you want… we’ll use “mynewplugin.php” for this
    ->Open mynewplugin.php
    ->Delete everything out of it
    ->Setup your mynewplugin.php as so…plugin name(just the bare minimum):

    <?php
    /*
    Plugin Name: My New Plugin
    */
    ?>

    -> Open your WordPress account and goto your editor under plugins
    -> Select your “My New Plugin” in the drop down

    2) So that’s where that code goes
    Goto Creating_Tables_with_Plugins and read, re-read and follow what it says…

    3) Editing for your own use
    You can define global vars to use in other places by setting $my_new_vars in the mynewplugin.php
    Basically I changed this:

    function jal_install_data() {
       global $wpdb;
       $welcome_name = "Mr. WordPress";
       $welcome_text = "Congratulations, you just completed the installation!";
    
       $rows_affected = $wpdb->insert( $table_name, array( 'time' => current_time('mysql'), 'name' => $welcome_name, 'text' => $welcome_text ) );
    }

    To this:

    global $jsa_user_name;
    $jsa_user_name = "TestGuy";
    global $jsa_post_title;
    $jsa_post_title = "PO-0  Just a fake post for testing";
    
    function jsadb_install_data() {
    	global $wpdb;
    	global $jsa_user_name;
    	global $jsa_post_title;	
    
    	$rows_affected = $wpdb->insert( $table_name, array( 'time' => current_time( 'mysql' ), 'name' => $jsa_user_name, 'text' => $jsa_post_title ) );
    }

    I’m assuming that creating the global vars $jsa_user_name and $jsa_post_title will allow me to add data by calling jal_install_data (which I renamed jsa_add_data)

    My next question is do functions work in WP like they do in other programming languages… HERE… no, the scope of a function’s variables can only be used in that function if you redefine the global…like above:

    global $jsa_user_name;
    $jsa_user_name = "TestGuy";
    global $jsa_post_title;
    $jsa_post_title = "PO-0  Just a fake post for testing";
    
    function jsadb_install_data() {
    	global $wpdb;
    	global $jsa_user_name;
    	global $jsa_post_title;
    Thread Starter jract7

    (@jract7)

    Thank you Tobias, appreciate you time

Viewing 15 replies - 1 through 15 (of 17 total)