Page 1 of 1

Writing my own command/function

Posted: Tue Jun 17, 2003 10:13 am
by polosport6699
I would like to write a function to chage the value of one cell in a table, which is a value of true or false. It starts out false from a hidden form field. Then I want an administrator to be able to login and update the value to true making the entry visible on the main website.

Code: Select all

###############################
# Writing Listing to frontend #
###############################

if($cmd == "Write"){
	$query = "UPDATE validate FROM listing";
	$result = mysql_db_query($database, $query, $connection) or die ("Error in query: $query. " . mysql_error());
	echo $validate;
	}
	
    ### If form has not been submitted ###
        if (!$submit)
        {
#####################
# Job Listing Admin #
#####################

if($cmd == "Admin"){

    ### Get list of departments with open jobs ###
        $query = "SELECT DISTINCT id, 
                                    department 
                                        from department, 
                                                listing 
                                                    WHERE department.id = listing.fk_department";
        $result = mysql_db_query($database, $query, $connection) or die ("Error in query: $query. " . mysql_error());

    ### Generate a table ###
        echo "<table border=1 bgcolor=FFFFCC bordercolor=000000 bgcolor=000000 cellspacing=2 cellpadding=2>";

Posted: Tue Jun 17, 2003 11:13 am
by patrikG
and where is your problem?