Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

Encountered a NOTICE while searching something

+2 votes
497 views
asked Feb 2, 2014 in Q2A Core by Gurjyot Singh

While searching something on my q2a website, I encountered a notice on top area of header. The notice says

Notice: Undefined index: postid in /home3/name/public_html/my_site.com/qa-plugin/q2am-star-ratings/q2am-star-ratings-process.php on line 60

Can someone tell me that what is this and how can I fix this problem. So that it won't show in future.

Q2A version: 1.6.3

6 Answers

+1 vote
answered Feb 2, 2014 by pupi1985
selected Feb 2, 2014 by Gurjyot Singh
 
Best answer

I've proposed a fix to the plugin owner. Check the simple change here and let us know if you still get that notice.

BTW, I guess the easy way to test this would be to go to your profile and save it. That should fire an event that does not have a 'postid'.

Edit:

Whoops. Corrected previous commit here. I missed the curly braces.

commented Feb 2, 2014 by jatin.soni
I'm really sorry I have overlook this fix you send me. I will update it soon as possible.  Thanks for your contribution.
commented Feb 2, 2014 by pupi1985
Don't worry, there is no issue, just a notice in the server log. Take your time :)
commented Feb 2, 2014 by Gurjyot Singh
moved Feb 2, 2014 by Scott
Thanks a lot pupi1985, the problem has been resolved.
+1 vote
answered Feb 2, 2014 by Scott
It's a problem with the star ratings plugin. Look at the file and line given in the error.
+1 vote
answered Feb 2, 2014 by Gurjyot Singh

I opened the named file and saw that line but couldn't figure out what is the problem. Below is a screenshot of that file with the mentioned line.

 

See if you can help me by having a look at the pic.

+1 vote
answered Feb 2, 2014 by Gurjyot Singh

After doing what pupi1985 said, the following error shows up while searching anything and even while loggig in and logging out.


Notice: Undefined variable: post_id in/home3/name/public_html/my_site.com/qa-plugin/q2am-star-ratings/q2am-star-ratings-process.php on line 65

A Question2Answer database query failed when generating this page.

A full description of the failure is available in the web server's error log file.

 

commented Feb 2, 2014 by jatin.soni
Folks I'm busy in some shifting and so will get internet coming weekend. After that I will look in to the issue. Meantime if anyone find the fix. Feel free to fork on github and send me pull request. I would thankful.
commented Feb 2, 2014 by pupi1985
My bad. I didn't add curly brackets to the IF statement. Check here:https://github.com/pupi1985/q2am-star-ratings/commit/a1dbe4cc90e7d235f410937616e9fe6cbb717d07
0 votes
answered Feb 14, 2015 by CB Singh

Getting error on each question -

Notice: Object of class mysqli_result could not be converted to int in /home4/mgghu/public_html/www.lawhelpline.org/qa-plugin/q2am-star-ratings/q2am_star_ratings_class.php on line 62
 

+1 vote
answered Jan 2 by akashjeez
i got same error but done, even i modifed these lines in file -> q2a-star-rating-process.php

        if($event == 'q_post' || $event == 'a_post') {
            $post_id = $params['postid'];

please help me to get rid of this error..
...