![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Industry Role:
Join Date: Aug 2006
Location: Little Vienna
Posts: 32,235
|
What is wrong with this php line?
I getting error Undefined variable: cat in and i have no idea why.This is line which makes that problem:
PHP Code:
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Confirmed User
Industry Role:
Join Date: Jun 2003
Location: My High Horse
Posts: 6,334
|
yup you are using a reserved word as a variable cat is a reserved word in UNIX
__________________
Mike South It's No wonder I took up drugs and alcohol, it's the only way I could dumb myself down enough to cope with the morons in this biz. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Totally Borked
Industry Role:
Join Date: Feb 2005
Posts: 6,284
|
$cat doesn't look to be defined (ie has never been called/assigned before) and you are running php with E_ALL
Also, to give the parser an easier time, add braces around your vars when inside double quotes if you absolutely want to have them inside the double quotes ie echo "<td valign='top'><p align='center'><a href='girls/{$rec->dirname}/{$rec->dirname}.html'><img title='{$cat} {$rec->name} Gallery' src='Models/{$rec->dirname}/1.jpg' alt='{$cat} {$rec->name} Gallery' width='150' height='200' border='1' /><br>{$cat} {$rec->name}</a></p></td>"; for parser speed inside/outside quotes, have a look at http://riyono.com/archives/2004/09/3...p-application/
__________________
![]() For coding work - hit me up on andy // borkedcoder // com (consider figuring out the email as test #1) All models are wrong, but some are useful. George E.P. Box. p202 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
Confirmed User
Industry Role:
Join Date: Aug 2005
Location: Austin, TX
Posts: 4,258
|
Yea, your code is all red and hard to read.
__________________
![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 |
Industry Role:
Join Date: Aug 2006
Location: Little Vienna
Posts: 32,235
|
Ok here is clean copy pastE:
echo "<td valign='top'><p align='center'><a href='girls/$rec->dirname/$rec->dirname.html'><img title='$cat $rec->name Gallery' src='Models/$rec->dirname/1.jpg' alt='$cat $rec->name Gallery' width='150' height='200' border='1' /><br>$cat $rec->name</a></p></td>"; |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
Totally Borked
Industry Role:
Join Date: Feb 2005
Posts: 6,284
|
like I said, look in your php.ini for what your error settings are - they are probably E_ALL. Set them lower to remove the 'strict' coding messages showing.
__________________
![]() For coding work - hit me up on andy // borkedcoder // com (consider figuring out the email as test #1) All models are wrong, but some are useful. George E.P. Box. p202 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 |
Confirmed User
Industry Role:
Join Date: Aug 2006
Location: Poland
Posts: 9,229
|
echo "<td valign='top'><p align='center'><a href='girls/".$rec->dirname."/".$rec->dirname.".html'><img title='".$cat." ".$rec->name." Gallery' src='Models/".$rec->dirname."/1.jpg' alt='".$cat." ".$rec->name." Gallery' width='150' height='200' border='1' /><br>".$cat." ".$rec->name."</a></p></td>";
you can set "php_flag display_errors off" in htaccess to solve the warning
__________________
Mechanical Bunny Media Mechbunny Tube Script | Mechbunny Webcam Aggregator Script | Custom Web Development |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 |
ICQ: 197-556-237
Join Date: Jun 2003
Location: BRASIL !!!
Posts: 57,559
|
__________________
I'm just a newbie. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 |
Industry Role:
Join Date: Aug 2006
Location: Little Vienna
Posts: 32,235
|
php_flag display_errors off in htaccess works.I wonder is that only solution.
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 | |
Totally Borked
Industry Role:
Join Date: Feb 2005
Posts: 6,284
|
Quote:
So, befre tht echo statement, write: $cat = ''; and then your error will go away. strict or not-so-strict. The choice is yours
__________________
![]() For coding work - hit me up on andy // borkedcoder // com (consider figuring out the email as test #1) All models are wrong, but some are useful. George E.P. Box. p202 |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#11 |
Now choke yourself!
Industry Role:
Join Date: Apr 2006
Posts: 12,085
|
Actually, the other solution is to learn what you're doing before you try to do it.
__________________
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#12 |
Too lazy to set a custom title
Join Date: Dec 2006
Posts: 23,400
|
My brain is exploding.
__________________
i like waffles |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#13 | |
Confirmed User
Join Date: Dec 2007
Location: Chatsworth, CA
Posts: 1,964
|
Quote:
"Premature optimization is the root of all evil." Now, I'm not one to say you should never optimize. I used to expand assembly code to half a dozen instructions when I could do it with 1 because the MUL instruction used to be really slow on the early x86 platforms. But only inside some kind of loop where it would mean a noticable difference to the user. There's a time and place for optimization but don't make your code more unreadable needlessly. |
|
![]() |
![]() ![]() ![]() ![]() ![]() |