![]() |
PHP Help Needed :)
Building a paid module for a custom tube script, but i'm getting this error
Notice: Undefined variable: paid in /home/nakedmov/public_html/xxx/video.php on line 179 Notice: Undefined variable: paid in /home/nakedmov/public_html/xxx/video.php on line 213 Line 179 to 187 PHP Code:
PHP Code:
Thanks :) |
dont think you use == for a boolean
try: if($paid = false) |
Quote:
Thanks a lot :thumbsup |
Quote:
The PHP notices are displayed because $paid has no value set before the conditional. |
PHP Code:
|
PHP Code:
|
Quote:
|
Quote:
|
Quote:
Run these two scripts : <?php $paid = false; if($paid = false) { echo "This really works!"; } else { echo "No No No No!"; } ?> ------------- <?php $paid = false; if($paid == false) { echo "This really works!"; } else { echo "No No No No!"; } ?> |
Quote:
.... |
Quote:
The warning goes away because it's perfectly legal code, but it's also perfectly useless - it will always be true. To confirm, try this: $paid = 1; if ($paid = false) { echo "oops, wrong answer"; } |
Quote:
<?php //$paid is not defined yet if($paid = false) { echo "paid is false"; } //$paid was set to false above if($paid == false) { echo "That's really FUCKED UP!!!!!!!!!!!!!!!!!!!!!!!!!!!"; } ?> |
Quote:
PHP Code:
|
haha holy shit. i apologize, i was wrong. rookie mistake. doing 3 other things. but...
Quote:
|
Quote:
I use tables because I know what the fuck I'm doing. :1orglaugh |
Your original code should work fine. The problem seems to be getting the boolean value assigned to the variable in the first place. Your error message states "Undefined variable", meaning it probably has no value. Have you echo'd out the value of $paid before the if statement to see if it has any value or is NULL?
|
Quote:
|
Quote:
|
Quote:
-- The real solution: PHP Code:
PHP Code:
|
Oh good lord.... lol.. The "proper" way.
Code:
if( !isset($page) || $page !== true ){ Code:
if( !isset($page) || $page != 1 ){ |
Oh shit this is hilarious. Don't take code advice from GFY anymore!
|
that was intense...
|
Code:
if(empty($paid)){ Code:
$smarty->assign('paid', !empty($paid)?$paid:false); |
thats a lot of wrong adivce, next time ask you quetsion at www.stackoverflow.com
|
Quote:
|
Quote:
|
Quote:
Hey it's about like us circa 1997. |
Damn guys i wont buy any shit you made...
Where's konrad :( |
First time I have seen code tags used here
|
I'm just here for the cocks
|
noooooo my bane is back from the dead! :1orglaugh
haha......wow. don't drink and code :2 cents: |
All times are GMT -7. The time now is 09:36 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123