It's not displaying or pulling anything out of the database.
Code: <html>
<head>
<title>Hale's Music World: Inventory Search Results</title>
</head>
<body>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="56%" id="table1" height="129">
<tr>
<td bgcolor="#008000" colspan"3"> </td>
</tr>
<tr>
<td colspan="3">
<p align="center"><font size="5" color="#0000FF"><b>Inventory Search Results</font></td></tr>
<tr>
<td bgcolor="#008000" colspan="3"> </td>
</tr>
<tr>
<td width="33" align="center">
<font size="4" color="#008000">
<u>Artist</u></font></td>
<td width="33%" align="center">
<font size="4" color="#008000">
<u>Title</u></font></td>
<td width="33%" align="center">
<font size="4" color="#008000">
<u>Genre</u></font></td>
</tr>
<?php
$link = mysql_connect('localhost','halesuser','hales123db');
mysql_select_db("halesmusicworld", $link);
if ( isset( $_POST['Artist_Search'] ) AND $_POST['Artist_Search'] == 1 ) {
echo '1';
$artist_search = mysql_real_escape_string( $_POST["Artist_Search"] ) . '1' ;
$query = "select * from inventory where artist like '%" . $artist_search . "%'";
$result = mysql_query( "SELECT * FROM inventory", $link );
$num_rows = mysql_num_rows( $result );
echo 'Number of matching records=' . $num_rows . '<hr>';
}
if ( isset( $_POST['Title_Search'] ) AND $_POST['Title_Search'] == 2 ) {
echo '2';
$title_search = mysql_real_espace_string( $_POST["Title_Search"] ) . '2' ;
$query = "select * from inventory where title like '%" . $title_search . "%'";
$result = mysql_query( "SELECT * FROM inventory", $link );
$num_rows = mysql_num_rows( $result );
echo 'Number of matching records='. $num_rows . '<hr>';
}
if ( isset( $_POST['Genre_Search'] ) AND $_POST['Genre_Search'] == 3 ) {
echo '3';
$genre_search=$_POST ['Genre'] ;
$query= "select * from inventory where genre like '%".$genre_search."%'";
$query_results=mysql_query($query);
$match_results=mysql_num_rows($query_results);
echo 'Number of matching records='.$match_results. '<hr>';
}
echo '</tr>';
for ($i=0; $i < $match_results; $i++)
{
echo '<tr>';
$row=mysql_fetch_array($query_results);
echo '<td align="center">', ($row ['artist'] ), '</td>';
echo '<td align="center">', ($row ['title'] ), '</td>';
echo '<td align="center">', ($row ['genre'] ), '</td> </tr>';
}
?>
<tr>
<td bgcolor="#008000" colspan="3"> </td>
</tr>
</table>
<p align="center"><i>
<a href="HalesMusicWorld_Home.html">
<font face="Arial" size="5">
Return to </font></a><font face="Arial" size="5"> <a href="HalesMusicWorld_Home.html">HalesMusicWorld Home</font></i></p>
</body>
</html>
It gives me the following error message:
[/size][/font]Notice: Undefined variable: match_results in C:wampwwwinventory_search.php on line 61
I believe it has something to do with this line of code :
for ($i=0; $i < $match_results; $i++)
Unable to retreve the values from Mysql Query
Hi, Here is the php code that I have, Query is running properly in phpmyadmin and is resulting 5 which is correct but when i try to get tht in php its not printing the value $sql_query=
Delete Client 066 Earlywatch
Hi all,
PHP hyperlinks generator - HELP plz
HiI need some help to get this done using php:1 - I have few hyperlinks say 500 in format like:<a href="http://domaina.com/1.html"
how can we add data from dynamic fields to mysql db in php
i have a script which i found on the internet. i modify that script according to my needs. what is in that script is there are three form fields with two buttons. one button is "Give me more
Sales orders ans reservations not taken into account on MPS / MRP
Hello,
Getting PHP to ammended the selected in option field
Hey Guysthanks for everyones help so far. This site and its users are oozing awesomness.I am busy with a php script for editing users, of which 1 field is the TITLE of the person (mrs, miss, ms) and
URL Rewrite issue
Im created a series of Rewrites and on page checks to make sure the correct url is being called. But now that i am buying in traffic through Adwords the gclid parameter is being dropped and im unable
how to use two buttons with php
hi i have one form. there are three fields which are to be filled by the user. and then there are two buttons. ob clicking first button i want to save user's provided data to the database display the
My query is being run with no results.
I have this.Code: function DropUser($duser_id, $user_email, $user_username) { if(isset($_SESSION['admin_username']) && isset($_SESSION['admin_id']) &&
foreach and array need help combining
Hi guys.Here's the codeCode: array( 'tag' => 'code', 'type' => 'unparsed_content', 'content' => '<div