Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,201,432 members, 7,978,368 topics. Date: Friday, 18 October 2024 at 07:09 AM |
Nairaland Forum / Science/Technology / Programming / Php Dev Help (625 Views)
Php Dev Needed For A Simple Task / Intern Or Junior Dev. Job / I Need A Dev For Small Work (2) (3) (4)
Php Dev Help by 3exe3: 2:40am On Feb 03, 2022 |
cant just find whats wrong with my insert statement checked the types on my db and made sure its in the right order but no way out its in the screenshot below working with dynamic data which i looped through and escaped before inserting pls help
|
Re: Php Dev Help by youngpresidooo: 3:27am On Feb 03, 2022 |
3exe3:it is your mysql version |
Re: Php Dev Help by fnep2smooth(m): 6:50am On Feb 03, 2022 |
3exe3:Let the the screenshot of the insert code |
Re: Php Dev Help by 3exe3: 9:07am On Feb 03, 2022 |
youngpresidooo:Thanks will try changing the version |
Re: Php Dev Help by efelico: 1:34pm On Feb 03, 2022 |
ensure that all string values are quoted and integer values are not quoted |
Re: Php Dev Help by qtguru(m): 4:23pm On Feb 03, 2022 |
youngpresidooo: That is wrong |
Re: Php Dev Help by qtguru(m): 4:24pm On Feb 03, 2022 |
Ensure the values are quoted 1 Like |
Re: Php Dev Help by stanliwise(m): 9:08am On Feb 05, 2022 |
3exe3:Are we magicians, paste the full SQL queries, Hian. na wa for person wey look for solution o 1 Like |
Re: Php Dev Help by richebony: 10:45am On Feb 05, 2022 |
It's obviously a syntactic error...paste the statement here so we can debug. .can't remember the last time I used native queries sef. .except short ones though ..most ORM/ODM abstracts them |
Re: Php Dev Help by 3exe3: 3:24pm On Feb 05, 2022 |
qtguru: private function getData($data) { foreach($data as $row => $value) { $this->rows[] = $this->escape($row); $this->values[] = $this->escape($value); } } protected function insert($table, $data) { $this->getData($data); $sql = 'INSERT INTO '.$table.'('.implode(',', $this->rows).') VALUES ('.implode(',', $this->values).')'; if(!$this->query($sql)) { return $this->error(); } return $sql; } if(REQUEST_METHOD === 'POST') { $data = array( 'firstname' => (string)$_POST['firstname'], 'lastname' => (string)$_POST['lastname'], 'username' => (string)$_POST['username'], 'password' => (string)sha1($_POST['password']), 'email' => (string)$_POST['email'], 'gender' => (string)$_POST['gender'], 'phonenumber' => (string)$_POST['phonenumber'], 'address' => USER_LOCATION, 'date_joined' => date(DateTime::RFC2822), 'user_level' => 'user', 'is_verified' => 0 ); } |
Re: Php Dev Help by 3exe3: 4:21pm On Feb 05, 2022 |
solved it with '\''.$this->escape($value).'\'' |
Re: Php Dev Help by qtguru(m): 6:48am On Feb 06, 2022 |
3exe3: Use PDO my brother, I get it is a lot of code but it pays off in the long run. is this company work or personal project ? if personal project then continue |
Re: Php Dev Help by 3exe3: 6:52am On Feb 06, 2022 |
qtguru: Personal Why u asking |
Re: Php Dev Help by qtguru(m): 6:59am On Feb 06, 2022 |
3exe3: I was looking at Database Support, PDO will allow your port your code to any DB, and using Prepared statements is much safer, for real life projects you can't use this type of code. that's why I asked |
Re: Php Dev Help by qtguru(m): 7:52am On Feb 06, 2022 |
3exe3: Also A Company is looking for a PHP Developer, OOP Knowledge is mostly required, let me know later 1 Like |
Re: Php Dev Help by 3exe3: 2:29pm On Feb 06, 2022 |
qtguru: in prophet isaiah voice 'Here I am send me". I got what it takes thats what I mean by the way. What do I need to do. |
Re: Php Dev Help by qtguru(m): 2:30pm On Feb 06, 2022 |
3exe3: send email to okeowo.aderemi@yandex.com so I can explain. Thanks |
Re: Php Dev Help by 3exe3: 2:47pm On Feb 06, 2022 |
qtguru: sent it now as woyenghilabofa@outlook.com |
(1) (Reply)
Fellowship At The Bulb Aptitude Test / How I Survive As A Freelance Using A Coworking Space With Free Internet Access / Fairly Used Laptops For Sale (WHOLESALE )
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 20 |