Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/69437-solved-couple-of-newbie-questions/
Share on other sites

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  ;)

<?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  :D Which is going to lead me to another question directly  :-\

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.