Jump to content

SkyAuburn

Members
  • Posts

    12
  • Joined

  • Last visited

Everything posted by SkyAuburn

  1. I have 2 tables one called ackikudos and another ackikudos_setting I am trying to pull the data from acikudos for now as the settings will be pulled for another script on the same page later (creating a table based on acikudos data and admin will be able to set number of columns through admin panel)
  2. Thanks Barand doing a lot of research and self learning this method, thanks for your feedback.
  3. keep looking over code but not seeing where the error would be. The syntax looks correct.
  4. Not starting off good...lol global $wpdb; $tablename = acikudos_table_name(); $sql = $wpdb->prepare( "SELECT * FROM %s ORDER BY kudoentry desc", $tablename); $results = $wpdb->get_results( $sql , ARRAY_A ); #var_dump($results); foreach ($results as $result) { echo '<p>' .$result->kudoagent. '</p>'; } } result WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''wpl2_acikudos' ORDER BY kudoentry' at line 1] SELECT * FROM 'wpl2_acikudos' ORDER BY kudoentry
  5. No maxxd not at all. I am currently creating a kudos plugin for our company this will allow all of the tech agents to see kudos posted on our intranet site that is posted by our supervisors. I will definitely be posting with problems that I run in to.
  6. Hi maxxd, after pulling everything apart and doing a LOT more research after Barands post things are starting to fall in to place. A little messy at the moment but starting to get the results I am looking for. Been coming to this site since 2005 (SkyRanger account that I am finally getting back) and you guys have been awesome for your support.
  7. Thanks Barand I will check that out. What I am trying to do is when somebody wants to view an entry ie: viewkudoid it will display the info for that ID. but if somebody wants to view all of entries it will show all and and not just the single id
  8. Correction. I get only everything is displayed instead of the you fixed it...lol
  9. This is the link to pull the page http://127.0.0.1/kudos/?viewkudoid=### This is the kudo-function.php page function get_kudo_info($viewkudoid){ global $wpdb; $tablename=acikudos_table_name(); $viewsql = "SELECT * FROM $tablename WHERE kudoid='$viewkudoid'"; $viewresult = $wpdb->get_results($viewsql); #$vewrow = mysql_fetch_assoc($viewresult); return $viewresult; } This is the kudo-view.php page function show_kudos($viewkudoid) { global $wpdb; $viewkudoid = $_GET['viewkudoid']; $getthekudo = get_kudo_info($viewkudoid); if ($viewkudoid == $getthekudo['kudoid']) { echo 'Congratulations, you have successfully fixed it!'; } else { echo 'Everything is displayed'; } } add_shortcode( 'kudosview', 'show_kudos' ); I know the issue is right in front of me but I can not find it.
  10. Not sure what happened, rewrote the sql from scratch and I think it hates me because it now works with this code. Still have no idea what is going on as it looks the same as orig other than the mediumint $sql = "CREATE TABLE $table_name ( kudoid mediumint(9) unsigned NOT NULL AUTO_INCREMENT, kudomsg text NOT NULL, kudoagent text NOT NULL, kudocust text NOT NULL, kudoacct int(16) NOT NULL, kudoclient varchar(100) NOT NULL, kudoloc text NOT NULL, kudoentry TIMESTAMP DEFAULT CURRENT_TIMESTAMP, kudoadmin text NOT NULL, kudopic varchar(55) DEFAULT '' NOT NULL, PRIMARY KEY (kudoid) );";
  11. Doing some tests with the insert. If I remove the NOT NULL from everything after kudomsg it goes in. Anybody have an idea of why it dies when NOT NULL is in the SQL?
  12. For the life of me I can not figure out why this is not creating the table in the database. Second set of eyes would be great. function install_kudos() { global $wpdb; $table_name = $wpdb->prefix . 'acikudosnew'; if ($wpdb->get_var('SHOW TABLES LIKE ' .$table_name) != $table_name) { $sql = "CREATE TABLE $table_name ( kudoid int(9) NOT NULL AUTO_INCREMENT, kudomsg text NOT NULL, kudoagent text NON NULL, kudocust text NOT NULL, kudoacct int(16) NOT NULL, kudoclient varchar(100) NOT NULL, kudoloc text NOT NULL, kudoentry TIMESTAMP DEFAULT CURRENT_TIMESTAMP, kudoadmin text NOT NULL, kudopic varchar(55) DEFAULT '' NOT NULL, PRIMARY KEY (kudoid) )"; require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); dbDelta( $sql ); } } register_activation_hook(__FILE__, 'install_kudos');
×
×
  • 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.