₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,324,999 members, 8,419,865 topics. Date: Thursday, 04 June 2026 at 05:03 AM

Toggle theme

Php Dev Help - Programming - Nairaland

Nairaland ForumScience/TechnologyProgrammingPhp Dev Help (766 Views)

1 Reply (Go Down)

Php Dev Help by 3exe3(op): 2:40am On Feb 03, 2022
grin 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:
grin 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
it is your mysql version
Re: Php Dev Help by fnep2smooth(m): 6:50am On Feb 03, 2022
3exe3:
grin 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
Let the the screenshot of the insert code
Re: Php Dev Help by 3exe3(op): 9:07am On Feb 03, 2022
youngpresidooo:
it is your mysql version
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:
it is your mysql version
That is wrong
Re: Php Dev Help by qtguru(m): 4:24pm On Feb 03, 2022
Ensure the values are quoted
Re: Php Dev Help by stanliwise(m): 9:08am On Feb 05, 2022
3exe3:
grin 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
Are we magicians, paste the full SQL queries,
Hian. na wa for person wey look for solution o
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(op): 3:24pm On Feb 05, 2022
qtguru:
Ensure the values are quoted
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(op): 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:
solved it

with

'\''.$this->escape($value).'\''
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(op): 6:52am On Feb 06, 2022
qtguru:
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
Personal

Why u asking
Re: Php Dev Help by qtguru(m): 6:59am On Feb 06, 2022
3exe3:
Personal

Why u asking
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:
Personal

Why u asking
Also A Company is looking for a PHP Developer, OOP Knowledge is mostly required, let me know later
Re: Php Dev Help by 3exe3(op): 2:29pm On Feb 06, 2022
qtguru:
Also A Company is looking for a PHP Developer, OOP Knowledge is mostly required, let me know later
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:
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.
send email to okeowo.aderemi@yandex.com so I can explain. Thanks
Re: Php Dev Help by 3exe3(op): 2:47pm On Feb 06, 2022
qtguru:
send email to okeowo.aderemi@yandex.com so I can explain. Thanks
sent it now as woyenghilabofa@outlook.com
1 Reply

Php Dev Needed For A Simple TaskDon't Joke With These Math Topics If You Want To Be A Successful Game DevJack Of All Trades - The Dev Struggle234

Need Help Downloading Copyrighted VideosGoogle Play Console Paid With Payday But Unable To Do VerificationWho Can Build an App And create a Website