archonis Posted September 12, 2009 Share Posted September 12, 2009 Hey guys, I been searching all day and found the search code posting here but it dont help me any. Can someone tell me what I am doing wrong here? This is the index.php <form name="form2" action="search.php"> <table width="117%" border="0" align="center"> <tr> <td bgcolor="#3D7AB8">SEARCH</td> </tr> <tr> <td> <input name="a" type="radio" value="1a"> <input name="a" type="radio" value="2a"> <input name="b" type="radio" value="1b"> Male <input name="b" type="radio" value="2b"> Female <br> <input name="c" type="text" id="c" size="6"> <input type="submit" name="Submit2" value="Submit"></td> </tr> </table> </form> This is the search.php <?php ini_set("session.cookie_domain"," .thesolarapexs.com"); session_start(); $username = $_SESSION['username']; $mypassword = $_SESSION['password']; $a1=$_POST['a']; $b1=$_POST['s']; $c1=$_POST['c']; // Make a MySQL Connection $result = mysql_query("SELECT * FROM members WHERE 'a' LIKE '%a1%' AND 'b' LIKE '%b1%' AND 'c' LIKE '%c1%'") or die(mysql_error()); ?> <table border="0" align="center"> <tr><td><div align="center"> <?php while($row = mysql_fetch_array($result)) { if($x == 2){ echo '</div></td></tr></table><table border=\"0\" align=\"center\"><tr><td><div align=\"center\">'; $x=0; } else{ $x++; } $showmyphoto = "<center><a href=\"http://date.thesolarapexs.com/profile.php?id=" . $row['username'] . "\"><img src=\"http://date.thesolarapexs.com/".$row['photo'] ."\" width=\"132\" height=\"158\"><a>"; echo $showmyphoto; echo "<br>"; echo "Username: " . $row['username'] . "<br>" . "Age: " . $row['age'] . "<br>" . "City: " . $row['city'] . "<br>" . "State: " . $row['state'] . "<br>" . "<span class=\"style3\">ONLINE TODAY!</span></center>"; echo "</div></td><td><div align=\"center\">"; } ?> Any help? Link to comment https://forums.phpfreaks.com/topic/173962-solved-search-php-help/ Share on other sites More sharing options...
kratsg Posted September 12, 2009 Share Posted September 12, 2009 Other than the fact that you use a1,b1,c1 instead of $a1,$b1,$c1? $result = mysql_query("SELECT * FROM members WHERE 'a' LIKE '%a1%' AND 'b' LIKE '%b1%' AND 'c' LIKE '%c1%'") or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/173962-solved-search-php-help/#findComment-916986 Share on other sites More sharing options...
archonis Posted September 12, 2009 Author Share Posted September 12, 2009 Yea, nothing shows up, Lets say i want to search my database and display everyone who has a = a1, b = b1, and c = c1 in other words, every one whos first name is james that are in nc and has the zip code of 29728 Link to comment https://forums.phpfreaks.com/topic/173962-solved-search-php-help/#findComment-916988 Share on other sites More sharing options...
kratsg Posted September 12, 2009 Share Posted September 12, 2009 It might help if you fix that error... replacing a1 with $a1 in the query.. so that it actually includes your variables. Link to comment https://forums.phpfreaks.com/topic/173962-solved-search-php-help/#findComment-916996 Share on other sites More sharing options...
archonis Posted September 12, 2009 Author Share Posted September 12, 2009 Using POST not GET Link to comment https://forums.phpfreaks.com/topic/173962-solved-search-php-help/#findComment-917000 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.