help with php


Posted on 16th Feb 2014 07:03 pm by admin

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++)

No comments posted yet

Your Answer:

Login to answer
237 Like 54 Dislike
Previous forums Next forums
Other forums

'grab_files', multiple extension?
hey guys,

can anyone suggest a way to make to following line of code look for files with more

php ajax - two drop down list with a submit button
i have created a form with 2 drop-down list and a submit button. I would like to know how to pass th

Got A Free Server :(
So I was given a free server

http://shopping.yahoo.com/p:Compaq%20ProLiant%201500%20Server:1

why preg_match_all does not return the number of matches
My regex looks like

X[^x{4e00}-x{9fa5}]*Y

(where X and Y are two Chinese characters)

why is it over writing
Code: $filepaths[] = $_FILES['new_image'];
foreach ($filepaths as $filepath)
{
$imagename =

frames get header location..
i have two frames, one top, one bottom. how do i do a form on the bottom frame that gives me the ur

Cant display mysql data
Hey all,

I am learning php and my first goal is to create a simple CMS. At the moment I am st

Simple Scraper... Weird Output
Okay, maybe I just need a Blue Monster and some sleep, but....

I'm scraping a ringtone site

help with image text
Hi ...

see i need the text of the name and number to start in the center and always be in the

distinct rows
Hi
version 10.2.0.3

I have a query output something like the following

ID

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash