php - Insert statement not working using GET statements -


i believe code wrong selected fields aren't inserting table/fields @ all.

how following work following refernces url.

 $sql="insert instruction (physioreference, physio, physiosaddress, postcode, physiomobile, number, physiofax, physiosemail reference='$reference')  select physioreference, name, line1, postcode, mobile, tel, fax, email `physio` physioreference='$physioreference'"; 

example url: http://test.com/physiotoinstruction.php?physioreference=100099&a‌​mp;reference=456789

page.php

<?php  require_once('auth.php');  $host=""; // host name  $username=""; // mysql username $password=""; // mysql password  $db_name=""; // database name  $tbl_name="instruction"; // table name   // connect server , select database. mysql_connect("$host", "$username", "$password")or die("cannot connect");   mysql_select_db("$db_name")or die("cannot select db");    $reference=mysql_real_escape_string($_get['reference']); $physioreference=mysql_real_escape_string($_get['physioreference']);  $sql="insert instruction (physioreference, physio, physiosaddress, postcode, physiomobile, number, physiofax, physiosemail reference='$reference')  select physioreference, name, line1, postcode, mobile, tel, fax, email `physio` physioreference='$physioreference'";  $result=mysql_query($sql);    //$sql="insert triage (reference, forename)   //select reference, forename `instruction`  //where reference='$reference' limit 1";   echo "successful";  echo "<br>";  echo "<a href='insert.php'>view result</a>"; // mysql_error()     ?>      

mysql insert syntax not support where clause query stands fail.

try substitute physiosemail reference='$reference') physiosemail)


Comments