php - Index and Variable errors -


i'm noob php/mysql programming , had form working when got new computer won't work. html form send results php page kicks wamp mysql database. said, had working beautifully , got new machine, reinstalled wamp, copied on database , info, , gives me nothing notices , if add die(mysql_error()) end ot $sql - ("select..... before, gives me cannot connect error.

<?php $q=$_get["q"];  $con = mysql_connect("localhost","root","password");  if (!$con) {     die('could not connect: ' . mysql_error()); }  mysql_select_db("kalen_qc", $con);  $sql = ("select `id` `users` `username` = ' " . $root . " ' , `password` = ' " . $password . " ' limit 1");  //retrieve data sql query string $cname = $_get["cname"]; $job = $_get["job"]; $apptype = $_get["apptype"]; $priority = $_get["priority"]; $daterec = $_get["daterec"]; $datereq = $_get["datereq"]; $po = $_get["po"]; $authby = $_get["authby"]; $phone = $_get["phone"]; $fax = $_get["fax"]; $motorplantnumber = $_get["motorplantnumber"]; $quoted = $_get["quoted"]; $incomphoto = $_get["incomphoto"]; $repvalue = $_get["repvalue"]; $eyebolt = $_get["eyebolt"]; $motorassem = $_get["motorassem"]; $conduitbox = $_get["conduitbox"]; $conboxpos = $_get["conboxpos"]; $coupler = $_get["coupler"]; $couplexten = $_get["couplexten"]; $couplrecess = $_get["couplrecess"]; $couplflush = $_get["couplflush"]; $motorweight = $_get["motorweight"]; $motorfreq = $_get["motorfreq"]; $application = $_get["application"]; $appdesc = $_get["appdesc"]; $specinstruc = $_get["specinstruc"]; $reasonserv = $_get["reasonserv"]; $obviousdamage = $_get["obviousdamage"]; $cussupplyprod = $_get["cussupplyprod"];  // escape user input prevent sql injection $cname = mysql_real_escape_string($cname); $job = mysql_real_escape_string($job); $apptype = mysql_real_escape_string($apptype); $priority = mysql_real_escape_string($priority); $daterec = mysql_real_escape_string($daterec); $datereq = mysql_real_escape_string($datereq); $po = mysql_real_escape_string($po); $authby = mysql_real_escape_string($authby); $phone = mysql_real_escape_string($phone); $fax = mysql_real_escape_string($fax); $motorplantnumber = mysql_real_escape_string($motorplantnumber); $incomphoto = mysql_real_escape_string($incomphoto); $repvalue = mysql_real_escape_string($repvalue); $motorassem = mysql_real_escape_string($motorassem); $conduitbox = mysql_real_escape_string($conduitbox); $conboxpos = mysql_real_escape_string($conboxpos); $coupler = mysql_real_escape_string($coupler); $couplexten = mysql_real_escape_string($couplexten); $couplrecess = mysql_real_escape_string($couplrecess); $couplflush = mysql_real_escape_string($couplflush); $motorweight = mysql_real_escape_string($motorweight); $motorfreq = mysql_real_escape_string($motorfreq); $application = mysql_real_escape_string($application); $appdesc = mysql_real_escape_string($appdesc); $specinstruc = mysql_real_escape_string($specinstruc); $reasonserv = mysql_real_escape_string($reasonserv); $obviousdamage = mysql_real_escape_string($obviousdamage); $cussupplyprod = mysql_real_escape_string($cussupplyprod);     $sql="insert motor_checkin (cname, job, apptype, priority, daterec, datereq, po, authby, phone, fax, motorplantnumber, quoted, incomphoto, repvalue, eyebolt, motorassem,  conduitbox, conboxpos, coupler, couplexten, couplrecess, couplflush, motorweight, motorfreq, application, appdesc, specinstruc, reasonserv, obviousdamage, cussupplyprod) values ('$_get[cname]','$_get[job]','$_get[apptype]','$_get[priority]','$_get[daterec]', '$_get[datereq]','$_get[po]','$_get[authby]','$_get[phone]','$_get[fax]','$_get[motorplantnumber]', '$_get[quoted]','$_get[incomphoto]','$_get[repvalue]','$_get[eyebolt]','$_get[motorassem]','$_get[conduitbox]','$_get[conboxpos]','$_get[coupler]','$_get[couplexten]','$_get[couplrecess]', '$_get[couplflush]','$_get[motorweight]','$_get[motorfreq]','$_get[application]','$_get[appdesc]', '$_get[specinstruc]','$_get[reasonserv]','$_get[obviousdamage]','$_get[cussupplyprod]')";    if (!mysql_query($sql,$con));   {   die('error: ' . mysql_error());   } header("location: /");  mysql_close($con); ?> 

html

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">  <html> <head>     <meta http-equiv="content-typetext/html; charset=iso-8859-1"> <title>kalen electric repair packet</title> <link rel="stylesheet" type="text/css" href="qcstyle.css" /> <link rel="icon" href="images/favicon.ico" /> <!-- conditional ie8 , ie6 , earlier- 8 needs display:table     --> <!--[if !ie 7]> <style type="text/css">     #wrap {display:table;height:100%} </style> <![endif]--> <script type="text/javascript">     function showuser(str)         {             if (str=="")                 {                     document.getelementbyid("txthint").innerhtml="";                     return;                 }             if (window.xmlhttprequest)                 {// code ie7+, firefox, chrome, opera, safari                     xmlhttp=new xmlhttprequest();                 }             else                 {// code ie6, ie5                      xmlhttp=new activexobject("microsoft.xmlhttp");                 }                     xmlhttp.onreadystatechange=function()                 {             if                      (xmlhttp.readystate==4 && xmlhttp.status==200)                 {                     document.getelementbyid("txthint").innerhtml=xmlhttp.responsetext;                 }                 }                     xmlhttp.open("get","insert.php?q="+str,true);                     xmlhttp.send();                 }     function loadxmldoc()         {          } </script> </head> <body> <div id="wrap">  <!-- wrap div needs encompass except footer div @ bottom -->  <div id="header">         <div id="logo"> <!-- div centering fixed width area of header content -->              <a href="../index.html"><img src="images/logo.png" alt="kalen electric , machinery inc quality control" class="logo"/></a>           </div>     </div>      <div id="main">       <!-- inside main div floating content left , sidebar right  -->          <div id="content">              <h1>motor check&#45;in&#58;</h1>             <form action="insert.php" method="post" id="horizontalform">                 <div class="box">                     <fieldset>                         <label>                             <span>customer&#58;</span>                          <select class="cname" name="cname"><option value="">select one</option> <option value="gp wauna">gp wauna</option> <option value="gp toledo">gp toledo</option> <option value="gp camas">gp camas</option></select>                         </label>                         <label>                         <span>job number&#58;</span>                             <input class="job" type="integer" name="job" onclick="this.value=''"/>                         </label>                         <label>                             <button type="button" onclick="loadxmldoc()">new job</button>                         </label>                     </fieldset>                     <fieldset>                         <label>                                 <span>apparatus type&#58 </span>                             <select class="apptype" name="apptype"> <option value="ac motor">ac motor</option> <option value="ac motor 1ph">ac motor 1ph</option> <option value="ac motor/gearhead">ac motor/gearhead</option>                                  <option value="ac welder">ac welder</option> <option value="ac submersible">ac submersible</option> <option value="stator only">stator only</option>                                  <option value="service call">service call</option> <option value="ac generator">ac generator</option></select>                         </label>                         <label>                         <span>priority&#58;</span>                         <select class="priority" name="priority"> <option value="p1">p1</option> <option value="p2">p2</option> <option value="p3">p3</option></select>                     </label>                 </fieldset>                 <fieldset>                     <label>                          <span>date received&#58;</span>                         <input class="daterec" type="date" size="12" maxlength="10" name="daterec" onclick="this.value=''"/>                     </label>                     <label>                         <span>date required&#58;</span>                         <input class="datereq" type="date" size="12" maxlength="10" name="datereq" onclick="this.value=''"/>                     </label>                     <label>                         <span>po&#35;&#58;</span>                         <input class="po" type="text" size="12" maxlength="20" name="po" onclick="this.value=''"/>                     </label>                     <label>                         <span>authorized by&#58;</span>                         <input class="authby" type="text" size="12" maxlength="30" name="authby" onclick="this.value=''"/>                     </label>                 </fieldset>                 <fieldset>                     <label>                         <span>phone&#35;&#58;</span>                         <input class="phone" type="text" size="12" maxlength="12" name="phone" onclick="this.value=''"/>                     </label>                     <label>                         <span>fax&#35;&#58;</span>                         <input class="fax" type="text" size="12" maxlength="12" name="fax" onclick="this.value=''"/>                     </label>                     <label>                         <span>motor plant&#35;&#58;</span>                         <input class="motorplantnumber" type="text" size="12" maxlength="20" name="motorplantnumber" onclick="this.value=''"/>                     </label>                     <label>                         <span>quoted&#58;</span>                         <select class="quoted" name="quoted"> <option value="no">no</option> <option value="yes">yes</option></select>                     </label>                 </fieldset>                 <fieldset>                     <label>                                          <span>incoming photo received&#58;</span>                         <select class="incomphoto" name="incomphoto"> <option value="no">no</option> <option value="yes">yes</option></select>                     </label>                     <label>                         <span>replacement value&#58;</span>                         <input class="repvalue" type="text" size="12" maxlength="7" name="repvalue" onclick="this.value=''"/>                     </label>                     <label>                         <span>eye&#45;bolt&#58</span>                         <select class="eyebolt" name="eyebolt"> <option value="good">good</option> <option value="bad">bad</option> <option value="none">none</option></select>                     </label>                 </fieldset>                 <fieldset>                     <label>                         <span>motor assembly&#58;</span>                         <select class="motorassem" name="motorassem"> <option value="f1">f1</option> <option value="f2">f2</option> <option value="vertical">vertical</option></select>                     </label>                     <label>                         <span>conduit box&#58;</span>                     <select class="conduitbox" name="conduitbox"> <option value="full">full</option> <option value="half">half</option> <option value="none">none</option></select>                     </label>                     <label>                         <span>conduit box position&#58;</span>                         <select class="conboxpos" name="conboxpos"> <option value="3:00">3:00</option> <option value="6:00">6:00</option> <option value="9:00">9:00</option> <option value="12:00">12:00</option> </select>                     </label>                 </fieldset>                 <fieldset>                     <label>                              <span>coupler&#47;pulley&#58;</span>                         <select class="coupler" name="coupler"> <option value="coupler">coupler</option> <option value="pulley">pulley</option> <option value="none">none</option> </select>                     </label>                     <label>                         <span>extended&#58;</span>                         <input class="couplexten" type="text" size="12" maxlength="10" name="couplexten" onclick="this.value=''"/>                     </label>                     <label>                         <span>recessed&#58;</span>                         <input class="couplerecess" type="text" size="12" maxlength="10" name="couplrecess" onclick="this.value=''"/>                     </label>                     <label>                         <span>flush&#58;</span>                         <input class="couplflush" type="text" size="12" maxlength="10" name="couplflush" onclick="this.value=''"/>                     </label>                 </fieldset>                 <fieldset>                     <label>                         <span>motor weight&#58;</span>                         <input class="motorweight" type="text" size="12" maxlength="10" name="motorweight" onclick="this.value=''"/>                     </label>                     <label>                         <span>motor on frequency drive&#58;</span>                         <select class="motorfreq" name="motorfreq"> <option value="yes">yes</option> <option value="no">no</option> </select>                     </label>                 </fieldset>                 <fieldset>                     <label>                         <span>application&#58;</span>                         <select class="application" name="application"> <option value="direct coupled">direct coupled</option> <option value="belted">belted</option> </select>                     </label>                     <label>                         <span>application description&#58;</span>                         <input class="appdesc" type="text" size="12" maxlength="100" name="appdesc" onclick="this.value=''"/>                     </label>                 </fieldset>                 <fieldset>                     <label>                         <span>special instructions&#58;</span>                         <input class="specinstruc" type="text" size="12" maxlength="255" name="specinstruc" onclick="this.value=''"/>                     </label>                 </fieldset>                 <fieldset>                     <label>                          <span>reason service&#58;</span>                         <input class="reasonserv" type="text" size="12" maxlength="255" name="reasonserv" onclick="this.value=''"/>                     </label>                 </fieldset>                 <fieldset>                     <label>                         <span>obvious damaged or missing parts&#58;</span>                         <input class="obviousdamage" type="text" size="12" maxlength="255" name="obviousdamage" onclick="this.value=''"/>                     </label>                 </fieldset>                 <fieldset>                     <label>                         <span>customer supplied product&#58;</span>                         <input class="cussupplyprod" type="text" size="12" maxlength="255" name="cussupplyprod" onclick="this.value=''"/>                     </label>                 </fieldset>             <label>             <input  type="submit" /><br />             </label>             </div>         </form>      </div> </div> </div> <!-- close wrap div here -->  <div id="footer">     <div id="foot"> <!-- div centering fixed width area of footer content -->         <div id="left">         <p>kalen electric , machinery inc.</p>     </div>     <div id="right">         <p>ac induction - version 1.0</p>     </div> </div> </div>  </body> </html> 

errors returns:

( ! ) notice: undefined index: q in c:\wamp\www\insert.php on line 2 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined variable: root in c:\wamp\www\insert.php on line 13 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined variable: sprocket in c:\wamp\www\insert.php on line 13 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: cname in c:\wamp\www\insert.php on line 16 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: job in c:\wamp\www\insert.php on line 17 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: apptype in c:\wamp\www\insert.php on line 18 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: priority in c:\wamp\www\insert.php on line 19 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: daterec in c:\wamp\www\insert.php on line 20 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: datereq in c:\wamp\www\insert.php on line 21 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: po in c:\wamp\www\insert.php on line 22 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: authby in c:\wamp\www\insert.php on line 23 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: phone in c:\wamp\www\insert.php on line 24 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: fax in c:\wamp\www\insert.php on line 25 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: motorplantnumber in c:\wamp\www\insert.php on line 26 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: quoted in c:\wamp\www\insert.php on line 27 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: incomphoto in c:\wamp\www\insert.php on line 28 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: repvalue in c:\wamp\www\insert.php on line 29 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: eyebolt in c:\wamp\www\insert.php on line 30 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: motorassem in c:\wamp\www\insert.php on line 31 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: conduitbox in c:\wamp\www\insert.php on line 32 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: conboxpos in c:\wamp\www\insert.php on line 33 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: coupler in c:\wamp\www\insert.php on line 34 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: couplexten in c:\wamp\www\insert.php on line 35 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: couplrecess in c:\wamp\www\insert.php on line 36 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: couplflush in c:\wamp\www\insert.php on line 37 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: motorweight in c:\wamp\www\insert.php on line 38 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: motorfreq in c:\wamp\www\insert.php on line 39 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: application in c:\wamp\www\insert.php on line 40 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: appdesc in c:\wamp\www\insert.php on line 41 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: specinstruc in c:\wamp\www\insert.php on line 42 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: reasonserv in c:\wamp\www\insert.php on line 43 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: obviousdamage in c:\wamp\www\insert.php on line 44 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: cussupplyprod in c:\wamp\www\insert.php on line 45 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: cname in c:\wamp\www\insert.php on line 85 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: job in c:\wamp\www\insert.php on line 85 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: apptype in c:\wamp\www\insert.php on line 85 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: priority in c:\wamp\www\insert.php on line 85 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: daterec in c:\wamp\www\insert.php on line 85 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: datereq in c:\wamp\www\insert.php on line 86 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: po in c:\wamp\www\insert.php on line 86 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: authby in c:\wamp\www\insert.php on line 86 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: phone in c:\wamp\www\insert.php on line 86 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: fax in c:\wamp\www\insert.php on line 86 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: motorplantnumber in c:\wamp\www\insert.php on line 86 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: quoted in c:\wamp\www\insert.php on line 87 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: incomphoto in c:\wamp\www\insert.php on line 87 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: repvalue in c:\wamp\www\insert.php on line 87 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: eyebolt in c:\wamp\www\insert.php on line 87 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: motorassem in c:\wamp\www\insert.php on line 87 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: conduitbox in c:\wamp\www\insert.php on line 88 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: conboxpos in c:\wamp\www\insert.php on line 88 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: coupler in c:\wamp\www\insert.php on line 88 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: couplexten in c:\wamp\www\insert.php on line 88 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: couplrecess in c:\wamp\www\insert.php on line 88 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: couplflush in c:\wamp\www\insert.php on line 89 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: motorweight in c:\wamp\www\insert.php on line 89 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: motorfreq in c:\wamp\www\insert.php on line 89 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: application in c:\wamp\www\insert.php on line 89 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: appdesc in c:\wamp\www\insert.php on line 89 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: specinstruc in c:\wamp\www\insert.php on line 90 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: reasonserv in c:\wamp\www\insert.php on line 90 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: obviousdamage in c:\wamp\www\insert.php on line 90 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0  ( ! ) notice: undefined index: cussupplyprod in c:\wamp\www\insert.php on line 90 call stack #   time    memory  function    location 1   0.0006  744072  {main}( )   ..\insert.php:0 

the answer in notice itself. entry q not exist in query string.

it's best build error handling , input validation ensure appropriate variable exists.

$q = (isset($_get['q']) ? $_get['q'] : null); 

since setting , referencing multiple variables, suggest create function can pass corresponding variable. not checks existence of corresponding variable, escapes variable use in query.

<?php  function varexist($var){          return (isset($_get[$var]) ? mysql_real_escape_string($_get[$var]) : null);      }  $q = varexist('q');  ...     ?> 

please note per documentation:

use of extension discouraged. instead, mysqli or pdo_mysql extension should used. see mysql: choosing api guide , related faq more information. alternatives function include:

■mysqli_real_escape_string() ■pdo::quote()

there additional documentation pertaining suggested alternative, mysqli_real_escape_string(), may review.


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -