Forum

Custom Anchor to show SQL

26 June 2018 14:01
Hi Everyone and welcome to my first post.

I am trying to work on a little project and came across blend4web which I think will help massively in how I can display my back end data.

What I am looking to do is have a floor plan of a building and when an asset is clicked on e.g. a desk this will show a popup showing the user, and related information from an SQL database.

Now I have very little programming knowledge but I can make my way around.

Can this be done? Hopefully it can but can’t get my head around it at present.

Many Thanks
Jon
26 June 2018 20:05
Can this be done?
If I understand you correctly, you want an interactive 3D floorplan, something like this…
…and when the user clicks on something, let's say a chair or a desk, a custom anchor opens with data about the person who works at that place?

Yes, it can be done with B4W for sure. I would fetch the entire data of all the workplaces from SQL beforehand and simply put everything into their respective anchor divs before initing the scene. (The workplace data size would in any case be negligible compared to the data size of the 3D scene.)
27 June 2018 12:45
That is exactly what I am after. However I have no clue in where to begin.

Do you have an example of this? I have tried the usual places but can find other examples\tutorials on custom anchors but not to this extent.

Many Thanks
Jon
27 June 2018 14:29
By the way, if you have no dynamic modifications of any 3d object, you can make a prototype without programming, just with the help of Logic Editor (See the attached file)
Alexander (Blend4Web Team)
twitter
27 June 2018 17:27
That looks good but the data will be kept externally and will need to be referenced to when loaded. This is so we can keep an up to date asset database but can visually show the information on the screen.
27 June 2018 22:51
Personally, I use PHP + MYSQL for projects where serverside/database action is needed, so my workflow for your project would look like this:
  • - Create a new B4W project "interactive_office" in the B4W Project Manager.
  • - Go to the .blend file, create a bare-bone scene with only one workplace (for starters) and a custom anchor.
  • - Create a little SQL database with some employee data entries.
  • - Manipulate the project's .HTML file into a .PHP file which fetches the SQL data and generates a div for the custom anchor content serverside.
  • - Check if this works (does the anchor show the data?), and subsequently expand the scene if it does.
28 June 2018 15:43
Again a good idea however i cannot get this to work.
28 June 2018 16:34
I have however since found that it is possible to jun javascript from a file as in Alexander Romanov's example.

However i have been unsuccessful trying to get a php echo to show or a db connection.
28 June 2018 19:14
i have been unsuccessful trying to get a php echo to show or a db connection
Yes, this is the thing you need to get done first, and quite frankly, since this is a serverside issue that requires access to the database, password etc., nobody here can really do this for you remotely. But if you are absolutely lost, there are many good tutorials for PHP/MYSQL on the internet.

If you end up with a PHP file that does nothing else but print out the fetched database rows (things like First Name, Last Name etc.), great! That's all you need, upload it and we can help you with the rest.
25 September 2018 01:05
to show SQL there are lots of ways. but If you face Windows 10 Explorer Keeps Crashing, I don't have any solution to solve this.
 
Please register or log in to leave a reply.