Hey, Iīm having a problem. Iīm constructing a poll block, but first Iīm trying to make it as a module. I installed a poll script in my webspace, and it works perfectly
... keeping all the directories as they were, and Iīm given this error:
Quote:
Warning: mysql_connect(): Access denied for user: 'nobody@localhost' (Using password: NO) in /home/oc-zone/public_html/modules/Poll/common.php on line 203
Unable to connect to the database!
So, anybody could help me solve the problem? I canīt understand whi this happens, since it works perfetcly as a non-module.
Thankx for any help
Hadron Corporal
Joined: Aug 20, 2003
Posts: 61
Posted:
Mon Aug 25, 2003 9:25 am
If this is a module why are you writing your own db connection function when nuke has already made a connection? Just use the existing one. If you are inside of a function just make sure to "global $db" inside that function and use the sql abstraction layer already written for you.
--Hadron
marsupillami Private
Joined: May 01, 2003
Posts: 42
Posted:
Mon Aug 25, 2003 11:07 am
It is because I donīt know how to do that. Hereīs an example of a function that demands a connection:
Code:
function symp_poll_fetch($pid) {
global $s_dbid, $SYMP_REMOTE_ADDR, $s_blength, $s_iplog, $s_cookielog,
$sympvotes, $s_srand, $S_VIEW_HIDDEN, $S_VIEW_OPEN, $S_VIEW_CLOSED;
So, first of all I would have to delete de symp_connect ();. I didi it, and got this error:
Quote:
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/oc-zone/public_html/modules/Poll/common.php on line 262
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/oc-zone/public_html/modules/Poll/common.php on line 263
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/oc-zone/public_html/modules/Poll/common.php on line 269
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/oc-zone/public_html/modules/Poll/common.php on line 271
Thanks for any help.
Hadron Corporal
Joined: Aug 20, 2003
Posts: 61
Posted:
Mon Aug 25, 2003 12:47 pm
Quote:
So, I changed this page to a module, so that I could see header, footer, menus, etc, and coded it this way:
Rather than "require" your code, why not just copy paste it into that section? That would be my suggestion. Regardless, you can still do the following:
Meanwhile, I fixed some problems in mainfile.php, that were the cause of the failure in mysql connection, and tried again to fix the module, and now the module works perfectly. However, I wanīt to use it as a block, not a module, and I thought that it should work, as it must be the same. However, when I tried to amke it work as a block, I got the mysql problem. Changed the variables in common.php, that were the cause of the failure in connection (instead of requiring config.php, it gets the variables directly), and now I get no error, and says that I have an empty block.
How should I put this?
Code:
<?php
if (eregi("block-Poll.php", $PHP_SELF)) {
Header("Location: index.php");
die();
}
Just found out one thing. The problem I thought that was from mainfile.php, was not. The problem is that poll, that closes the mysql connection at the end. Because of that, I was receiving mysql errors. The only way is how you told me.... using the same mysql connection. Could you please explain it better to me? Or if there is a tutorial on the web, could you please tell me where?
Thankx for the help
Hadron Corporal
Joined: Aug 20, 2003
Posts: 61
Posted:
Thu Aug 28, 2003 7:18 am
Do you "echo" your html content out or do you place it in a $content variable? It should be $content for a block.
Other than that, I'd have to see booth.php to do much else.
--Hadron
marsupillami Private
Joined: May 01, 2003
Posts: 42
Posted:
Thu Aug 28, 2003 8:04 am
For blocks, I use $content varuabel, and I tried to put that inside a $content ".... "; and no go It would echo the newest_booth (1)
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum