digitalrain
-
Posts
5 -
Joined
-
Last visited
Never
Posts posted by digitalrain
-
-
Hi there...
I have a database that I've created that contains showtime information for a
particular TV show. The database contains the table 'show' which contains the
following fields:
id
Country
State
City
Cable
Station
Channel
Time
Zone (timezone)
Here's what I want to do:
Have a form that displays a drop-down list of countries. If a country OTHER than
the US is selected, the user just clicks 'search' and gets a formatted list of
showtimes in that country like this:
Here are our current listings for [Country name]:
[cable network] [time] [zone]
[cable network] [time] [zone]
[cable network] [time] [zone]
etc...
If, however, the US is selected, a second drop-down list of US states appears.
The user would select his/her state and then click 'search' and gets a formatted
list of showtimes in that state like this:
Here are our current listings for [State name]:
[city] [cable network] [station] [channel] [time] [zone]
[city] [cable network] [station] [channel] [time] [zone]
[city] [cable network] [station] [channel] [time] [zone]
etc...
Nothing I have tried is working. Any help would be MUCH appreciated.
Thanks,
Cynthia -
[!--quoteo(post=378735:date=May 31 2006, 11:10 AM:name=legohead6)--][div class=\'quotetop\']QUOTE(legohead6 @ May 31 2006, 11:10 AM) [snapback]378735[/snapback][/div][div class=\'quotemain\'][!--quotec--]
use this code
SELECT * FROM helpline WHERE MATCH(title, description) AGAINST ('$srch')
change title and discription to the 2 fileds you would like searched in your database! sldo take away the percent symbols in your varibale for $srch
[/quote]
Hi...
I tried it two ways, neither of which worked:
[code]
$srch="%".$search."%";
$query = "SELECT * FROM helpline WHERE MATCH(country, state) AGAINST ('$srch')";
[/code]
and
[code]
$srch=$search;
$query = "SELECT * FROM helpline WHERE MATCH(country, state) AGAINST ('$srch')";
[/code]
:(
-
Hi folks...newbie here.
I have a database created whose purpose is to list showtimes of a tv show for
the country or state that is entered into the search form.
My form is simple -- a text field where the user enters their country or state name
and then clicks submit.
The database is called mydb and the table is called helpline.
A php file called srch.php processes the whole thing. Here is my code for srch.php:
[code]
<?
if ($search) // perform search only if a string was entered.
{
#defines database access and connects to database
$user = "root";
#$pass = "";
$database = "mydb";
mysql_connect(localhost,$user,$pass);
@mysql_select_db($database) or die( "Unable to select database");
$srch="%".$search."%";
$query = "select * from helpline WHERE Country LIKE '$srch' || State LIKE '$srch'";
$result = mysql_db_query("mydb", $query);
if ($result)
{
echo "Here are the program times for your area:<br><br>";
echo "<table width=90% align=center border=1><tr>
<td align=center bgcolor=#00FFFF>Country</td>
<td align=center bgcolor=#00FFFF>State</td>
<td align=center bgcolor=#00FFFF>City</td>
<td align=center bgcolor=#00FFFF>Network</td>
<td align=center bgcolor=#00FFFF>Station</td>
<td align=center bgcolor=#00FFFF>Channel</td>
<td align=center bgcolor=#00FFFF>Time</td>
</tr>";
while ($r = mysql_fetch_array($result)) { // Begin while
$country = $r["Country"];
$state = $r["State"];
$city = $r["City"];
$network = $r["Network"];
$station = $r["Station"];
$channel = $r["Channel"];
$time = $r["Time"];
echo "<tr>
<td>$country</td>
<td>$state</td>
<td>$city</td>
<td>$network</td>
<td>$station</td>
<td>$channel</td>
<td>$time</td>
</tr>";
} // end while
echo "</table>";
} else { echo "problems...."; }
} else {
echo "Search string is empty. <br> Go back and type a string to search";
}
?>
[/code]
It generates the output page complete with the table with headings, but no results
appear in that table.
Help!
Thanks,
Cynthia
-
Hey folks...
Here's my situation:
I have a bunch of images sorted by month -- one image for each day of that
month. Each image has a corresponding 'teaser' or summary text (no, it's not
adult related in any way, shape or form).
I need to be able to display the current day's 'teaser' in a designated box on
my homepage along with a "[read more]" link. Both the teaser and the link
would link to a page that displays the current day's image.
On that page I need a link to the daily image archives, which the user can
search by date using 2 select boxes (one for month and one for day) which will,
upon clicking 'submit', display the corresponding image.
I was given this snippet of code to get started but am unsure of what to do with
it, what tables and fields are needed in the database, etc...:
[code]
$SQL = "SELECT teaser FROM devotions WHERE date =
'2002-".date('m')."-".date('d')."' LIMIT 1";
$result = mysql_query($SQL) or die(mysql_error());
$num_rows = mysql_num_rows($result);
if($num_rows == 0)
{
$SQL = "SELECT teaser FROM devotions WHERE date =
'2003-".date('m')."-".date('d')."' LIMIT 1";
$result = mysql_query($SQL) or die(mysql_error());
}
while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$innerText = $row["teaser"];
}
$innerText = '<a
href="'.tep_href_link('dailydevotions.php').'">'.$innerText.'...<BR>[Mor
e]</a>';
[/code]
Any help is appreciated.
Thanks,
ChickieGamer
tearing my hair out here...please help
in PHP Coding Help
Posted
working. It's just the search that doesn't work.
<sigh>
Thanks,
Cynthia