Tuto Database - Page 2 - Forum

Forum Navigation
You need to log in to create posts and topics.

Tuto Database

PreviousPage 2 of 2

Hi Coudroy,

Don't worry.
Please go to File > Open menu and navigate and open this file within your folder system:

My Documents/VisualNEO Web/Sample Apps/neoPhpSamples/neoPhpSimplestDataBase.neoapp

Then execute the application so you can see how it works:

  1. Compile the Application: Project > Compile/Publish (Select Web Application) and be sure "Empty build folder" option is unchecked.
  2. Go to menu Tools > neoPHP Server and press the "Start" button.
  3. Open your favourite Web Browser (ForeFox, Chrome...) and navigate to this URL: "localhost"
  4. The App will start running. Then press the "Load Data from DB" button.
  5. Use the orange buttons under the picture to navigate the different records in the database.

Now go back to VisualNEO Web and be sure to explore the subroutine and the buttons code by double clicking them.
This is the simplest database application I can think of.
As an example this is the code to show the next record:

If [currentRecord] < [totalRecords]-1
  SetVar [currentRecord] [currentRecord]+1
EndIf
SetVar [recordId] [tableData([currentRecord])('id')]
SetVar [recordPainting] [tableData([currentRecord])('painting')]
SetVar [recordAuthor] [tableData([currentRecord])('author')]
SetVar [recordImg] "./img/[tableData([currentRecord])('image')]"

tableData is the JSON object where all the data has been loaded.
id, painting, author and image are the different fields.
[currentRecord] is the variable wich stores the value with the "record number" currently active.

Please let me know if you have any doubt.
It's easier than it seems!

Regards.

Vadim has reacted to this post.
Vadim

Hi Luis,

I'm sorry, I must have expressed myself badly. I understand the procedure for working with the database. Following the examples, in fact it's simple.
I managed to recover the JSON file corresponding to the 'name' column.
But I don't know how to fill in the different elements of a 'combobox from the JSON file.
I understood that it is necessary to make a loop, but I do not see how to do it ...

I send you what I have done.

Best regards,

Uploaded files:
  • You need to login to have access to uploads.

Try this:

Loop 0 [totalRecords] [counter]
  SetVar [recordName] [tableData([counter]) ('name')]
  ListBoxAddItem "Combobox1" "[recordName]" "[recordName]"
EndLoop

Regards.

I try this, but when I check the " ListBoxGetSelectedItem "Combobox1" [selectedItem]" I would like to have a value to make a SELECT (sql) in my database, according the value of [selectedItem], but the value I have is  : $App.recordName...

Hi @cdy44-2

Sorry, it's a bug in the ListBoxAddItem command. It does not add values correctly to the ListBox when it's a variable.
I have fixed it and will work fine in next version.
Until it's released, please take a look at the attached app (yours modified). It has a subroutine ListBoxAddItemFixed to be used instead of ListBoxAddItem command.
Thank you!

Uploaded files:
  • You need to login to have access to uploads.
CDY@44 has reacted to this post.
CDY@44

Hi

Really we need clear steps tutorial on how to connect to MySQL DB


Quote

Hi @cdy44-2,

Yes, I want to add those tutorials in video and/or text format.
Unfortunately currently I do not have time enough but I'm very aware about the importance of such information.
Meanwhile please take a look at the included samples and ask whatever you need here in the forums.
Thank you for your understanding.

Best regards.

PreviousPage 2 of 2