MyBB Source


AdvancedProfile 3.0 - Express your style! | MyBBSource Tutorials: Read, Learn, Enjoy!

Latest Releases: Mark Thread Read - Password Change - Mark Unread

 
 
Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help me and earn some MyBux!
Author Message
ByteHunter
Community builder

Support

Posts: 1,284
Joined: Dec 2008
Reputation: 16
MyBux: 1891
Post: #1
Help me and earn some MyBux!
Hi . I want to build my first MyBB plugin .
I want to select a value from database and echo it but it didn`t works for me.
$code is aleary defined
I close the connection to my original database and I connect to the new one.
PHP Code:
mysql_close(freecode_database);
mysql_select_db('freecode_ropypass') or die ("Connection failed".mysql_error());
$value_querry mysql_query("SELECT id FROM ropy_code WHERE value='$code'") or die(mysql_error()); 
$valid =  mysql_fetch_array($value_querry );
echo 
$valid
I get only "Array" message displayed.
the value of the valid in the selected critesrias sould be 1.
What sould I modify in the code ?
As this isn`t a General MyBb support I`ve opened a topic there and I`ll give 6 MyBux for who will help me to solve this and get the right value from the database.
Thanks
ByteHunter

MyBBSource Team
runBB - Free myBB forum hosting

[Image: ByteHunter.png]
(This post was last modified: 06-21-2009 02:54 AM by ByteHunter.)
06-19-2009 03:23 AM

Advertisement

Nickman
Manager



Posts: 2,338
Joined: May 2008
Reputation: 46
MyBux: 31600
Post: #2
RE: I get "Array" when trying to get a value from database
You need to use :

PHP Code:
echo $valid['id']; 
06-19-2009 04:01 AM
ByteHunter
Community builder

Support

Posts: 1,284
Joined: Dec 2008
Reputation: 16
MyBux: 1891
Post: #3
RE: I get "Array" when trying to get a value from database
Thanks Nickam. You saved me againt
6MyBux sent!
Thanks again

MyBBSource Team
runBB - Free myBB forum hosting

[Image: ByteHunter.png]
06-19-2009 05:22 AM
ByteHunter
Community builder

Support

Posts: 1,284
Joined: Dec 2008
Reputation: 16
MyBux: 1891
Post: #4
RE: I get "Array" when trying to get a value from database
Now I have problem at the last step :(
I have opened a connection with a other database and now if I require global.php I`ll get an error.
The password and username is the same os for the MyBB database just the database name is different (freecode_ropypass)
I try to use
mysql_close($freecode_ropypass);
but for unknown reason it didn`t works :(.
Can abybody help me ? I think I can post this there too because this is the right place to get support for my own modifications.
And I send 6MyBux for who will help me.
Thanks
ByteHunter

MyBBSource Team
runBB - Free myBB forum hosting

[Image: ByteHunter.png]
06-19-2009 07:21 AM
Nickman
Manager



Posts: 2,338
Joined: May 2008
Reputation: 46
MyBux: 31600
Post: #5
RE: I get "Array" when trying to get a value from database
I think you will have to keep changing mysql dbs, something like this:

PHP Code:
//Do stuff with this db
mysql_select_db('db2');
//now we want to use db1 again
mysql_select_db('db1');
//Do all stuff with db one

//And switch back to db2
mysql_select_db('db2'
06-19-2009 12:21 PM
ByteHunter
Community builder

Support

Posts: 1,284
Joined: Dec 2008
Reputation: 16
MyBux: 1891
Post: #6
RE: I get "Array" when trying to get a value from database
Thanks NickMan. I`ll try this I`ve sent 6 MyBux again

MyBBSource Team
runBB - Free myBB forum hosting

[Image: ByteHunter.png]
06-19-2009 05:26 PM
sushruth
Member


Posts: 55
Joined: May 2009
Reputation: 0
MyBux: 70
Post: #7
RE: I get "Array" when trying to get a value from database
Woah!.. all this php thing is making my eyes go round !!
06-19-2009 10:24 PM
ByteHunter
Community builder

Support

Posts: 1,284
Joined: Dec 2008
Reputation: 16
MyBux: 1891
Post: #8
RE: I get "Array" when trying to get a value from database
PHP is very nice but hard to learn language (I try to learn it) but MySql is much more easyer
i`ve made a plugin where users can insert a code and choose from 2 tipes of bonus if the code is valid.
(50 MyPs or 100 MyPlazaTurbo points) I had to run many querryes on databases.
The code is more than 100 lines , it is because it checks many things related to that code.
Thanks for everybody who helped me, thanks Nickman.
I`ll need to convert it to a MyBb plugin.

MyBBSource Team
runBB - Free myBB forum hosting

[Image: ByteHunter.png]
(This post was last modified: 06-20-2009 12:48 AM by ByteHunter.)
06-20-2009 12:48 AM
sushruth
Member


Posts: 55
Joined: May 2009
Reputation: 0
MyBux: 70
Post: #9
RE: I get "Array" when trying to get a value from database
(06-20-2009 12:48 AM)ByteHunter Wrote:  PHP is very nice but hard to learn language (I try to learn it) but MySql is much more easyer
i`ve made a plugin where users can insert a code and choose from 2 tipes of bonus if the code is valid.
(50 MyPs or 100 MyPlazaTurbo points) I had to run many querryes on databases.
The code is more than 100 lines , it is because it checks many things related to that code.
Thanks for everybody who helped me, thanks Nickman.
I`ll need to convert it to a MyBb plugin.

I hoe i have the free version of it. (i mean i have installed. not made it.. i can never make on lol)
(This post was last modified: 06-20-2009 12:55 AM by sushruth.)
06-20-2009 12:54 AM
ByteHunter
Community builder

Support

Posts: 1,284
Joined: Dec 2008
Reputation: 16
MyBux: 1891
Post: #10
RE: Help me and earn some MyBux!
Hi everybody. I`ve changed the title. I hope the thread is in the right section. If not please move it.
So I need help again
I want to include the /global.php file from a higher level directory
I have mybb installed on the root and I need to include that file from the "/panel" directory. I`ve googleed but found nothing that could help me.
Again 6 MyBux for who will help me.
Thanks
ByteHunter

MyBBSource Team
runBB - Free myBB forum hosting

[Image: ByteHunter.png]
06-21-2009 02:56 AM
 





Web Design | Web Design Jobs