public or private?
Moderator: General Moderators
public or private?
Hi,yes i got a question well how can i do this.. i got a upload form for images right and now i would like to add a choiche for user before the uload that they can chosse weater their picture will be private or public. So basicly they upload in the same directory but one with private and one with public option. I really would need hel with this cos i cant figure it out all by myself. Then what i would like to do is to get all images from the public database and display them. Thank you...very much i know maybe i asked too much but i know u guys will figure it out.
Im thinking somthing like this if make public is checked then the script stores that picture with value 1 in the database if not then 0... so please help me
Im thinking somthing like this if make public is checked then the script stores that picture with value 1 in the database if not then 0... so please help me
Hi cindreta,
Ya you have the answer for your question in your message. If you want to store the picture with public and private option then you will store the database a status value like o for public and 1 for private in addition with image .
This is basic thing. I think I told nearly correct answer to you.
Bye..
Ya you have the answer for your question in your message. If you want to store the picture with public and private option then you will store the database a status value like o for public and 1 for private in addition with image .
This is basic thing. I think I told nearly correct answer to you.
Bye..
Just make a simple query from the database:
images_table:
status 1 = PUBLIC
status 0 = PRIVATE
the query will only return those images who's status is equal to 1 which means its a public image
Hope this helps
Code: Select all
<?php
include "connect.php";
$q="select * from images_table where status='1'";
$a=mysql_query($q);
while($arr=mysql_fetch_array($a)){
echo "<img src='".$arr['image_src']."'>";
}
?>images_table:
id_img | img_src | status
1 | "images/myimage.jpg" | 1
status 1 = PUBLIC
status 0 = PRIVATE
the query will only return those images who's status is equal to 1 which means its a public image
Hope this helps
Last edited by emmbec on Thu Sep 21, 2006 3:21 pm, edited 1 time in total.
thank you now i got some problems with getting the data into the database. I made a simple checkbox and now i messed somthing up, so only if u can tell me how to get the data into the database. So for example i made if the checkbox doesn't have a tick then insert value 0 into the db and if it is checked then insert 1. So can you help me with this too cos it wont work form me thank me i really thank you...
o yeah i found out this but how to get those values into a database.
<input type="hidden" name="choice[0]" value="0" />
<input type="checkbox" name="choice[0]" value="1" />
so if it's unchend it sores 0 and if checked it sotres 1
but i can get the query to work help me
o yeah i found out this but how to get those values into a database.
<input type="hidden" name="choice[0]" value="0" />
<input type="checkbox" name="choice[0]" value="1" />
so if it's unchend it sores 0 and if checked it sotres 1
but i can get the query to work help me
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA