Page 1 of 1

pulling data uit of database

PostPosted: Fri Jan 26, 2007 4:47 pm
Author: Skywalker
Your phpBB Version: 2.0.
phpBB Type: Standard phpBB
MODs: No
Your knowledge: Beginner
Board URL: [url]http://[/url]

PHP Version:
MySQL Version:


What was done before the problem appeared?



What was done to try to solve the problem?




De.scription and Message

wich code do i need to use to pull some data out off the database lets say i want to display some text when a number of member is reached and i want to show the data from row max_users.

when i use:
Code: Select all
if ( $board_config['max_users'] == 100){*some code*}


or
Code: Select all
if ( $board_config['max_users'] == '100'){*some code*}

it will not work...
attention this is an example max_users can be replaced by something else
also it could be that on some pages this code will work
what i need is some other code that will do the same as this code suposed to do...

when i got this to work i can also finish 2 other mods i'm working on and when ready they will be released on integrmod

Re: pulling data uit of database

PostPosted: Fri Jan 26, 2007 6:33 pm
Author: Teelk
You can try something like this...

In the php file...
Code: Select all
$message = ($board_config['max_users'] == 100) ? sprintf($lang['how_many_users'], $board_config['max_users']);


Then in the $template->assign_vars(array do something like 'MESSAGE' => $message,

And put {MESSAGE} somewhere in the .tpl file.

Then you'll need a lang key...
Code: Select all
$lang['how_many_users'] = 'There are %s users allowed.';
The %s is where the $board_config['max_users'] would be shown.

Re: pulling data uit of database

PostPosted: Fri Jan 26, 2007 6:44 pm
Author: Skywalker
you have understand it wrong i think,
instead of
Code: Select all
if ( $board_config['max_users'] == 100)

i want some coding like
Code: Select all
$sql = " SELECT * FROM  "...
or something lik ethat, i have the right code for displaying the data also the right code to update the data only on that page i like to display the code
Code: Select all
if ( $board_config['max_users'] == 100)
seems not to be working so i need another code to pull it out of the db...

Re: pulling data uit of database

PostPosted: Fri Jan 26, 2007 6:51 pm
Author: Teelk
What specifically are you trying to pull out of the database?

Re: pulling data uit of database

PostPosted: Fri Jan 26, 2007 7:00 pm
Author: Skywalker
"Teelk";p="20462" wrote:What specifically are you trying to pull out of the database?

i need it for more then one mod basicly the exact data in the database like i said max_users is the number off users on the board lets say it is 200 i want to be able to extract that number and put it wherever i want also i'm busy making a mod to welkom lets say the 250st member.
there fore i need a code like the one i posted, if i got it for one mod i can edit it for the others, no problem.
my problem is just that the code posted above does not work for what i need it

Re: pulling data uit of database

PostPosted: Mon Jan 29, 2007 3:01 am
Author: Skywalker
*bump* can someone plz give me the other code i requested so i can work further on those mods?