[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  MySQL access through PHP scripting (ODBC)

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?
(New message)
Subject: MySQL access through PHP scripting (ODBC)
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please).
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Pages: 1  2 

Posted by Nick Gammon   Australia  (18,772 posts)  [Biography] bio   Forum Administrator
Date Wed 27 Dec 2006 07:18 PM (UTC)  quote  ]
Message
You may want to go to the PHP site, this is really a PHP problem, perhaps there is a forum posting there that clears the issue up.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (18,772 posts)  [Biography] bio   Forum Administrator
Date Wed 27 Dec 2006 07:17 PM (UTC)  quote  ]
Message
The standard Windows DLL loader gives that error message ("The specified procedure could not be found."), I think, if there is any problem loading the DLL, except finding the DLL itself, in which case the message is "The specified module could not be found.".

Thus, until you get rid of any errors that the dependency checker reports, I don't think it will work.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Yergo   Poland  (20 posts)  [Biography] bio
Date Wed 27 Dec 2006 09:24 AM (UTC)  quote  ]
Message
I checked php_mysql.dll with Dependency Walker. It requires apphelp.dll, so I'd downloaded it and put into windows/system directory. But when checking dll again, there are some errors like "Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module". I don't understan it... Mushclient is still going with previous errors ("procudure not found"). I don't know how to repair it. Any ideas?

I'm doing my best with English... Sorry ;)
Scripting: php (currently rewriting things to Lua)
[Go to top] top

Posted by Nick Gammon   Australia  (18,772 posts)  [Biography] bio   Forum Administrator
Date Tue 26 Dec 2006 06:04 PM (UTC)  quote  ]
Message
"Procedure not found" can mean either the entry point you are looking for is not there, or there is a missing dependency (on another DLL). If you have a dependency-checker, you can see what other DLLs that one needs.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Yergo   Poland  (20 posts)  [Biography] bio
Date Tue 26 Dec 2006 04:45 PM (UTC)  quote  ]
Message
ok. i installed php as CGI etc. Edited php_activescript.ini (in mush directory) with this:
---------
; Directory in which the loadable extensions (modules) reside.
extension_dir = "C:\php.5.1.1\ext"

;Windows Extensions
;Note that MySQL and ODBC support is now built in, so no dll is needed for it.
;
extension=php_mysql.dll
---------
And it seems to do "something". There occurs an error at session startup: "PHP Startup: Unable to load dynamic library 'C:\php.5.1.1\ext\php_mysql.dll' - procedure not found"

Maybe this is some clue for Nick ;) I have no other ideas...

I'm doing my best with English... Sorry ;)
Scripting: php (currently rewriting things to Lua)
[Go to top] top

Posted by Nick Gammon   Australia  (18,772 posts)  [Biography] bio   Forum Administrator
Date Sun 11 Dec 2005 07:55 PM (UTC)  quote  ]
Message
Lol. It seems that the interpreter must be counting cumulative time. Google on the error message, there are quite a few hits.

Either increase the limit in php.ini (which only defers the problem) or find a way to make it reset the counter each time you enter a script.

Time to switch to Lua, I think. :)

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by RashinLord   Canada  (29 posts)  [Biography] bio
Date Sun 11 Dec 2005 02:09 PM (UTC)  quote  ]
Message
Yeah, I got all that working. :)

When does mush send this error?

"Maximum execution time of 60 seconds exceeded"

Before I got it when there was an error and mush hadn't finished processing the script in 60 seconds. Now I'm not getting any errors, only the message 60 seconds after I load the script. My in-script notifications on what it's doing shows up all the way to then end. (i.e. "Script Loaded.").

Any Ideas?
[Go to top] top

Posted by Nick Gammon   Australia  (18,772 posts)  [Biography] bio   Forum Administrator
Date Sun 11 Dec 2005 12:23 PM (UTC)  quote  ]
Message
My first reaction is to declare your global variables at global scope. That is, at the start of the script have:

global $reporting;
global $channel;
global $ti;
global $items;


As for the alias, it worked for me. Did it fire? Did you have "regular expression" checked?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by RashinLord   Canada  (29 posts)  [Biography] bio
Date Sun 11 Dec 2005 10:55 AM (UTC)  quote  ]

Amended on Mon 12 Dec 2005 07:05 PM (UTC) by RashinLord

Message
Alrighty Nick. Everything so far has worked wonderfuly, I can access all my item information via ODBC from my MySQL DB/Server.

Heres my latest problem. I have a small set of globals, some work, some don't.

Here is my code.
---------------------------------------
[Code]
$items = Array();
$ti = 0;
$reporting = 1;
$channel = "gdt";

