-2

im beginner i cant find a solution with that message when i use debug mod on my script

Unknown column 'approved' in 'where clause' | QUERY: SELECT COUNT(`record_num`) AS `count` FROM `scraper_import` WHERE `approved` = 1

my scraper.php

$i = trim($i);
if (dbQuery("INSERT INTO scraper_import (url, user, paysite) VALUES ('$i','$_POST[submitter]', '$_POST[paysite]')")) {
   $counter++;
 } else {
   $errors++;
 }
            }
        }
    }

I need create column approved

Jason K
  • 1,406
  • 1
  • 12
  • 15
CodePLS
  • 3
  • 1
  • 3
    there is no column `approved` in the attached image. – Samuel Cook Nov 18 '19 at 21:50
  • 4
    Your script is at risk for [SQL Injection Attacks](http://stackoverflow.com/questions/60174/). Use [prepared statements](https://bobby-tables.com/php). Even [escaping](http://stackoverflow.com/questions/5741187/) the string is not safe! – Jason K Nov 18 '19 at 21:51
  • Possible duplicate of [When should I use prepared statements?](https://stackoverflow.com/questions/24988867/when-should-i-use-prepared-statements) – Progman Nov 21 '19 at 18:55

2 Answers2

0

I need create column approved

In PHPMyAdmin You can add something like the following:

ALTER TABLE `scaper_import` ADD COLUMN `approved` TINYINT(1) NOT NULL DEFAULT 0;

That should add the column you desire.

Samuel Cook
  • 16,620
  • 7
  • 50
  • 62
0

I found a solution, I add on my sql file column approved and data and now it works. Thanks for helping me.

This is the solution:

CREATE TABLE IF NOT EXISTS `scraper_import` (
  `url` varchar(255) NOT NULL,
  `user` int(11) NOT NULL,
  `paysite` int(11) NOT NULL,
  `data` text NOT NULL,
  `approved` TINYINT(1) NOT NULL DEFAULT 0,
  `record_num` int(11) NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`record_num`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
RobC
  • 22,977
  • 20
  • 73
  • 80
CodePLS
  • 3
  • 1