Dynamically place object in page using mysql and php?

This section is for posting questions which are not directly related to WYSIWYG Web Builder.
Examples of off topics: web server configuration, hosting, programming related questions, third party scripts.

Note that these questions will generally not be answered by the administrators of this forum.
Post Reply
User avatar
bburgess
 
 
Posts: 129
Joined: Mon May 13, 2013 5:05 am
Location: Australia

Dynamically place object in page using mysql and php?

Post by bburgess »

Hi all :)

If this is in the wrong place please move it.

I have been looking for some time for a tutorial or info on using a MySQL database to place objects into a members area I have built with the login tools.

GREAT tools set BTW thanks Pablo :)

Anyway would anybody be able to point me in the right direction please?

Limited knowledge in php but some in MySQL.

Any help very much appreciated!

Cheers
BB
KISS is the key!
User avatar
[RZ]
 
 
Posts: 1914
Joined: Tue Nov 04, 2008 12:08 pm

Re: Dynamically place object in page using mysql and php?

Post by [RZ] »

do you mean make them visible according to the profile settings or build them dynamically?
User avatar
bburgess
 
 
Posts: 129
Joined: Mon May 13, 2013 5:05 am
Location: Australia

Re: Dynamically place object in page using mysql and php?

Post by bburgess »

[RZ] wrote: Sun Apr 16, 2017 9:35 am do you mean make them visible according to the profile settings or build them dynamically?
As per the user profile settings mate, I think I should start there. Dynamically may not be the word.

I am still very much learning all this stuff :D

Cheers
KISS is the key!
User avatar
[RZ]
 
 
Posts: 1914
Joined: Tue Nov 04, 2008 12:08 pm

Re: Dynamically place object in page using mysql and php?

Post by [RZ] »

well, in that case and as you said, you have some basic skills on database, i would start with the simplest way
let's say you have 10 elements in total to be shown them accordingly to the profile
get from the database these setting and assign to php vars, something like:
<?php
$profile_obj_1 = ...
$profile_obj_2 = ...
...etc...
?>

in these vars you may have stored two possible values: 'none' and 'block'
then, assign them to styles (in <head> section)
<style>
#my_obj_1
{
display: <?php $profile_obj_1 ?>;
}
#my_obj_2
{
display: <?php $profile_obj_2 ?>;
}
...etc...
</style>

of course you muse have already created in your html the objects that their names are 'my_obj_1', 'my_obj_2', etc...
i think this is the quickest and simplest way to start...
hope this helps you to begin, just an idea
User avatar
bburgess
 
 
Posts: 129
Joined: Mon May 13, 2013 5:05 am
Location: Australia

Re: Dynamically place object in page using mysql and php?

Post by bburgess »

RZ thank you very much mate!

That is very helpful! I will have a go and let you know what happens :)

I have everything up in test at the moment so it will be a few days depending on my brain :D

Thank you again!!

Cheers
BB
KISS is the key!
User avatar
[RZ]
 
 
Posts: 1914
Joined: Tue Nov 04, 2008 12:08 pm

Re: Dynamically place object in page using mysql and php?

Post by [RZ] »

;)
User avatar
bburgess
 
 
Posts: 129
Joined: Mon May 13, 2013 5:05 am
Location: Australia

Re: Dynamically place object in page using mysql and php?

Post by bburgess »

[RZ] wrote: Sun Apr 16, 2017 10:23 am;)
Hi mate!

I will be comming back to this at some stage, just wanted to say thanks again for your help!

Cheers
BB
KISS is the key!
User avatar
[RZ]
 
 
Posts: 1914
Joined: Tue Nov 04, 2008 12:08 pm

Re: Dynamically place object in page using mysql and php?

Post by [RZ] »

thank you for your kind words
Post Reply