missed one record from mysql_fetch array...???
Moderator: General Moderators
-
mahara
- Forum Commoner
- Posts: 37
- Joined: Wed Nov 13, 2002 1:08 am
- Location: Bandung, Jawa Barat, Indonesia
Please try this.
I think you miss the equivalent of expression in the 'if ... else ...'. You should only use '==' or '===' instead of '=' when comparing expression. '=' is used to assign a value to a variable.
According to your previous code, only the first if block is executed.
Hope helps.
I think you miss the equivalent of expression in the 'if ... else ...'. You should only use '==' or '===' instead of '=' when comparing expression. '=' is used to assign a value to a variable.
Code: Select all
if ( $_POST["type"] == "ALL" )
{
$SQL = "Select * from komponen";
echo $SQL . "<br/>\n";
echo "Blok 'ALL' dieksekusi.<br/>\n";
$result=query($SQL, $link, __LINE__, __FILE__);
//$senarai=mysql_fetch_array($result, MYSQL_ASSOC);
}
elseif ( $_POST["type"] == "KATEGORI" )
{
$SQL = "Select * from komponen where kategori = '$kategori'";
echo $SQL . "<br/>\n";
echo "Blok 'KATEGORI' dieksekusi.<br/>\n";
$result=query($SQL, $link, __LINE__, __FILE__);
//$senarai=mysql_fetch_array($result, MYSQL_ASSOC);
}
elseif ($_POST["type"] == "KOMPONEN")
{
$SQL = "SELECT * FROM komponen where alat = '$alat'";
echo $SQL . "<br/>\n";
echo "Blok 'KOMPONEN' dieksekusi.<br/>\n";
$result=query($SQL, $link, __LINE__, __FILE__);
//$senarai=mysql_fetch_array($result, MYSQL_ASSOC);
}Hope helps.
hmmm...
this is good...
it really shows me something...
whatever i choose...it always execut only this:
why???
the $_POST["type"] is correct....
this is good...
it really shows me something...
whatever i choose...it always execut only this:
Code: Select all
if ( $_POST["type"] == "ALL" )
{
$SQL = "Select * from komponen";
echo $SQL . "<br/>\n";
echo "Blok 'ALL' dieksekusi.<br/>\n";
$result=query($SQL, $link, __LINE__, __FILE__);
//$senarai=mysql_fetch_array($result, MYSQL_ASSOC);
}the $_POST["type"] is correct....
-
mahara
- Forum Commoner
- Posts: 37
- Joined: Wed Nov 13, 2002 1:08 am
- Location: Bandung, Jawa Barat, Indonesia
Well, now it's getting closer...
The only thing I want to know is "does the variable $_POST["type"] always returns value 'ALL'? Can it return other value except 'ALL'?".
Note that you should be aware to case-sensitivity in comparing expression of string.
The only thing I want to know is "does the variable $_POST["type"] always returns value 'ALL'? Can it return other value except 'ALL'?".
Note that you should be aware to case-sensitivity in comparing expression of string.
Code: Select all
<?php
if ( strtoupper($_POST["type"]) == "ALL" )
{
$SQL = "Select * from komponen";
echo $SQL . "<br/>\n";
echo "Blok 'ALL' dieksekusi.<br/>\n";
$result=query($SQL, $link, __LINE__, __FILE__);
//$senarai=mysql_fetch_array($result, MYSQL_ASSOC);
}
?>