![]() |
Small PHP query
Im sure this will seem ever so simple to someone but I can't quite hack it for some reason.
I want to implement some functions in a script im using so that I can reuse the functions over and over, BUT, variables created outside of the function are not recognised within the function, is there any way to get around this? Here's an example: PHP Code:
Thanks in advance! :D:dunce: |
Re: Small PHP query
Quote:
This is called variable scope. You need to make those variables global to access them inside the function. To do that you need: PHP Code:
HTH |
Re: Small PHP query
OOoo Excellent thanx very much Punky, one rep coming your way :D
|
Re: Small PHP query
OK that's fixed most of it, what I have now is:
PHP Code:
Comes back with Warning: mysql_close(): supplied argument is not a valid MySQL-Link resource in /var/www/html/includes/mysql.php on line 12 Is it possible to do something similar or not? |
Re: Small PHP query
Quote:
Why not store the db details in a config file and read it in? EDIT: Like so - Contents of config.php PHP Code:
PHP Code:
|
Re: Small PHP query
Hmm theres no dbname argument in mysql_close just one for a database link, anyway ive gotten around this by not specifying a link to close which should close the only link open if there's only one open, but I'd still like to know if it can be done?
|
Re: Small PHP query
I was hoping to make it a bit more modular but it seems that that will probably be the best way. When I finish my project (IF!?) I will post the working version here :)
|
Re: Small PHP query
is there any way to get these script posts to align with horizontal resolution - or is it only me, I have 1280x768 and have to scroll sideways, what's it like for 800x600??
|
Re: Small PHP query
Weird that, I run 1280x1024 and it's fine for me. :confused:
|
Re: Small PHP query
im running 1280x1024 and theyre too wide for the Window, what browsers are we using?
IE here. |
Re: Small PHP query
Quote:
|
Re: Small PHP query
The widths are screwed in IE - firefox seems to display it ok still.
I think there is a fix for this - I'll check it out later if I get chance. |
Re: Small PHP query
Quote:
|
Re: Small PHP query
Sadly, the fix I was thinking of isn't for this, and looks decidedly buggy anyway.
|
Re: Small PHP query
Quote:
|
| All times are GMT. The time now is 08:50. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
All Posts and Content are © Cable Forum