We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

pass the value to SQL? | Forum

Marcus
Marcus Nov 30 '15
I have a value now how do I pass it to SQL and make it return results? I can use simply PHP code like: mysql_query
ross Team
ross Nov 30 '15
Topic was moved from General Questions.
Dnyan
Dnyan Dec 1 '15
your question will remain unanswered even if you come back after decade.

so dont waste your time here i already wasted more than a month.

go and get hooked on a community soft which have strong after install trouble shoot and feature installing support + support which you really expect that you will get from there.
Ebenezer Obasi
Ebenezer Obasi Dec 4 '15

Quote from Dnyan your question will remain unanswered even if you come back after decade.

so dont waste your time here i already wasted more than a month.

go and get hooked on a community soft which have strong after install trouble shoot and feature installing support + support which you really expect that you will get from there.
Be ready to be surprised :)


Quote from Marcus I have a value now how do I pass it to SQL and make it return results? I can use simply PHP code like: mysql_query

Get ready for OWSQL101 :)

Ebenezer Obasi
Ebenezer Obasi Dec 4 '15

//add a new table to ow db

OW::getConfig()->addConfig('some_plugin_name', 'some_field_name', 'default_value');


//collecting text input

$form = new Form('sharebtn_settings');


$foo = new TextField('some_field_name');

$foo->setLabel('foo_name');

$foo->setHasInvitation(true);

$foo->setInvitation('foo_example');

$foo->setDescription('foo_desc');

$foo->addElement($foo);


$fooSave = new Submit('save');

$fooSave->setValue('fooSave');

$form->addElement($fooSave);


$this->addForm($form);


//posting form

if ( OW::getRequest()->isPost() && $form->isValid($_POST) )

{

$data = $form->getValues();

OW::getConfig()->saveConfig('some_plugin_name', 'some_field_name', trim($data['some_field_name']));

OW::getFeedback()->info('Some success msg');

$this->redirect();

}


//get data from db

$dbFoo = OW::getConfig()->getValue('some_plugin_name', 'some_field_name');


>> See tutorial on Oxwall MySQL database

The Forum post is edited by Ebenezer Obasi Jul 12 '16
Marcus
Marcus Dec 5 '15
Ebenezer Obasi baby you are my hero this answer is awesome +1 and +100 million thanks.

How do I fetch data from ow_base_question
The Forum post is edited by Marcus Dec 5 '15
Ebenezer Obasi
Ebenezer Obasi Dec 6 '15

//get certain questions id from base

$baseQuestion = BOL_QuestionService::getInstance()->getQuestionData(array( OW::getUser()->getId() ), array('field_some_question_id'));

//store field_some_question_id question in $fieldVariable

$fieldVariable = $baseQuestion[OW::getUser()->getId()]['field_some_question_id'];


Pay attention to the bold comments.

Marcus
Marcus Dec 7 '15
Buddy thanks so much.

Please allow me one more question.

Let say I have a value (example) how can I return user IDs of those that have same value on their question?
Ebenezer Obasi
Ebenezer Obasi Jul 19 '16

BOL_QuestionService::getInstance()->getQuestionData(array(OW::getUser()->getId()), array('FieldName'));


This will return the value of FieldName of a specific user.