PHP Web Host - Quality Web Hosting For All PHP Applications Sign up for PayPal and start accepting credit card payments instantly
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
california2
New Member
New Member


Joined: Aug 20, 2008
Posts: 4

PostPosted: Wed Aug 20, 2008 8:01 pm Reply with quote Back to top

I am trying to make a membership block that will indicate which of the three memberships a user has. I combined code from different places but am having trouble getting it to all work together. I think that I am close and would appreciate some advice or assistance as I am very new to making blocks.

The three memberships I have are "premium", "preview" and "basic".

The premium is when a member is subscribed to Nuke Royal and I am using the code from Nuke Royal.

The preview is when the member has a "1" in "nuke_users" "basic_membership" table.

The basic is when the "nuke_users" "basic_membership" is null in that table.

Here is the code I have so far:

if ($ispremium=$db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_premium_members_zone WHERE user_id='".$cookie[0]."'")) > 0)

{
$membership="Premium";
}

if ($db->sql_query("SELECT basic_membership FROM ".$prefix."_users WHERE user_id='".$cookie[0]."'") == 1)

{
$membership="Preview";
}

else

{
$membership="Basic";
}

$content .=$membership;
View user's profile Send private message
evaders99
Moderator


Joined: Apr 30, 2004
Posts: 2844

PostPosted: Wed Aug 20, 2008 9:30 pm Reply with quote Back to top

To actually get data from your query, you'll need to do $db->sql_query and then follow it with a $db->sql_fetchrow
View user's profile Send private message Visit poster's website
california2
New Member
New Member


Joined: Aug 20, 2008
Posts: 4

PostPosted: Thu Aug 21, 2008 12:01 am Reply with quote Back to top

The only example I could find is this and it does not work either:

if ($db->sql_fetchrow($db->sql_query("SELECT basic_membership FROM ".$prefix."_users WHERE user_id='".$cookie[0]."'")) == 1)
View user's profile Send private message
california2
New Member
New Member


Joined: Aug 20, 2008
Posts: 4

PostPosted: Thu Aug 21, 2008 12:07 am Reply with quote Back to top

This is not working either. The member logged in should show preview as they have a "1" in the Basic_membership table but is showing as "basic"

if ($db->sql_query($db->sql_fetchrow("SELECT basic_membership FROM ".$prefix."_users WHERE user_id='".$cookie[0]."'")) == 1)

Everything shows as basic, even a premium subscriber. I tried using an elseif statement and that caused an error.

I know nothing about writing these queries but I can not find anyone to write a simple block even if I pay them (I have posted several times on sites with no response).
View user's profile Send private message
Gremmie
Former Moderator in Good Standing


Joined: Apr 06, 2006
Posts: 2401
Location: Iowa, USA

PostPosted: Thu Aug 21, 2008 8:20 am Reply with quote Back to top

$result = $db->sql_query("...");
$row = $db->sql_fetchrow($result);
Your answer is now in $row['basic_membership']; assuming that is a column in your table.
View user's profile Send private message
california1
New Member
New Member


Joined: May 29, 2008
Posts: 5

PostPosted: Thu Aug 21, 2008 11:05 am Reply with quote Back to top

Thanks for the help. I still don't get how to put this all together. I tried several different variations with your information and can not get the block to work.
View user's profile Send private message
Gremmie
Former Moderator in Good Standing


Joined: Apr 06, 2006
Posts: 2401
Location: Iowa, USA

PostPosted: Thu Aug 21, 2008 11:54 am Reply with quote Back to top

Post your code.

You may also want to google the PHP-Nuke How-To for some coding hints.
View user's profile Send private message
california1
New Member
New Member


Joined: May 29, 2008
Posts: 5

PostPosted: Thu Aug 21, 2008 1:31 pm Reply with quote Back to top

Where do you think I got these examples I am trying? Answer: PHP-Nuke How-To
View user's profile Send private message
Gremmie
Former Moderator in Good Standing


Joined: Apr 06, 2006
Posts: 2401
Location: Iowa, USA

PostPosted: Thu Aug 21, 2008 3:25 pm Reply with quote Back to top

What can I say? No offense but it sounds like you need to learn some more about PHP and possibly MySQL before tackling something like this. Get yourself a good book or explore some tutorials on the web.

If you post what you got we might be able to give you some hints.
View user's profile Send private message
california2
New Member
New Member


Joined: Aug 20, 2008
Posts: 4

PostPosted: Thu Aug 21, 2008 10:52 pm Reply with quote Back to top

Gee, thanks for the help. It's not like I haven't tried to read some reference material and put together something before asking for help. Guess I came to the wrong place for assistance. My bad! Smack
View user's profile Send private message
montego
Site Admin


Joined: Aug 29, 2004
Posts: 7452
Location: Arizona

PostPosted: Fri Aug 22, 2008 6:11 am Reply with quote Back to top

california2, you were asked several times to post your code, which means that you were going to get help on your specific issue. Help is a two way street...
View user's profile Send private message Visit poster's website
Gremmie
Former Moderator in Good Standing


Joined: Apr 06, 2006
Posts: 2401
Location: Iowa, USA

PostPosted: Fri Aug 22, 2008 7:25 am Reply with quote Back to top

If I sounded harsh, it was because the code you actually did post was way off base. For example:

Code:

if ($db->sql_query("SELECT basic_membership FROM ".$prefix."_users WHERE user_id='".$cookie[0]."'") == 1)


The member function sql_query() returns a resource, not an integer. You can't compare it to 1. Also, you better hope $cookie[0] is addslashed or you just opened a security hole.

So, again, if you post your code, we can probably peer review it for you and help you along. You can't just whine that it isn't working. Well, you can, if you don't want any help.
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
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
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2008 by Raven
Proud to be listed at Lobo Links Web Directory

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::

:: fisubice Theme Recoded To 100% W3C CSS & HTML 4.01 Transitional Compliance by Raven and 64bitguy ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum