Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest sNews - sNews 1.7 - with its own forums - for discussion and user mods.

Author Topic: Odd MySql Error on Archives page.  (Read 4276 times)

GrogDog

  • Newbie
  • *
  • Karma: 0
  • Posts: 5
Odd MySql Error on Archives page.
« on: December 20, 2006, 06:59:21 PM »

Hi,

 I just installed version 1.3 (have done so many times as I use sNews for many sites) and just saw an error on the Archives page that I have never seen before.

Under the Category for Home on the archives page I see this:

Code: [Select]
Warning: mysql_query(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/content/***removed for security***/html/killware/chronicles/snews.php on line 460

Warning: mysql_query(): A link to the server could not be established in /home/content/***removed for security***/html/killware/chronicles/snews.php on line 460

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/content/***removed for security***/html/killware/chronicles/snews.php on line 461
So I opened snews.php and looked at lines 460 and 461 and this is all I see, nothing unusual:

Code: [Select]
// ARCHIVES
 function archives() {
        echo "

". l('archives') ."

";
        echo "

". l('home') ."

";
       $query = "SELECT * FROM " .s('prefix'). "articles WHERE position = 1 AND category = 0 ORDER BY id  DESC";
      [b] $result = mysql_query($query);
        while ($r = mysql_fetch_array($result)) {[b]
                $date = date(s('date_format'), strtotime($r['date']));
NOTE: I put lines 460 and 461 in bold so you can see which ones they are.
NOTE: I put the text: ***removed for security*** in this post so as not to expose my server path. paranoia :)

Any ideas?

Everything is working fine, but I'd really like to get this ugly mysql error of the archives page and have the posts made in the home category show up under Home on the archives page.

p.s. v ersions 1.4 and 1.5 do not work properly on my host, so I continue to use 1.3, I like it anyway, clean and simple. :)
Logged

Mika

  • Hero Member
  • *****
  • Karma: 9
  • Posts: 1377
    • http://www.ni5ni6.com/
Odd MySql Error on Archives page.
« Reply #1 on: December 20, 2006, 08:43:04 PM »

[disclaimer] I'm not familiar with 1.3... ;) [/disclaimer]

Youre' right - nothing's wrong there... I'm not sure is this helpful but try to enclose those numbers with single quotes
Quote
$query = "SELECT * FROM " .s('prefix'). "articles WHERE position = '1' AND category = '0' ORDER BY id  DESC";
Something else puzzles me: the main problem is this
Quote
Can't connect to local MySQL server through socket '/tmp/mysql.sock'...
and all the other db issues are merely consequential... what's worse, you said that everything else was fine (?)

At this point all I can offer you is to recheck your db settings (path, connection preferences, permissions etc.) or contact your server admin...
Logged
http://www.ni5ni6.com/ - Tutorials, Mods and How-To's about sNews CMS
sNews 1.6 Developers Edition - commented sNews 1.6 version

GrogDog

  • Newbie
  • *
  • Karma: 0
  • Posts: 5
Odd MySql Error on Archives page.
« Reply #2 on: December 21, 2006, 05:32:19 AM »

Hi Mika,

 Thanks for your reply. :)

Yeah it's weird, I'm running sNews on multiple hosting accounts and have never seen this before, I did everything same as always, so not sure what's causing this.

Ok, I tried adding the single quotes but it had no effect. Good idea to try though.

Yeah, I don't get "Can't connect to local MySQL server through socket '/tmp/mysql.sock'  either", not sure what's going on there, and why everything else works fine, I just get this error in that one place.

I did, I've checked and rechecked everything, compared it to other installs on the same hosting company, etc. Everything is set as it should be with the db settings, I went through all my code with a fine tooth comb too. At first I though a javascript I use might be the culprit, but I tried the site without it and it made no difference to the issue.

Oddly enough, I temporarily moved this same site to another hosting account with a different company, then set it up using version 1.5, and got a very similar error in the same spot. But everything else worked fine there too. Which is really bizarre considering the snews.php page is different between 1.3 and 1.5.

I guess I'll have to call tech support, hopefully they can figure it out.

Thanks for trying mate. :)
Logged