/    Sign up×
Community /Pin to ProfileBookmark

stuck Php Prints And sqls

I have no idea where i am going wrong here lol… it looks like it SHOULD work but so far nothing is working lol Please help

What i am trying to do is make 1 table Read Another Table so IF level = level Then Show maxexp on level table

My tables are set up so under Users Table there is level and exp
and on my level table there is level and maxexp

i want users to show the exp and level table to show maxexp heres my code.

[CODE]
$data = mysql_query(“SELECT * FROM users WHERE username = ‘$username'”)
or die(mysql_error());
$info = mysql_fetch_array( $data );

$data2 = mysql_query(“SELECT * FROM levels WHERE level = ‘info'”)
or die(mysql_error());
$info2 = mysql_fetch_array( $data2 );

if ($info[‘level’] = $info2[‘level’])
{
Print “”.$info[‘exp’] . ” “;
Print “/ “.$info2[‘maxexp’] . ” “;
}
else
{
Print “”.$info[‘exp’] . ” “;
Print “/ “.$info2[‘maxexp’] . ” “;
}
[/CODE]

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@cbVisionFeb 09.2012 — Can "Print" use a capital P?

I've always done "echo" or "print".

Not sure if that's your problem or not ... just something I noticed at a quick glance.
Copy linkTweet thisAlerts:
@shadowkillerauthorFeb 09.2012 — Can "Print" use a capital P?

I've always done "echo" or "print".

Not sure if that's your problem or not ... just something I noticed at a quick glance.[/QUOTE]


Yeah it works for the first one

Print "".$info['exp'] . " ";

Print "/ ".$info2['maxexp'] . " ";

}

Lke .$info works it posts it all the information but .$info2 dosent post information and im not to sure why lol
Copy linkTweet thisAlerts:
@NogDogFeb 10.2012 — First thing I see is the use of the assignment operator "=" where I'm sure you wanted the comparison operator "==":
[code=php]
if ($info['level'] = $info2['level'])
//...should be...
if ($info['level'] == $info2['level'])
[/code]
Copy linkTweet thisAlerts:
@ssystemsFeb 10.2012 — Let's just merge this thread here. https://webdeveloper.com/forum/showthread.php?t=256575 This is more of a PHP question rather than SQL anyways
×

Success!

Help @shadowkiller spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...