I want to create a fairly simple webpage where a user logs in and can manipulate a calendar that I create (perhaps with a HTML table?). I've already created a simple login service with a few HTML and php pages and have basic user info stored in a MAMP server.
Correct me if I'm wrong, but from here I would need to layout a calendar in HTML and maybe have link table cells to an edit page where the user can create a new event. The real question here is what is the best way to go about storing information like this on my server? Using PHP and MAMP like I did with the form data at registration?
I'm still fairly new to databases and working with servers and such, so just looking for a little guidance so I don't waste time learning a completely incorrect approach to this.
MySQL and PHP are definitely the way to go in my opinion. I would look into Javascript and AJAX if I were you also. Using AJAX, you could have a user enter information into the calendar directly and store it in the database without having to leave the page. jQuery is a very nice and simple library for working with Javascript and AJAX and I would very highly recommend it. It greatly simplifies working with Javascript.
As for the calendar itself, using a table seems like the best approach to me.
For storing information in MySQL, I'm seeing a table somewhat like this:
UID|EntryID|Date|Time|Event|etc.
You could store this table separately from your users table and join them easily when making requests. For instance, when a user logs in, you can pull the users UID from the users table you have set up, then pull all entries out of the calendar table with matching UID's and manipulate and display this information with PHP and Javascript.
There may be (and most likely are) better ways to set up your database, but this is kind of just a general concept of how you could get it to work. There are certainly people here with much more experience in MySQL and database design than myself.
Overall it sounds like you have a good idea working for you and have a pretty good idea of what it will take to make it happen. I wish you the best of luck on your project!
Related
I'm relatively new to mysql and I'm having trouble creating a website where a user registers and has access only to their private information. So far I have created a login/registration page that's linked to my mysql database using php and it works just fine. Every time a user registers, their userid, username, email, and password is inserted into my database.
The only problem is I don't know how to make each user have their own private info such a contact list filled with names, numbers, and emails that they can change on the frontend once they have made an account.
I was thinking about making a mysql table each time a user makes a new account, but from other stackoverflow posts, I learned that it was a bad idea. It stated that I should just have one giant table with all the users instead of separate tables. But I don't know how to do this and have each user have their own separate data. I have researched this for weeks and couldn't find anything online so I made this stackoverflow account to ask.
I also want to mention that I'm using the mysql command line in cloud9 ide so I can't use wordpress and I also plan on using Django.
Thanks a lot in advance.
I think you need to step back from this a bit, especially because using Django means that your easiest approach will be to use its Object-Relational Mapping api to handle the database.
Django is a Python web framework that gives you both database management and provides views to make things like login pages and user management easier. There would be no particular reason to use PHP (and it would be confusing to do so) in concert with it.
I'd suggest taking the tutorial for a spin first.
I want to fetch all current and future courses form this website http://www.scfhs.info/cme_pd/search/index.php for example this queries http://www.scfhs.info/cme_pd/search/do_search.php to my iOS app , unfortunately they don't have an API.
How to get the data?
Check this out https://www.parsehub.com/ this will help you for sure
I've done this for a project, search for html scraping. There are a tools to do it that vary depending on your platform. Here is a start. Unfortunately if the page changes you have problems. In my case the pages would update in an inconsistent manner. It looks like most of the data you want is in option tags; that should make it easy to parse.
I would have made this a comment, but I'm not worthy yet.
I'm trying to make a notifications system from scratch after looking around at ready mades and possible integratable versions that fell short.
I'm focusing on one aspect first: notifications for comments.
My database table comments looks like this: !(http://oi43.tinypic.com/2zgtaoz.jpg)
When a user submits a comment the recepient's ID is added to the field to_id.
unviewed is the default status of every comment.
Then I made this code to check for all unviewed comments:
SELECT COUNT(*) FROM comments WHERE to_id='$myid' AND status='unviewed'
I made some dummy comments and the count works 100%.
I also made a dropdown box to view the notifications in but the code is really long and not crucial to what I need to do next so I'll omit it unless needed to clarify later.
Now I'm trying to find out how I can change the value in the status field to 'viewed' when a user clicks through to it from their notifications menu.
Does anybody know how I can achieve this using php and cookies? Just looking for a point in the right direction, my mind is a bit frazzled after writing code all day.
Does anybody know how I can achieve this using php and cookies? Just looking for a point in the right direction, my mind is a bit frazzled after writing code all day.
You shouldn't reinvent the wheel. Just use one of the analytics frameworks available, such as google analytics. Note this is usually a paid service.
The approach you propose is slow, not scalable and rather limited.
The way it works, you just add a reference to JavaScript code. This code is located on a content delivery network, which means it is fast to get to the user. Usually, it is much faster than your production server. The code tracks a lot of user activities that can be valuable to a business. In most cases, such analytics is backed by nosql database.
Disclamer: I am not connected to any analytics framework in any way.
When you click a notification, I assume it is something basic like a checkbox or similar.
Just do a AJAX request or a simple POST request to a page called, maybe notif_read.php
There, get the value of the checkbox clicked and do a database query as follows:
"UPDATE Comments SET Status='viewed' WHERE to_id = '$myid' AND status='unviewed'"
Also, try using a simple boolean datatype for the status, since it makes things easier to update and check. Just a thought, will work as it is now.
I am interested in the idea of creating a website that allows users to submit content and display it on new pages for other users to view. For example having a form with a few text fields to fill out, and this will be the information that is shared. I have looked at some CMS software and most of it is too much for what i need. So if you have any advice or documentation to lead me in the right direction that would be wonderful.
Any book on MySQL and PHP application development will contain examples that do exactly what you describe -- I suggest you buy one and get started on your adventure!
If you take up the challenge and not use existing code, one thing you'll want to know up front is this:
In any case, make 100% sure that the values users enter can not be interpreted as SQL code. If users abuse your forms and you don't take preemptive measures, SQL injection is an easy way of gaining access to the entire database or deleting data from it. Simply calling mysql_real_escape_string() on every variable that comes from the user form, will prevent this from being possible.
Check http://en.wikipedia.org/wiki/SQL_injection for more info on this.
Good luck!
look for lightweight CMS it not wise to reinventing the wheel
you can use a guest book source code it can do the job all you have to do is to add some html
While many CMS packages probably have more than you need, it will most likely still be easier to learn a CMS than to figure out how to do everything on your own.
That said, figuring out how to do it yourself is a much better way to learn the fundamentals of web development. A popular place to start is PHP running on Apache with a MySQL database. If you're on Windows, you can find packages that install all of those things together and saves you from a lot of the low level configuration, for example WAMP.
Hey guys, hope this isn't too much of a n00b question
I'm mainly a front end developer that has recently started to do some back end programming. The script I'm working on is pretty simple (in theory). I just don't know where to begin and was hoping for some advice that will lead me in the right direction.
-The script is essentially a simple data logger.
-Everyday the user logs into the website, where it brings them to a single page.
-The user then checks an input box and enters a value into another input box
-That number is stored in the database
That's pretty much it. It seems pretty simple, but the problem is that there needs to be one administrator account that can read all the inputs of all other users.
My Question:
What is the BEST way to start this project? I have absolutely no clue on how to start it. Should I create classes for each of the functions (user logging in, user inputting value)? Should I use a framework? What would be the first steps you would take as a programmer.
I know this isn't a specific question, but like I said, I'm new to writing scripts that involve dealing with the backend and all that fun stuff. Thanks in advance.
In my experience - start with the front end. It's fantastic that you're a UI developer and you should absolutely start there. If a value should be dynamically inserted put in a placeholder.
At this stage I think a framework is inviting a pile of work to land on your desk. PHP documentation is great and will serve you better than any framework in my opinion.
Here's what I'd do, maybe you can roll with it too:
Create the UI in simple HTML/CSS/jQuery
Insert placeholders for dynamically created content
Remove common elements (header/footer/sidebar boxes/etc) and create PHP includes
Hunt down each "dynamic data" placeholder and create a PHP function to output placeholder data
Once you know what data you need, create the database
Create example records in the database
Adjust the PHP files to pull out example records
Now create the forms to insert data into the database (because you know what few fields are needed)
Test, test and test
I have always worked this way because I believe the user comes first. Many programmers are too involved in the architecture or database structure or complex forms. Most people at work hate me because I start with the UI. You sir are privileged!