Writing my own command/function

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
polosport6699
Forum Commoner
Posts: 35
Joined: Wed Jun 11, 2003 3:19 pm

Writing my own command/function

Post 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>";
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

and where is your problem?
Post Reply