Please find fault in this php script?
Question by Affs Dsfs: Please find fault in this php script?
hii iam in work of making a accounts holding database website based on php
can u please debug the lines beloow
it fails to do the queryy
is their anything wrong wit syntax
$ gmobileq=”INSERT INTO table2 (date, modelnumber, price, paid, sold ) select (date, modelnumber, price, paid, sold ) from table1 where shop =’3gmobile'”;
mysql_query($ gmobileq) or die(‘Error, failed to enter record) ;
at the same time
when i enter
mysql> INSERT INTO table1 (date, modelnumber, price, paid, sold) select date, modelnumber, price , paid , sold from table2
where shop =’3gmobile’;
in mysql monitor it works fine..
so please help
Best answer:
Answer by reefy
$ gmobileq=”INSERT INTO `table2` (date, modelnumber, price, paid, sold ) VALUES (‘date’, ‘modelnumber’, ‘price’, ‘paid’, ‘sold’)”;
$ result = mysql_query($ gmobileq) or die(‘Error, failed to enter record’);
$ gmobileq=”SELECT * FROM `table1` WHERE `shop`=’3gmobile'”;
$ result = mysql_query($ gmobileq) or die(‘Error, failed to enter record’);
Give your answer to this question below!