Hello all,
I am using php to query data from a mysql database and need to know how to code php to say 'if there are no results in this field (which is a text field), give this error message: 'no Tabs!'
The result that is being queried is a text field the following code echos the query fine but where there are no results, the error message does not display.
Here is my page:
<?php
require_once('Connections/artists.php');
require_once('Connections/Tabs.php');
$colname_filename = "-1";
if (isset($_GET['track'])) {
$colname_filename = (get_magic_quotes_gpc()) ? $_GET['track'] : addslashes($_GET['track']);
}
$colname_artists = "-1";
if (isset($_GET['track'])) {
$colname_artists = (get_magic_quotes_gpc()) ? $_GET['track'] : addslashes($_GET['track']);
}
$colname_Tab = "-1";
if (isset($_GET['track'])) {
$colname_Tab = (get_magic_quotes_gpc()) ? $_GET['track'] : addslashes($_GET['track']);
}
mysql_select_db($database_Tabs, $Tabs);
$query_Tab = sprintf("SELECT Tab FROM flamplayer_musics WHERE title_music LIKE '%%%s%%'", $colname_Tab);
$Tab = mysql_query($query_Tab, $Tabs) or die(mysql_error());
$row_Tab = mysql_fetch_assoc($Tab);
$totalRows_Tab = mysql_num_rows($Tab);
if (mysql_num_rows($Tab) > 0) {
echo $row_Tab['Tab'];
}
else
{
echo 'no tabs!';
}
?>