djdubuque Posted January 14, 2010 Share Posted January 14, 2010 I'm trying to pull some data from my dB but the code seems to have a glich cause when I hit submit it just returns to the search screen. <?php /** * @author Donald Dubuque - W4DJD * @copyright 2010 */ function escape($mixed){ if(empty($mixed)) return false; elseif(!is_array($mixed)) return mysql_real_escape_string($mixed); else foreach($mixed as $key => $val) $mixed[$key] = escape($val); return $mixed; } require_once('connect.php'); if(!empty($_POST['call'])){ $query = mysql_query("SELECT * FROM `jos_users` WHERE `call` LIKE '%".escape($_POST['call'])."%'"); while(($row = mysql_fetch_assoc($query)) !== FALSE) { // Print out the contents of the entry echo "Call Sign :{$row['call']} <br>" ; echo "Six Club: {$row['sixclub']}<br>"; echo "First Name : {$row['name']} <br>"; } } else { ?> <html> <body> <title>Six Club member search engine for ham radio operators.</title> <META NAME="Keywords" CONTENT="ham radio, callsign search engine!"> <META NAME="KEYWORDS" CONTENT="amateur, radio, amateur radio, ham, ham radio, arrl, short wave, shortwave, hobby, electronic, electronics, education, learning, scout, scouting, school, k12, emergency, communication, communications, telecommunication, books, magazines, software, QST, QEX, NCJ, Radio Designer, DXCC, contest, QSL, W1AW, repeaters, VHF, UHF, HF, microwave, license, club, public service, awards, certificates, volunteers, newsletter, regulations, FCC, technical, SAREX, space shuttle, projects, membership, member, VEC, exams, tests, foundation, scholarships"> <META http-equiv="Pragma" content="no-cache"> <script language="JavaScript" type="text/javascript"> function call_focus() { document.callsignsearch.call.value = ""; document.callsignsearch.call.focus(); } </script> <style type="text/css"> <!-- h1 {font-size: 50pt} --> </style> <p> <center> <body onload="call_focus()" bgcolor="white" leftmargin="0" rightmargin="0" marginheight="0" marginwidth="0" topmargin="0" text="black" link="blue" vlink="purple" alink="blue"> <a name="top"></a></p> <!-- news --> <table border="1" width="540" cellspacing="0" cellpadding="4"> <tr bgcolor="black"> <td><font face="arial" size="3"> <center> <font color="white" face="arial" size="3"><b>Six Club Member Database Search </b></font><font face="arial" size="3"></b> </center> </font> </td> </tr> <tr> <td> <center> <p ALIGN=CENTER STYLE="margin-bottom: 0cm"><FONT FACE="Verdana, sans-serif"><FONT SIZE=3><b>6mt.com Callsign Search</b><br> <FONT SIZE=2>Powered by Six Club.com <br> <p> <form method="post"> <b>Callsign:</b> <input type="text" value="" name="call_sign"size=8 maxsize=8 /><br /> <!--Zip Code: <input type="text" value="" name="zip_code" size=5 maxsize=5/><br />--> <br> <input type="submit" value="Go!" /> </form> </p> <a href="http://6mt.com" target="_self "style="text-decoration: none">Home</a> | <a href="http://6mt.com/hamdb/callsign.php" target="_self "style="text-decoration: none">Search Again</a> </body> </html> <?php } mysql_close() ?> Quote Link to comment https://forums.phpfreaks.com/topic/188465-my-code-could-someone-look-this-over-and-comment/ Share on other sites More sharing options...
PFMaBiSmAd Posted January 14, 2010 Share Posted January 14, 2010 The name of your form field (call_sign) is not the name you are using in the php code (call). And this is not actually a mysql query issue (the point in the code where the query is at is not even being reached), so moving this thread to the php help forum. Quote Link to comment https://forums.phpfreaks.com/topic/188465-my-code-could-someone-look-this-over-and-comment/#findComment-994978 Share on other sites More sharing options...
djdubuque Posted January 14, 2010 Author Share Posted January 14, 2010 Thanks for the catch, sorry if I placed this in the wrong topic area. Quote Link to comment https://forums.phpfreaks.com/topic/188465-my-code-could-someone-look-this-over-and-comment/#findComment-994983 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.