Questa è la mia pagina di ricerca immagine:
Quando premo submit dalla pagina della form (che è questa):
Mi esce questa serie di errori:
Il problema è... Che non capisco assolutamente cosa sto sbagliando!
Qualcuno è in grado di aiutarmi? Grazie infinite in anticipo, anche per la pazienza!!
PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<?php session_start();
?>
<HTML>
<HEAD>
<TITLE>Results</TITLE><link href="style.css" rel="stylesheet" type="text/css">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
</HEAD>
<BODY>
<div align="center">
<TABLE class="maintable" CELLPADDING="0" CELLSPACING="0" summary="">
<TR>
<TD COLSPAN=3> <IMG SRC="images/index_01.gif" WIDTH=727 HEIGHT=240 ALT=""></TD>
</TR>
<TR> </div>
<TD ROWSPAN=2 class="navbg" valign="top"><div id="nav">
<p><span class="h2">Menu</span> <a href="index.php">Home</a> <a href="rules.php">Rules</a>
<a href="gallery.php">Gallery</a> <a href="upload.php">Upload</a> <a href="search.php">Search</a>
</p>
<?php
if ((isset($_SESSION['login']))&&((isset($_SESSION['password'])))){
echo <<<print
<p><span class="h2">Logout</span> <a href="profile.php">Your Profile</a> <a href="logout.php">Logout</a><span class="endbox"></span> </p>
<p><span class="h2">Friendship</span> <a href="users.php">Search user</a> <a href="friend.php">My friends</a> <a href="request.php">Friends request</a> <span class="endbox"></span> </p>
print;
}
else {
echo <<<print
<p><span class="h2">Sign in</span> <a href="create.html">Create account</a> <a href="login.htm">Login</a><span class="endbox"></span></p>
print;
}
?>
<?php
include("connessione.inc");
if (isset($_SESSION['login'])) {
$login = $_SESSION['login'];
$sqlA="SELECT Nickname FROM utenti WHERE Nickname = '$login' AND Admin = '1'";
$resA=mysql_query($sqlA,$conn)or die("Error!".mysql_error());
$lines=mysql_num_rows($resA);
if ($lines == 1){
echo <<<print
<p><span class="h2">Admin</span> <a href="admin.php">Administration</a><span class="endbox"></span></p>
print;
}
}
echo <<<print
</p>
</div></TD>
<TD ROWSPAN=2 class="contentbg" valign="top"><div id="content">
print;
?>
<h1>Results</h1>
<?php
include("connessione.inc");
if (isset($_GET['search'])){
$search=$_GET['search'];
}
if (isset ($_POST['title'])!= '') {
$nickname = addslashes(htmlentities($_POST['title']));
$search = $search."and Title LIKE '%".$title."%' ";
}
if (isset ($_POST['author'])!= '') {
$name = addslashes(htmlentities($_POST['author']));
$search = $search."and Author LIKE '%".$author."%' ";
}
if (isset ($_POST['tag1'])!= '') {
$surname = addslashes(htmlentities($_POST['tag1']));
$search = $search."and Tag1 LIKE '%".$tag1."%' ";
}
if (isset ($_POST['tag2'])!= '') {
$place = addslashes(htmlentities($_POST['tag2']));
$search = $search."and Tag2 LIKE '%".$tag2."%' ";
}
if (isset ($_POST['tag3'])!= '') {
$interest1 = addslashes(htmlentities($_POST['tag3']));
$search = $search."and Tag3 LIKE '%".$tag3."%' ";
}
if (isset ($_POST['category'])!= '') {
$interest2 = ($_POST['category']);
$search = $search."and Category LIKE '%".$category."%' ";
}
if (isset ($_POST['date'])!= '') {
$interest2 = ($_POST['date']);
$search = $search."and Date LIKE '%".$date."%' ";
}
$sql="SELECT * FROM (immagini) $search";
$res=mysql_query($sql,$conn)or die("Error!".mysql_error());
$lines=mysql_num_rows($res);
if ($lines == 0){
echo "There isn't image with this parameters!";
}
else {
$recordperpagina=3;//numero di record per pagina
$numeropagine=ceil($lines / $recordperpagina);
if (isset ($_GET['page'])){
$paginacorrente = $_GET['page'];
}
else {
$paginacorrente = 1;
}
$primolimit = ($paginacorrente - 1)* $recordperpagina;
$sql="SELECT * FROM (immagini) $search ORDER BY immagini.Title LIMIT $primolimit, $recordperpagina";
$res=mysql_query($sql,$conn)or die("Error!".mysql_error());
while ($records=mysql_fetch_assoc($res)) {
$author=$records['Author'];
$title=$records['Title'];
$tag1=$records['Tag1'];
$tag2=$records['Tag2'];
$tag3=$records['Tag3'];
$category=$records['Category'];
$date=$records['Date'];
$path=$records['Path'];
if ($lines == 1){
echo <<<MESS
<table summary="lista" id="lista" border="1" cellpadding="4"><tr><td>
<img src="$records[Path]">
</td></tr></table></br>
MESS;
}
}
if ($paginacorrente == 1){
$precedente = "";
}
else {
$previous_page = ($paginacorrente - 1);
$precedente = "<a href=\"?page=$previous_page&search=$search\" title=\"Go to the previous page\" id=\"previus\"><<-- previous</a>";
}
if($paginacorrente == $numeropagine){
$successiva = "";
}
else {
$next_page = ($paginacorrente + 1);
$successiva = "<a href=\"?page=$next_page&search=$search\" title=\"Go to the next page\" id=\"next\">next -->></a>";
}
echo "$precedente <p id=\"paginacorrente\">Page $paginacorrente of $numeropagine </p> $successiva";
}
?>
</br>
</br>
</br>
</br>
<h1>©SketchMania</h1>
<TD valign="top" class="spacer"></TD>
</TR><TR>
<TD height="2" class="spacer2"></TD>
</TR><TR>
<TD COLSPAN=3 class="creditsbg">
<p>| Contact us <a href="http://yahoo.com/" target="_blank">[email protected]</a> | </p>
</TD>
</TR>
</TABLE>
</div>
</BODY>
</HTML>
PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<?php session_start();
?>
<HTML>
<HEAD>
<TITLE>Search</TITLE><link href="style.css" rel="stylesheet" type="text/css">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
</HEAD>
<BODY>
<div align="center">
<TABLE class="maintable" CELLPADDING="0" CELLSPACING="0">
<TR>
<TD COLSPAN=3> <IMG SRC="images/index_01.gif" WIDTH=727 HEIGHT=240 ALT=""></TD>
</TR>
<TR>
<TD ROWSPAN=2 class="navbg" valign="top"><div id="nav">
<p><span class="h2">Menu</span> <a href="index.php">Home</a> <a href="rules.php">Rules</a>
<a href="gallery.php">Gallery</a> <a href="upload.php">Upload</a> <a href="search.php">Search</a>
<span class="endbox"></span> </p>
<?php
if ((isset($_SESSION['login']))&&((isset($_SESSION['password'])))){
echo <<<print
<p><span class="h2">Logout</span> <a href="profile.php">Your Profile</a> <a href="logout.php">Logout</a><span class="endbox"></span> </p>
<p><span class="h2">Friendship</span> <a href="users.php">Search user</a> <a href="friend.php">My friends</a> <a href="request.php">Friends request</a> <span class="endbox"></span> </p>
print;
}
else {
echo <<<print
<p><span class="h2">Sign in</span> <a href="create.html">Create account</a> <a href="login.htm">Login</a><span class="endbox"></span></p>
print;
}
?>
<?php
include("connessione.inc");
if (isset($_SESSION['login'])) {
$login = $_SESSION['login'];
$sqlA="SELECT Nickname FROM utenti WHERE Nickname = '$login' AND Admin = '1'";
$resA=mysql_query($sqlA,$conn)or die("Error!".mysql_error());
$lines=mysql_num_rows($resA);
if ($lines == 1){
echo <<<print
<p><span class="h2">Admin</span> <a href="admin.php">Administration</a><span class="endbox"></span></p>
print;
}
}
echo <<<print
</p>
</div></TD>
<TD ROWSPAN=2 class="contentbg" valign="top"><div id="content">
print;
?>
<h1>Search</h1>
<FORM name="search" action="searchImage.php" METHOD=POST>
<b>Title</b>
Write the title:<br>
<INPUT type=text name="title">
</br>
<fieldset>
<legend><b>Author</b></legend>
<label>Write the author:<br>
<INPUT type=text name="author">
</label></fieldset></br>
<fieldset>
<legend><b>Select the tags</b> (max 3 tags):</legend><label>
<input name="tag1" type="text" size="20" maxlength="30"></br>
<input name="tag2" type="text" size="20" maxlength="30"></br>
<input name="tag3" type="text" size="20" maxlength="30"></label>
</fieldset></br>
<fieldset>
<legend><b>Select category</b></legend>
<input type="radio" name="category" value="nature" checked="checked"/>Nature
<input type="radio" name="category" value="people"/>People
<br>
<input type="radio" name="category" value="animal"/>Animal
<input type="radio" name="category" value="other"/>Other
</fieldset>
</br>
<fieldset>
<legend>Date</legend>
<select name="day" >
<option value="one" selected="selected">1</option>
<option value="two">2</option>
<option value="three">3</option>
<option value="four">4</option>
<option value="five">5</option>
<option value="six">6</option>
<option value="seven">7</option>
<option value="eight">8</option>
<option value="nine">9</option>
<option value="ten">10</option>
<option value="eleven">11</option>
<option value="twelve">12</option>
<option value="thirteen">13</option>
<option value="fourteen">14</option>
<option value="fifteen">15</option>
<option value="sixteen">16</option>
<option value="seventeen">17</option>
<option value="eighteen">18</option>
<option value="nineteen">19</option>
<option value="twenty">20</option>
<option value="twentyone">21</option>
<option value="twentytwo">22</option>
<option value="twentythree">23</option>
<option value="twentyfour">24</option>
<option value="twentyfive">25</option>
<option value="twentysix">26</option>
<option value="twentyseven">27</option>
<option value="twentyeight">28</option>
<option value="twentynine">29</option>
<option value="thirty">30</option>
<option value="thirtyone">31</option>
</select>
<select name="month" >
<option value="january" selected="selected">January</option>
<option value="february">February</option>
<option value="march">March</option>
<option value="april">April</option>
<option value="may">May</option>
<option value="june">June</option>
<option value="july">July</option>
<option value="august">August</option>
<option value="september">September</option>
<option value="october">October</option>
<option value="november">November</option>
<option value="december">December</option>
</select>
<select name="year" >
<option value="twothousand" selected="selected">2010</option>
<option value="twothousandandeleven">2011</option>
<option value="twothousandandtwelve">2012</option>
</select>
</fieldset>
<div align="center"><button type="submit">
submit
</button></div></br></form>
</p>
</br>
</br>
</br>
</br>
<h1>©SketchMania</h1>
<TD valign="top" class="spacer"></TD>
</TR><TR>
<TD height="2" class="spacer2"></TD>
</TR><TR>
<TD COLSPAN=3 class="creditsbg">
<p>| Contact us <a href="http://yahoo.com/" target="_blank">[email protected]</a> | </p></TD>
</TR>
</TABLE>
</div>
</BODY>
</HTML>
PHP:
Notice: Undefined variable: search in C:\Program Files\EasyPHP-5.3.2\www\Sito\searchImage.php on line 67
Notice: Undefined variable: title in C:\Program Files\EasyPHP-5.3.2\www\Sito\searchImage.php on line 67
Notice: Undefined variable: author in C:\Program Files\EasyPHP-5.3.2\www\Sito\searchImage.php on line 71
Notice: Undefined variable: tag1 in C:\Program Files\EasyPHP-5.3.2\www\Sito\searchImage.php on line 75
Notice: Undefined variable: tag2 in C:\Program Files\EasyPHP-5.3.2\www\Sito\searchImage.php on line 79
Notice: Undefined variable: tag3 in C:\Program Files\EasyPHP-5.3.2\www\Sito\searchImage.php on line 83
Notice: Undefined variable: category in C:\Program Files\EasyPHP-5.3.2\www\Sito\searchImage.php on line 87
Error!Errore di sintassi nella query SQL vicino a 'and Title LIKE '%%' and Author LIKE '%%' and Tag1 LIKE '%%' and Tag2 LIKE '%%' a' linea 1
Qualcuno è in grado di aiutarmi? Grazie infinite in anticipo, anche per la pazienza!!