Advertisement:

Author Topic: MySQL UPDATE statement with $smcFunc['db_query']  (Read 1587 times)

Offline Decent_946

  • Semi-Newbie
  • *
  • Posts: 54
  • Gender: Male
    • Extreme Fighting Zome
MySQL UPDATE statement with $smcFunc['db_query']
« on: June 04, 2020, 08:29:16 AM »
Hey folks,

Was wondering in manuals and mods script to find somewhere MySQL UPDATE Statement via SMF Database Functions ($smcFunc) but I couldn't figure out. Seems like nobody is using it. Is there any function to update data in a column or otherwise, can I use MySQL UPDATE statement in db_query? I want to store user_ids in same cell instead of creating new entry for each user.

I'm using this code but it's giving some error.
Code: [Select]

$request = $smcFunc['db_query']('',
            'UPDATAE {db_prefix}v_reactions SET members_id = CONCAT_WS(",",members_id,{int:id_member}), no_of_reacts = {int:reacts} ',
            array(
                'id_member' => $member_id,
                'reacts' => ++$no_of_reacts,  //error line no: 41
            )
        );


the error
Quote
Database Error
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UPDATAE `id13123390_tvpsmf`.stp_v_reactions SET members_id = CONCAT_WS(",",membe' at line 1
File: /storage/ssd1/390/13123390/public_html/forum/dothis.php
Line: 41
another point to note, I'm using MySQL but the error says MariaDB. I faced a similar error before on db_create_table which was solved by correcting the type to text instead of varchar. It also mentioned MariaDB instead of MySQL.

Let me know if you need to know something else.

Thank you! :)
Thankx to RebellioN

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 72,651
    • StoryBB/StoryBB on GitHub
Re: MySQL UPDATE statement with $smcFunc['db_query']
« Reply #1 on: June 04, 2020, 08:35:05 AM »
It doesn’t say UPDATE, it says UPDATAE...
Please don’t PM me for paid work, I’m not for hire, and even if I was, I doubt you could afford me.
USD$150 per hour. Typical waiting list 3 months.

Offline Decent_946

  • Semi-Newbie
  • *
  • Posts: 54
  • Gender: Male
    • Extreme Fighting Zome
Re: MySQL UPDATE statement with $smcFunc['db_query']
« Reply #2 on: June 04, 2020, 11:00:47 AM »
It doesn’t say UPDATE, it says UPDATAE...
And I wasted my 2 days thinking what's wrong at line 40. Silly me.

Thanks. Solved. :)
Thankx to RebellioN