Skip to content

How would you use prepared statement ? within quotes? #1048

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
mark8044 opened this issue Apr 13, 2025 · 0 comments
Open

How would you use prepared statement ? within quotes? #1048

mark8044 opened this issue Apr 13, 2025 · 0 comments

Comments

@mark8044
Copy link

Im trying to convert the following string

x[mark8044][userid:12345] into ==> x[newusername][userid:12345]

But something is not working here, I have a feeling it has to do with trying to put the prepared statement ? that sites within a quote '

$userid = 12345;
$oldusername = 'mark8044';
$newusername = 'newusername';



        $db->rawQuery("
                    UPDATE texthistory 
                    SET texthistory = REPLACE(pagetext, 'x['?'][userid:'?']', '@['?'][userid:'?']') 
                    WHERE texthistory LIKE '%@['?'][userid:'?']%' 
                    AND userid = ?", Array($oldusername,$userid,$newusername, $userid, $oldusername, $userid));

Removing the quotes does not seem to work either


        $db->rawQuery("
                    UPDATE texthistory 
                    SET texthistory = REPLACE(pagetext, 'x[?][userid:?]', '@[?][userid:?]') 
                    WHERE texthistory LIKE '%@[?][userid:?]%' 
                    AND userid = ?", Array($oldusername,$userid,$newusername, $userid, $oldusername, $userid));
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant