TheHeretic Posted September 15, 2007 Share Posted September 15, 2007 Am trying to get an "if" statement working and figure I have it completely wrong, fairly new to php so these is probably not going to be too taxing Am trying to test for a variable not being true if not($error) { Getting the following error Parse error: syntax error, unexpected T_STRING, expecting '(' in C:\webpages\scaryminds\siteadmin\ad_editmgroup.php on line 51 The second question is more can I do something like this <?php if Isset($mem_id) { ?> html html html <?php } ?> Trying to get the html to parse if the variable has a value. TIA Quote Link to comment https://forums.phpfreaks.com/topic/69437-solved-couple-of-newbie-questions/ Share on other sites More sharing options...
MasterACE14 Posted September 15, 2007 Share Posted September 15, 2007 Im pretty sure you can do the second thing you asked, but you need to give more detail for your first question. such as some more coding, etc. Regards ACE Quote Link to comment https://forums.phpfreaks.com/topic/69437-solved-couple-of-newbie-questions/#findComment-348913 Share on other sites More sharing options...
watthehell Posted September 15, 2007 Share Posted September 15, 2007 <?php if (!empty($error)) { // this checks for is empty or not if (!$error) { //like this ?> <?php if (isset($mem_id)) { ?> html html html <? } ?> Quote Link to comment https://forums.phpfreaks.com/topic/69437-solved-couple-of-newbie-questions/#findComment-348914 Share on other sites More sharing options...
TheHeretic Posted September 15, 2007 Author Share Posted September 15, 2007 Im pretty sure you can do the second thing you asked, but you need to give more detail for your first question. such as some more coding, etc. Regards ACE Jeez that was quick. Here's some more code on the first question.' Using php 5 btw, not sure which release, installed via WAMP to an XP Pro SP2 box. $sql = "select * from sbyd_member_group where grp_id = $grp_id"; $result = mysql_query($sql ,$db); if ($myrow = mysql_fetch_array($result)) { $error = false; do { $name = $myrow["name"]; $description = $myrow["description"]; } while ($myrow = mysql_fetch_array($result)); } else { $error = true; $errormessage = "<li><b>Member Group not found in Database!</b><br>\n"; printf("<font face=arial size=-1>There was a problem editing the Group. Please click on back in your browser to fix the problems listed below.<br><br>"); printf($errormessage); } } If not($error) { <----- the browser doesn't seem to like this statement ?> Yes I know I should be using CSS but currently just getting it to work before tarting it up. CSS questions will come later Quote Link to comment https://forums.phpfreaks.com/topic/69437-solved-couple-of-newbie-questions/#findComment-348916 Share on other sites More sharing options...
TheHeretic Posted September 15, 2007 Author Share Posted September 15, 2007 <?php if (!empty($error)) { // this checks for is empty or not if (!$error) { //like this ?> <?php if (isset($mem_id)) { ?> html html html <? } ?> Sorry posting while you answered dude. Awesome, that fixed it Which is going to lead me to another question directly :-\ Quote Link to comment https://forums.phpfreaks.com/topic/69437-solved-couple-of-newbie-questions/#findComment-348920 Share on other sites More sharing options...
MasterACE14 Posted September 15, 2007 Share Posted September 15, 2007 try: <?php If (not($error)) // brackets on the outside of the not function ?> and your wise to leave CSS till later, best to learn bit by bit Quote Link to comment https://forums.phpfreaks.com/topic/69437-solved-couple-of-newbie-questions/#findComment-348921 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.