# Connect to your MySQL database server
mysql_connect ('localhost', 'bshort3', 'kiyTwbwc')
or die ('');
# Select a default database to work with
mysql_select_db ('ablate_org')
or die ('The database specified in database_name must exist and must be accessible by the user specified in mysql_connect');
$query = "SELECT * FROM CDSwapSwaps" ;
#echo $query;
$query_result_handle = mysql_query ($query) ;
# make sure that we recieved some data from our query
$num_of_rows = mysql_num_rows ($query_result_handle);
#print "The query: '$query' returned $num_of_rows rows of data.";
# use mysql_fetch_row to retrieve the results
if ($num_of_rows >= 1){
echo "these are some things you could say:
";
for ($count = 1; $row = mysql_fetch_row ($query_result_handle) ; ++$count)
{
print "" . $row[1] . " ";
#Fetching row #$count from the query.";
}
}else {
?>you might want to try something else. that entry hasn't been added yet. if you want, you could add it.
}
?> |
}elseif ($textstuff == ''){
# Connect to your MySQL database server
mysql_connect ('localhost', 'bshort3', 'kiyTwbwc')
or die ('');
# Select a default database to work with
mysql_select_db ('ablate_org')
or die ('The database specified in database_name must exist and must be accessible by the user specified in mysql_connect');
# make a query on a table in your database
$escaped_string = ereg_replace("'","''",$textstuff);
$query = "SELECT * FROM CDSwapSwaps";
#$query = "SELECT * FROM assoc where UPPER(trigger) = UPPER('" . $escaped_string . "')";
#echo $query;
$query_result_handle = mysql_query ($query) ;
# make sure that we recieved some data from our query
$num_of_rows = mysql_num_rows ($query_result_handle);
#print "The query: '$query' returned $num_of_rows rows of data.";
# use mysql_fetch_row to retrieve the results
if ($num_of_rows >= 1){
for ($count = 1; $row = mysql_fetch_row ($query_result_handle) ; ++$count)
{
print "";
#Fetching row #$count from the query.";
print " ".str_replace ( "''", "'",$row[3])." ";
}
}else {
?>you might want to try something else. that entry hasn't been added yet.
if you want, you could ">add it.
or
you can see what you can say
}
} else {
echo "try me";
}
?>
|