Dethman Posted January 10, 2008 Share Posted January 10, 2008 I keep getting this error is this if else doohicky right? Warning: Division by zero in /home2/gt/public_html/base.php on line 261 Warning: Division by zero in /home2/gt/public_html/base.php on line 261 if($user['access']==1){ echo "<a href="/admin/">AdminPanel</a>"; }else{ echo "You do not have Admin Access"; }?> Any help would be awsome! ~Dethman~ Link to comment https://forums.phpfreaks.com/topic/85331-is-this-right/ Share on other sites More sharing options...
rajivgonsalves Posted January 10, 2008 Share Posted January 10, 2008 this echo "<a href="/admin/">AdminPanel</a>"; should be echo "<a href=\"/admin/\">AdminPanel</a>"; Link to comment https://forums.phpfreaks.com/topic/85331-is-this-right/#findComment-435421 Share on other sites More sharing options...
vbnullchar Posted January 10, 2008 Share Posted January 10, 2008 or echo "<a href=\"admin\">AdminPanel</a>"; or echo "<a href='admin'>AdminPanel</a>"; Link to comment https://forums.phpfreaks.com/topic/85331-is-this-right/#findComment-435428 Share on other sites More sharing options...
trq Posted January 10, 2008 Share Posted January 10, 2008 The code you posted is not generating the error you describe. Can wee see the code on line 261? A few lines previous and after may also be helpfull. Link to comment https://forums.phpfreaks.com/topic/85331-is-this-right/#findComment-435506 Share on other sites More sharing options...
nikefido Posted January 10, 2008 Share Posted January 10, 2008 The code you posted is not generating the error you describe. Can wee see the code on line 261? A few lines previous and after may also be helpfull. actually it could be, he is using the wrong slashes to escape quotes ( / vs \ ). no? Link to comment https://forums.phpfreaks.com/topic/85331-is-this-right/#findComment-435552 Share on other sites More sharing options...
rajivgonsalves Posted January 11, 2008 Share Posted January 11, 2008 actually the division by zero is right consider the following code echo "<a href="/admin/">AdminPanel</a>"; "<a href=" is tried to be divided by "admin" since is not defined it will be zero (null), with the type juggling its hard to catch these errors in php... Link to comment https://forums.phpfreaks.com/topic/85331-is-this-right/#findComment-436241 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.