Re: If statement for sql statement

From: Date: Tue, 09 Apr 2002 18:01:54 +0000
Subject: Re: If statement for sql statement
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-18366@lists.php.net to get a copy of this message
On Wednesday 10 April 2002 12:32, jas wrote: > Ok here is my question... I have a form that reads the contents of a > directory, places the resulting files into a select box within a form for > further processing, code is as follows: [snip] > What I need to know is if there is a way to create an if statement that > would either update or not update a selected field in the database. Below > is a piece I would assume would work however I am not sure of the mysql > command to not update anything. Any help would be great. > Jas > > if( $file_name = '----------' ) $sql = "dont update table"; > else $sql = "UPDATE $table_name SET image01_t = \"$files\""; Am I missing something? Psuedo-code: if ($file_name != '----------') { $sql = "UPDATE ...."; $result = $mysql_query($sql); etc; etc; } else { don't even need an else! } -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* The sun never sets on those who ride into it. -- RKO */

« previous php.db (#18366) next »