How do I restrict a person from seeing evrything that I have on my database to them seeing only their information and products for them to be able to UPDATE,EDIT and DELETE their own only
Thanx
18 2168
How do I restrict a person from seeing evrything that I have on my database to them seeing only their information and products for them to be able to UPDATE,EDIT and DELETE their own only
Thanx
Use a where condition in the select query where you display the records
For eg, if the user with the id #2 is logged in , put this id in the session, then the qry will be as
$sql = mysql_query("select * from tableName where id = '".$_SESSION["id"]."'") or die(mysql_error()) ;
you need to make sure that the product table has the foriegn key which is the primary key of the users table
Use a where condition in the select query where you display the records
For eg, if the user with the id #2 is logged in , put this id in the session, then the qry will be as
$sql = mysql_query("select * from tableName where id = '".$_SESSION["id"]."'") or die(mysql_error()) ;
you need to make sure that the product table has the foriegn key which is the primary key of the users table
Thanx for the reply.
but my primary key at the moment is the supp_name I dont have the id as its the foreign key on the product table or do I need to change the table structure to have the id
Thanx for the reply.
but my primary key at the moment is the supp_name I dont have the id as its the foreign key on the product table or do I need to change the table structure to have the id
yes it will be better if you change the table structure, so that it can have the foriegn key as the user's id in the product table
yes it will be better if you change the table structure, so that it can have the foriegn key as the user's id in the product table
Hi I changed my structure but now adding a product gives me a hassle even though a supplier is registered it does not want to add their products it goes to foreign key constraint errer as if the supplier is not registered.If they are not I know it does that.
Hi I changed my structure but now adding a product gives me a hassle even though a supplier is registered it does not want to add their products it goes to foreign key constraint errer as if the supplier is not registered.If they are not I know it does that.
Oh I can add the product from the mysql but then how do I define the user_id for it to know which id I am adding the products to. Can I use '".$_SESSION["user_id"]."' even though I am not using them anywhere in my coding???
Oh I can add the product from the mysql but then how do I define the user_id for it to know which id I am adding the products to. Can I use '".$_SESSION["user_id"]."' even though I am not using them anywhere in my coding???
Whenever the user enters the site, he/she might be adding products to the shopping cart at that time you need to assign the session id (session_id ) or currernt time() as the cart id and this will be stored in the session value, say $_SESSION["CART_ID"],
Now you'll be insetring a new record in the products table each time whenever user clicks on the add to cart, with the session cart id ($_SESSION["CART_ID"]) maintaing in the table. Now whenever you are inserting the product in the table, you need to insert the product information, session cart id ($_SESSION["CART_ID"]), and the user id , again the user id is also going to come from the session $_SESSION["USER_ID"],if the user is logged in , if the user is not logged in leave it as empty, at the time of checkout you'll ask the user to login to the site, now put the user id in session and update the product table, for eg,
update product_table set user_id = '$_SESSION["USER_ID"]' where cart_id=$_SESSION["CART_ID"];
Hope this is clear to you, if you have any queries get back to me
After logging on a Student has to view their school progress and test marks, how do I make sure that they are restricted to only their information and not of fellow mates? Coz now everybody sees everybody's marks which is not acceptable.
Thanks in advance
When I remember correctly, you had already asked that question (and it was answered) in your own thread thread merged into this one
Are you asking an almost identical question here?
Ronald :cool:
I never understood which is the reason why I am trying again now
Duplicate posts are kind of frowned upon....
Assuming your using a Database such a SQL server, Mysql. you need to add a where statement.. Ex. SELECT * FROM Database WHERE student_id = 1
student_id should beable to be retrieved from the session when the user logs in, if you don't have user_id's or session_id's you need to think for alittle bit and get some of this stuff coded in.
I never understood which is the reason why I am trying again now
If you don't understand the code shown to you in this forum, you must either tell the poster that you don't understand it or try to upgrade your PHP knowledge to a level where you can understand it.
But do not post the same question again and again. People get tired over that, because it distracts their attention, away from other members who also have problems.
Ronald :cool:
If you don't understand the code shown to you in this forum, you must either tell the poster that you don't understand it or try to upgrade your PHP knowledge to a level where you can understand it.
But do not post the same question again and again. People get tired over that, because it distracts their attention, away from other members who also have problems.
Ronald :cool:
Oh so I am stupid and don't have a problem.
THANKS FOR THAT never liked you.
Banfa 9,065
Expert Mod 8TB
Oh so I am stupid and don't have a problem.
THANKS FOR THAT never liked you.
There is no need for this kind of beligerant post.
Abusive behaviour is not tolerated on these forums and any further abusive behaviour will be met with swift action.
You have stated yourself that you did not understand the answer that was originally provided for you.
The reply that you either "say what it is you don't understand" or "attempt to learn more about php so you can better understand the original reply" is not unreasonable. Either course of action is likely to lead you to a solution.
What wont lead you to a solution is name calling and refusing to provide requested information about your problem.
I am going to merge this thread with the original thread and then I suggust you
1. Appologise
2. Give a more indepth description of what it is you don't understand.
Banfa
Community Administrator
Oh so I am stupid and don't have a problem.
THANKS FOR THAT never liked you.
Come on mankolele, just apologize to Ronnie there and let's continue to help each other out.
Atli 5,058
Expert 4TB
Hey
I acctually had a simular problem at one time, I asked a question on this forum and the answer I got was way over my head.
Instead of insulting on of the most helpfull guys on the forum I visited amazon and invested 20$ on a "php and mysql for beginners" book.
PHP is simple if you just take the time to learn the basics.
As for your problem.
Im guessing you have a user table, where you store your usernames and passwords.
In that table, logicly, each user would have a unique primary key.
Use that primary key to link the user to whatever data only he should be able to see.
Then you can use the "SELECT Grades From Gradebook WHERE userID = $userID" to limit the data he can see to only the things he is linked to.
I was able to do this sort of thing after the first chapter of my book ;)
Hey
I acctually had a simular problem at one time, I asked a question on this forum and the answer I got was way over my head.
Instead of insulting on of the most helpfull guys on the forum I visited amazon and invested 20$ on a "php and mysql for beginners" book.
PHP is simple if you just take the time to learn the basics.
As for your problem.
Im guessing you have a user table, where you store your usernames and passwords.
In that table, logicly, each user would have a unique primary key.
Use that primary key to link the user to whatever data only he should be able to see.
Then you can use the "SELECT Grades From Gradebook WHERE userID = $userID" to limit the data he can see to only the things he is linked to.
I was able to do this sort of thing after the first chapter of my book ;)
I am sorry.
I am sorry.
Geez that's brave. Hope you didn't take it too bad will be able to continue normally.
Cheers.
(Not the beer toasting cheers by the way, I leave that for mmcarthy and her circle of revellers)
Cheers.
(Not the beer toasting cheers by the way, I leave that for mmcarthy and her circle of revellers)
I will refrain from dignifying that comment with a response.
Oops!
Sign in to post your reply or Sign up for a free account.
Similar topics
by: mjobrien |
last post by:
Thanks for the hint Allen (see below). But I am already doing that
count as total records read (5)in the report footer. That count is
unduplicated for the record not for the field - student ID as...
|
by: Dilip |
last post by:
hi all
i m trying to make a windows explorer in my project
where i need details view with some columns.
but when i give this code at form load
Private Sub Form1_Load(ByVal sender As...
|
by: GS |
last post by:
I am looking for some software package for students information for
school, is there any open-source package available?.
This should collect complete student information like:
student details,...
|
by: RallyDSM |
last post by:
Hello,
I'm currently trying to read a .CSV file and get all the data into an
array so I can work with it in the program.
Here is what I currently have.
Private Sub IntializeData()
Dim AL...
|
by: Annie |
last post by:
hello guys,
I have a header details format page.
the header part is bound to a grid view and the details part is shown in a
Details view.
The details view enables to update, delete, save...
|
by: farzadaumixer |
last post by:
hi umm
i need help in writing a program in c(or c++)
here are the details:
i want it to recieve "x" numbers of student id's and the average of the student in their last term
and i want it to...
|
by: lieufirst |
last post by:
hi all,
well i got a grid view and a details view i linked the details view to the grid view so when i select a field it appers in the details view but the problem is when i surf to diffrent pages...
|
by: randy.buchholz |
last post by:
Been fighting this one for a while, looking for help.
I have a simple page with a grid view and details view (just managing a
single table). The details view is primarily used for creating new...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |