SQL

10 months 2 weeks ago #1 by jcmdlv
SQL was created by jcmdlv
Hi,
1.
I'm trying to insert data to a custom table into joomla database.
I've got this error :
Call to undefined method Joomla\Database\Mysqli\MysqliDriver::query()
With joomla5 PHP8.1

2.Fisrt yi trying insert data simple
INSERT INTO X_LYC_FORMTMP (TYPFORM,NOM,PRENOM,MAIL) VALUES ('fixe','User Name','Prenom','Reply-To Email');

Can you give me good syntax of values data form
VALUES (#fixe#,#User Name#,......'); ??
Thx
JC
 

Please Log in or Create an account to join the conversation.

10 months 2 weeks ago #2 by jcmdlv
Replied by jcmdlv on topic SQL
Chris,
Solution :
You must change in /components/com_rapidcontactex/lib.php
Line 1008 :
this
    $db->query($query);
for that
    $db->execute($query);



Now i ve got my simple data in my database, but how i insert values form ?

Thx
JC

Please Log in or Create an account to join the conversation.

10 months 2 weeks ago #3 by Christopher Mavros
Replied by Christopher Mavros on topic SQL
Hi jcmdlv and thank you for posting!

First of all, the error you get is a bug. Please open file components/com_rapidcontactex/lib.php and edit line 1008:
$db->query($query);
becomes
$db->execute($query);

I have also applied the same fix and it will be available in the next version.

The correct syntax to use is this:
INSERT INTO X_LYC_FORMTMP (TYPFORM, NOM, PRENOM, MAIL) VALUES ('<fieldid>1</fieldid>', '<fieldid>2</fieldid>', '<fieldid>3</fieldid>', '<fieldid>4</fieldid>');

Rapid Contact Ex will replace <fieldid>1</fieldid> with an escaped value posted from the form.

Let me know if you need any further assistance.

Christopher Mavros
mavrosxristoforos@gmail.com
If you like our extensions, please rate us on the JED!

Please Log in or Create an account to join the conversation.

10 months 2 weeks ago #4 by jcmdlv
Replied by jcmdlv on topic SQL
Dear Chris,
My problem it's when i m validating
this....M,MAIL) VALUES ('<fieldid>1</fieldid>','<fieldid>2</fieldid>','<fieldid>3</fieldid>','<fieldid>4</fieldid>');
the result is :
....M,MAIL) VALUES ('1', '2', '3', '4');

It's like there's a self-correction after validate


Joomla 5.0.2
PHP 8.1.18
mysql 8.0.27

Please Log in or Create an account to join the conversation.

10 months 1 week ago #5 by Christopher Mavros
Replied by Christopher Mavros on topic SQL
I don't understand where this validation takes place. What if we wanted to insert the actual value of <fieldid>1</fieldid> in a column?
Does this happen within Rapid Contact Ex?

Christopher Mavros
mavrosxristoforos@gmail.com
If you like our extensions, please rate us on the JED!

Please Log in or Create an account to join the conversation.

10 months 1 week ago #6 by jcmdlv
Replied by jcmdlv on topic SQL
Hi,

In the case Custom SQL in the configurations (Basic Options | Spam Protection | Sizing Options | Advanced Options | Custom SQL | updater Options.....)

I do Use Custom SQL -> YES

When i put :
INSERT INTO X_LYCEES_FORMTMP (TYPFORM,NOM,PRENOM,MAIL) VALUES (
'<fieldid>1</fieldid>','<fieldid>2</fieldid>','<fieldid>3</fieldid>','<fieldid>4</fieldid>');

I save it.

The box Custom SQL write this:
INSERT INTO X_LYCEES_FORMTMP (TYPFORM,NOM,PRENOM,MAIL) VALUES (
'1','2','3','4');

In my Field Manager
ID 1 : textbox
ID 2 : textbox
ID 3 : textbox
ID 4 : Email

Sorry for may very bad english
 

Please Log in or Create an account to join the conversation.

Moderators: Christopher Mavros