Jump to content

[SOLVED] Couple of newbie questions....


TheHeretic

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  :-\

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.