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.

Post New Thread Reply

Register GFY Rules Calendar Mark Forums Read
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 06-10-2008, 10:22 AM   #1
Klen
 
Klen's Avatar
 
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:
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>"
Any idea what is wrong ?
Klen is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-10-2008, 10:31 AM   #2
mikesouth
Confirmed User
 
mikesouth's Avatar
 
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.
mikesouth is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-10-2008, 10:39 AM   #3
borked
Totally Borked
 
borked's Avatar
 
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
borked is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-10-2008, 10:50 AM   #4
G-Rotica
Confirmed User
 
Industry Role:
Join Date: Aug 2005
Location: Austin, TX
Posts: 4,258
Yea, your code is all red and hard to read.
__________________
G-Rotica is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-10-2008, 11:06 AM   #5
Klen
 
Klen's Avatar
 
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>";
Klen is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-10-2008, 11:13 AM   #6
borked
Totally Borked
 
borked's Avatar
 
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
borked is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-10-2008, 11:31 AM   #7
k0nr4d
Confirmed User
 
k0nr4d's Avatar
 
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

Last edited by k0nr4d; 06-10-2008 at 11:33 AM..
k0nr4d is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-10-2008, 11:54 AM   #8
tranza
ICQ: 197-556-237
 
Join Date: Jun 2003
Location: BRASIL !!!
Posts: 57,559
Quote:
Originally Posted by G-Rotica View Post
Yea, your code is all red and hard to read.
I second that.
__________________
I'm just a newbie.
tranza is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-10-2008, 12:05 PM   #9
Klen
 
Klen's Avatar
 
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.
Klen is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-10-2008, 04:32 PM   #10
borked
Totally Borked
 
borked's Avatar
 
Industry Role:
Join Date: Feb 2005
Posts: 6,284
Quote:
Originally Posted by KlenTelaris View Post
php_flag display_errors off in htaccess works.I wonder is that only solution.
no, the other solution is to declare your variables before using them.
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
borked is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-10-2008, 04:38 PM   #11
GrouchyAdmin
Now choke yourself!
 
GrouchyAdmin's Avatar
 
Industry Role:
Join Date: Apr 2006
Posts: 12,085
Quote:
Originally Posted by KlenTelaris View Post
php_flag display_errors off in htaccess works.I wonder is that only solution.
Actually, the other solution is to learn what you're doing before you try to do it.
__________________
GrouchyAdmin is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-10-2008, 04:38 PM   #12
Iron Fist
Too lazy to set a custom title
 
Join Date: Dec 2006
Posts: 23,400
My brain is exploding.
__________________
i like waffles
Iron Fist is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-10-2008, 09:01 PM   #13
brandonstills
Confirmed User
 
brandonstills's Avatar
 
Join Date: Dec 2007
Location: Chatsworth, CA
Posts: 1,964
Quote:
Originally Posted by borked View Post
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/
Who cares about giving the parser an easier time? It exists to serve the programmer. I'm tired of all these people bitching about how PHP double quotes are slow. Using single quotes with the '.' operator maybe be faster but ask yourself this. By how much? Ok, even if it is 10 times faster how long do you think that translates to in actual time. Fractions of a nano second. It would have to be deep in an inner loop that is called 100,000+ times before the user would even notice a _slight_ difference. What's more important, having readable code, or shaving an additional 0.000000000001 seconds off the page loading time?

"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.
brandonstills is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks
Thread Tools



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.