function init_db(){
global $ti;
global $items;
$iparse = array();

$dsn = "mydsnname";
$user = "root";
$upasswd="********";

$query = "select * from items";
$conn = odbc_pconnect($dsn, $user,$upasswd );

if ($result = odbc_Exec($conn, $query)) { //execute query
$world->Note("Query returned : " . odbc_num_rows($result) . " rows");
while (odbc_fetch_row($result)) { // fetch each row
$items[$ti]['name'] = odbc_result($result, "name");

$ti++;
}
}
}

function set_channel ($name, $line, $wildcards){
global $channel;

$channel = $wildcards[1];
$world->Send($channel . " I am now reporting on this channel.");
test_channel();
}

function test_channel(){
global $channel;

$world->Note("this is a test: " . $channel);
}

function display_items ($name, $line, $wildcards){
global $reporting;
global $channel;
global $ti;
global $items;

test_channel();

$world->Note($channel . $reporting);

for($i=1;$i<$ti;$i++){
if(!$reporting || !$channel) {
$world->Note($items[$i]['name']);
}else{
$world->Note($channel . " " . $items[$i]['name']);
$world->Send($channel . " " . $items[$i]['name']);
}
}
}

function foobar (){
$world.Note("You foo, I bar");
}

$world->Note("!-[Loading Script]-!");
$world->Note("Init DB...");
init_db();
$world->Note("Complete");
$world->Note("!-[Script Loaded]-!");


The global variables in the function "display_items" seem to be registering as local variables and not pointing to the global ones previously defined.

Also, I can't get any wildcards to work.

i.e.


function nick($name, $line, $wildcards){
    $world->Note($wildcards[1]);
}

The output of that is null, as if I typed nothing.
yet my aliases is set up for "^nick (.*?)$".

Thanks!

RashinLord
[Go to top] top

Posted by RashinLord   Canada  (29 posts)  [Biography] bio
Date Sun 11 Dec 2005 06:42 AM (UTC)  quote  ]
Message
Ok, so it's offical. I'm a newb, and back to that age old computer tech-support question, "Is it plugged in?". - MySQL wasn't flicked on.

-RL
[Go to top] top

Posted by RashinLord   Canada  (29 posts)  [Biography] bio
Date Sun 11 Dec 2005 01:48 AM (UTC)  quote  ]
Message
That's awesome Nick. Unfortunatly apon clicking 'test' I got this message.
"Request returned with SQL error."

-RashinLord
[Go to top] top

Posted by Nick Gammon   Australia  (18,772 posts)  [Biography] bio   Forum Administrator
Date Sat 10 Dec 2005 07:41 PM (UTC)  quote  ]
Message

OK, you have installed it, now you need to configure it. This is pretty simple, but under XP I found it a bit hard to find, so I have done some screenshots for you.

Locate the ODBC control panel. First select Performance and Maintenance:

Main control panel

Select Administrative Tools:

Administrative Tools

Choose ODBC control panel:

ODBC control panel

Click on the "System DSN" tab and then Add:

Add ODBC item

Scroll down until you see MySQL Driver, select it, and click Finish:

MySQL data source

Fill in the boxes (I have pixellated some here). The "Data Source Name" is the thing you refer to in PHP. This is what connects the data source name (eg. mydsnname) to the server/user/password/database combination.

Datasource name fields

Once you have done all that you should be able to click "Test" and get a successful message back saying it connected. If not, click Diagnostics to see what the error message was (eg. no access).

Then click OK to close this dialog.


You should now see your DSN in the list of available system DSNs. Once that is there, close the control panel, and the script should work.

DSN in list


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by RashinLord   Canada  (29 posts)  [Biography] bio
Date Sat 10 Dec 2005 12:24 PM (UTC)  quote  ]
Message
Hehe. Ok, now I know this isn't the ODBC newbie forum but perhaps you can give me a quick hand.

I downloaded the ODBC .msi installer from the MySQL site. Ran it. Copied your bit of database connection script from the last post to my script.

"odbc_connect(): SQL error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified, SQL state IM002 in SQLConnect"

I'm stumped, I tried changing my connection info etc aswell as removing/reinstalling the .msi.

-RashinLord
[Go to top] top

Posted by RashinLord   Canada  (29 posts)  [Biography] bio
Date Sat 10 Dec 2005 01:30 AM (UTC)  quote  ]
Message
Oh, cool. See, I told you didn't have the first clue as to what it was. :P
[Go to top] top

Posted by Nick Gammon   Australia  (18,772 posts)  [Biography] bio   Forum Administrator
Date Sat 10 Dec 2005 01:20 AM (UTC)  quote  ]
Message
What other database? ODBC is a way of accessing a mySQL database. My example uses a mySQL database.

ODBC is a "generic" database wrapper that accesses other databases via the ODBC control panel.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


10,125 views.

This is page 2, subject is 2 pages long:  [Previous page]  1  2 

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]