Jump to content


  • Content Count

  • Joined

  • Last visited

Everything posted by SkyRanger

  1. New brain headache for myself. When I use this: or this The code works. I know I am missing a piece of code somewhere, done lots of searching to see how to go about doing it and was looking for a push from somebody to point me in the right direction ie with a link to an example if possible. Problem is when i use this: i get an error. Working code with first 2 urls: $viewkudoid = $_GET['viewkudoid']; $tablename=acikudos_table_name(); $showkudos = $wpdb->get_results( "SELECT * FROM $tablename WHERE kudoid = '$viewkudoid'"); $showkudosall = $wpdb->get_results( "SELECT * FROM $tablename order by kudoentry desc"); // Query to fetch data from database table and storing in $showkudosall if ( $showkudos ) { foreach ( $showkudos as $kudo ) { echo $kudo->kudoagent; } } elseif ( $showkudosall ) { foreach ( $showkudosall as $allkudo) { echo "<blockquote class=\"otro-blockquote\">"; echo $allkudo->kudomsg; echo "<span>"; echo "<b>Kudos for:</b> " .$allkudo->kudoagent. ", " .$allkudo->kudoloc; echo "<br>By: ".$allkudo->kudocust. ", " . date("F j, Y g:i a", strtotime($allkudo->kudoentry));; echo "</span></blockquote>"; echo "<hr>"; } } else { echo "No Kudos In Database"; } What I am getting with the last url without the ?viewkudosid- Notice: Undefined index: viewkudoid in C:\Program Files (x86)\Ampps\www\wp-content\plugins\advantage-kudos\include\acikudos-view.php on line 6 Line 6: $viewkudoid = $_GET['viewkudoid'];
  2. Hey maxxd. The plugin is actually going to be used for a couple of companies where they would like to keep the posts separate. Yeah I know it would save a lot of headaches. The acikudos_table_name() is for now a function: function acikudos_table_name(){ global $table_prefix, $wpdb; $table_name = $wpdb->prefix . 'acikudos'; return $table_name; } The table name is going to be changed probably within the week (once i get around to change it...lol) There is also going to be other functions included in the kudos program that is going to be k i s s for the companies that will be using it.
  3. This is still me but thanks to Gizmola I got my account back. Well on a good note I am a little farther ahead. Thanks Guys got a working part ver of 1/100 of my program...lol function show_kudos() { global $wpdb; $tablename = acikudos_table_name(); $results = $wpdb->get_results( "SELECT * FROM $tablename order by kudoentry desc"); // Query to fetch data from database table and storing in $results if(!empty($results)) { foreach($results as $row){ echo $row->kudoagent; } } }
  4. stupid me figured out the problem. I had count($hauntcount) when it was suppose to be count($rowhsr)
  5. doesn't matter if it is before or after the query, still getting the same result
  6. trying to see what the result is
  7. ok, got a new error: Notice: Trying to get property of non-object in \www\wp-content\plugins\addysearch\index.php on line 101 string(12) "815 pembroke" We found 0 results. Line 100: $rowhsr = $wpdb->get_results( "SELECT * FROM locations where stname like '%" . $houseaddy ."%'"); Line 101: $hauntcount = $rowhsr->num_rows; Line 102: var_dump($houseaddy);
  8. Tried another search and got same result string(17) "121 mount whatley"
  9. This is the result string(17) "my address" which is what was searched for and the proper information is displayed from the search
  10. Thanks Ch0cu3r but not sure what the issue is: When somebody puts in for example: My Address In the database is 123 My Address Street houseaddy = My Address stname = 123 My Address Street count is coming up = 0
  11. Is it possible to count query rows and display query, tried a number of things but can't get row count: $rowhsr = $wpdb->get_results( "SELECT * FROM locations where stname like '%" . $houseaddy ."%'"); $hauntcount = $rowhsr->num_rows; echo 'Number of entries found:' . $hauntcount; foreach ( $rowhsr as $rowhsr ) { echo $rowhsr->stname }
  12. Awesome, just what I was looking for thank you very much
  13. Perfect thank you, that fixed one problem but caused another. Now when box is empty goes to else { echo "0 entries available"; but when somebody enters an entry that does not exist just shows blank. Is there a way to combine if (!empty($rowhs)) { with if(trim($_POST["haddy"]) != "") { to show else { echo "0 entries available";
  14. I am having a problem when a user just hits submit on an empty field and having all entries displayed. Is there a way to stop this with the code I have and go right to the else { if ( isset( $_POST['hp-submitted'] ) ) { // sanitize form values $houseaddy = sanitize_text_field( $_POST["haddy"] ); global $wpdb; #$results = $GLOBALS['wpdb']->get_results("SELECT * FROM locations where stname='$houseaddy'"); $rowhs = $wpdb->get_results( "SELECT * FROM locations where stname like '%" . $houseaddy ."%'"); if (!empty($rowhs)) { foreach ( $rowhs as $rowhs ) { echo "<br />"; echo "<p><b><font color=\"#92AEFE\" size=\"4\">Report Address: </font><font size=\"4\">"; echo $rowhs->stname . ", " . $rowhs->hcity ." ". $rowhs->hprov . "</font></b><br>"; echo "<b><font size=\"4\" color=\"#92AEFE\">Report Number: </font><font size=\"4\">" . $rowhs->hid ."</font></b><br>"; echo "<b><font size=\"4\" color=\"#92AEFE\">Date of Report: </font><font size=\"4\">" . $rowhs->datepost ."</font></b></p>"; } } else { echo "0 entries available"; echo "<br /><br />"; } }
  • 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.