two column searching the same record in database
i want use 2 column typing words match database
in 1 column ,it works
but in tow column , first 1 disable
the first column c_staffname
the secord column c_stafftel
and have code here
$colname_data = "-1";
if (isset($_post['c_staffname'])) {
$colname_data = $_post['c_staffname'];
}
$colname_data = "-1";
if (isset($_post['c_stafftel'])) {
$colname_data = $_post['c_stafftel'];
}
mysql_select_db($database_lungfung_conn, $lungfung_conn);
$query_data = sprintf("select * db_client c_staffname %s", getsqlvaluestring("%" . $colname_data . "%", "text"));
$query_data = sprintf("select * db_client c_stafftel %s", getsqlvaluestring("%" . $colname_data . "%", "text"));
$data = mysql_query($query_data, $lungfung_conn) or die(mysql_error());
$row_data = mysql_fetch_assoc($data);
$totalrows_data = mysql_num_rows($data);
as result
by using c_stafftel , can find record
however , using c_staffname , cannot display record
try replacing code this:
$colname_data = "-1";
if (isset($_post['c_staffname'])) {
$colname_data = $_post['c_staffname'];
$query_data = sprintf("select * db_client c_stafftel %s", getsqlvaluestring("%" . $colname_data . "%", "text"));
} elseif (isset($_post['c_stafftel'])) {
$colname_data = $_post['c_stafftel'];
$query_data = sprintf("select * db_client c_staffname %s", getsqlvaluestring("%" . $colname_data . "%", "text"));
} else {
echo "no search term provided";
}
mysql_select_db($database_lungfung_conn, $lungfung_conn);
$data = mysql_query($query_data, $lungfung_conn) or die(mysql_error());
$row_data = mysql_fetch_assoc($data);
$totalrows_data = mysql_num_rows($data);
More discussions in Dreamweaver support forum
adobe
Comments
Post a Comment