Welcome! Log In Create A New Profile

Advanced

confused smiley Help please - final prac - login error for mySQL after editing user with phMyAdmin

Posted by Anonymous User 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
phpMyAdmin in XAMPP for Windows:

Successfully created the database 'registration' with three tables.

Then I created a new user giving him all four privileges: select, insert, update, delete.

There was already a user beside the superuser "root" called 'pma' with no password. I edited this one giving him only the select privilege while at the same time entering a password (the same like the one for the user created before). Then I clicked Go direct under the password option. Then the login screen appeared giving me an error message:

#1045 - Access denied for user 'pma'@'localhost' (using password: NO)

Now, whenever I try to login with the user "root", entering the password also entered in the connect.php file, I always get the same error message again:

#1045 - Access denied for user 'pma'@'localhost' (using password: NO)

Why do I cannot login with the username "root" and the password (is also entered in the file connect.php (Task6A-1), this file is displaying nicely in my browser???
I entered a username and a passowrd here:
$link_id = mysql_connect("localhost", "root", "password"winking smiley;
It worked, got the message "Connected to the MySQL server successfully and displaying all available databases including "registration"

The XAMPP status then says: MySQLdatabase deactivated.

Please let me know what to do - I already checked the MySQL online documentation but cannot find a solution -.

Without being able to access the database I cannot continue with the final prac.

THANKS IN ADVANCE FOR YOUR SUPPORT!

Kind regards,
Iris
confused smiley Re: Help please - final prac - login error for mySQL after editing user with phMyAdmin
September 28, 2008 08:17PM
I don't think it is a good idea to use the PMA user for your application as it is used by the phpMyAdmin application.

See the following link how and where to change the password for "pma"

http://robsnotebook.com/xampp-additional-passwords

Hope this helps.
avatar
Mac
confused smiley Re: Help please - final prac - login error for mySQL after editing user with phMyAdmin
September 29, 2008 06:51AM
Always create a new user for every database. Also reload the priveleges (on the front page, while restarting mysql ia also suggested)
Thank you all for your replies. Still I need help.

Unfortunately, I could enter phpMyAdmin yesterday entering username pma and no password. Very bad, I cancelled the user pma. I also created a 3rd user with privilege "select". I did the reload of the privileges and then I rebooted the system, starting then XAMPP (includes Apache and MySQL) again.

But still I cannot log in with neither user - also not "root".

Can I do something like a reset?

Without being able to enter phpMyAdmin I cannot work on the database "registration" for the final prac.

Thanks for any kind of hint and support.

Iris

NS Thanks jklopper for the link, this is indeed interesting.
avatar
Mac
confused smiley Re: Help please - final prac - login error for mySQL after editing user with phMyAdmin
September 29, 2008 12:04PM
I'm afraid you'll have to google for a solution - this is an XAMPP issue. Maybe uninstall and reinstall is the best way forward. Just make a back-up of your files in the htdocs directory.
eye popping smileyeye popping smileyeye popping smileyNO MORE XAMPPeye popping smileyeye popping smileyeye popping smiley

Hi Mac,
now I have uninstalled XAMPP. I rebooted my computer and then reinstalled XAMPP Version 1.5.5 which I got from UNISA CD:
I unpacked the package to c:\, before I copied the htdocs folder to another place. After c:\xampp was there I copied htdocs into this directory.
Then I started “setup_xampp.bat” – then “apache_start.bat” –
The last step – I started “mysql_start.bat” getting the following error message:
************************
…
MySQL is starting with mysql\bin\my.cnf (console)
Can’t start server: Bind on TCP/IP port: no such file or directory
080929 14:50:14 [ERROR] Do you already have another mysqld server running on port: 3306?
080929 14:50:14 [ERROR] Aborting
080929 14:50:14 [Note] mysql\bin\mysqld: Shutdown complete

My SQL could not be started


I entered http://localhost in my browser getting another error message:
Server error!
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script.
If you think this is a server error, please contact the webmaster.
Error 500
localhost
09/29/08 14:57:13
Apache/2.2.3 (Win32) DAV/2 mod_ssl/2.2.3 OpenSSL/0.9.8d mod_autoindex_color PHP/5.2.0


Now, what can I do – without XAMPP I cannot work. To google for a solution is difficult now since I do not really know what to look for???

Please help!

Thanks & regards,
Iris
confused smiley Re: Help please - final prac - login error for mySQL after editing user with phMyAdmin
September 29, 2008 06:53PM
Check your services under control panel admin tools if you have more than one mysql server running, if so change the incorrect one to startup manually.
Just now I installed the new XAMPP-version 1.6.8 from the website
Apache Friends

The XAMPP control panel was telling me that Apache and MySQL are running - one mysql server on port 3306.

But when entering http://localhost I get an error message:

Forbidden

You don't have permission to access /xampp/index.php on this server.

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
Apache/2.2.9 (Win32) DAV/2 mod_ssl/2.2.9 OpenSSL/0.9.8i mod_autoindex_color PHP/5.2.6 Server at localhost Port 80

Cannot find a solution on the Apache Friends website???

?????????????????????????????????????????????????????????????

What can I do???

Iris
confused smiley Re: Re: Help please - final prac - login error for mySQL after editing user with phMyAdmin
September 29, 2008 07:08PM
You can also run NETSTAT -abno in the command line to see what app is running on port 3306 if any.
Good morning jklopper,
thanks for your hint.
To be honest, I do not know what you mean:
What is NETSTAT and where can I find it?

Anyhow, I realized that the Apachefriends Website has some good information, I will go on trying to find a solution there. I mention the links just in case any other student has problems:

Windows:
http://httpd.apache.org/docs/2.0/platform/windows.html

Support:
http://httpd.apache.org/docs/2.0/faq/support.html

Log files:
http://httpd.apache.org/docs/2.0/logs.html

A nice day to all of you
Iris
avatar
Mac
confused smiley Re: Help please - final prac - login error for mySQL after editing user with phMyAdmin
September 30, 2008 07:45AM
Have a look in your services http://www.mvps.org/winhelp2002/services.htm
It may be that the previous XAMPP uninstall did not delete the apache and mysql services. There should only be one apache and one mysql service. In fact, one should rather not install apache and xampp as services. Disable the apache and mysql services, or better, delete them. http://windowsitpro.com/article/articleid/15158/how-do-i-delete-a-service.html

The reinstall, and don't choose to install apache and mysql as a service. From the XAMPP control panel, when you start apache and mysql, also do not tick the service box.

I would suggest you post your errors to the apache friends website if this does not work.
Good news

Everything is fine now.

Let me tell you what I did:

1. I made a system recovery by choosing one of these recovery points offered by Windows

2. I copied the subfolder 'exercises' from c:\xampp\htdocs to another place

2. Then I unistalled XAMPP - for all versions not offering an unistall file you simply delete c:\xampp, when uninstall.exe is offered in c:\xampp you use this

3. Then I reinstalled XAMPP directly from the Apachefriends site http://www.apachefriends.org/en/xampp-windows.html using the installer
- I did not change any of the proposed settings offered by the installer
(no service installed)

4. I copied the subfolder 'exercises' back into the c:\xampp\htdocs

5. I entered http://localhost into my browser

6. The welcome page of XAMPP appeared

This time I have not entered a password neither for the XAMPP directory nor for MySQL superuser 'root'. Whenever I did that I could not enter phpadmin although restarting MySQL - is this ok Mac?

Thanks for all the support!

Have a nice day
Iris
avatar
Mac
confused smiley Re: Help please - final prac - login error for mySQL after editing user with phMyAdmin
October 02, 2008 07:50AM
The XAMPP server is on your computer, so only you have access too it so no passwords required.
Anyone who is still struggling with loading phpmyadmin? Well i've discovered a very easy solution to this open the config.inc.php under phpmyadmin folder, then change the

$cfg['Servers']['$']['auth_type'] = config (to http)

and everything should work just fine. Its safe & secure.

And if not let me know.
amamogale@yahoo.com
confused smiley Re: Help please - final prac - login error for mySQL after editing user with phMyAdmin
October 08, 2008 04:49PM
Good Day

No worries guys, I can delete courses and students from the database but for some reason broke everything again now I cannot edit or add records ... lol

but i guess I will get it up again.

Almost done though...once I fix that I think I should be good.

Regards

Justin Leaf-Wright
[url=http:// www.leafydesignz.co.za]
www.leafydesignz.co.za[/url]

hot smiley
avatar
Mac
confused smiley Re: Help please - final prac - login error for mySQL after editing user with phMyAdmin
October 08, 2008 05:15PM
And don't ask me to tell you what you're doing wrong smiling smiley Suffer, PHP programmer smiling smiley

It's probably a silly mistake somewhere WHICH I MYSELF DO TO THIS DAY... GRRRRRRRRRRRRRRRRRRRRRRRRRRR!!!!!!!!!!!!!!!

So if you are nice, then you post your errors and fixes here so other can learn!
Re: date for submission of practical project?
October 27, 2008 12:04PM
Why is everybody so quiet about the prac? am I the only one who is struggling smile?
can anybody please tell em when the prac must be handed in. I cannot lay my fingers on a document saying thet this morning. Please tell me.
avatar
Mac
confused smiley Re: Help please - final prac - login error for mySQL after editing user with phMyAdmin
October 27, 2008 12:48PM
9 november
Anonymous User
Re: date for submission of practical project?
October 27, 2008 01:10PM
Bothajar: no you are not the only one struggling with the prac.

For a basic course this prac is indeed difficult.
What about you, the other students?

I really hope I will be able to manage the tasks but these days I am not sure.

Iris
somehow desperate
confused smiley Re: Help please - final prac - login error for mySQL after editing user with phMyAdmin
October 27, 2008 09:39PM
Hi guys,

I have a few questions regarding the prac:

1. When editing a student, should you be able to edit the course he/she is registered for?

2. If yes, how do you control that the new course that you insert does exist?

3. When deleting a course, what happens if a student is already registered for that specific course? Should there be some control to check if a student is registered for that course that you are not allowed to edit it?

I would really appreciate your help!

Noelle
confused smiley Re: Re: Help please - final prac - login error for mySQL after editing user with phMyAdmin
October 28, 2008 12:24AM
'Why is everybody so quiet about the prac? am I the only one who is struggling'

no you are certainly not the only one, still a few issues i'm not sure of at all.
would be happy if i could figure out how to get the data to the studentcourse table. some hints from Mac re this issue but i still have'nt figured out how to implement it:

$cname= mysql_result($mail,$i,'cname'winking smiley;
$cid= mysql_result($mail,$i,cid);
.....
echo "<OPTION value='$cid>$cname</OPTION>";


got most of the layout sorted but still need to work on some of the details!
either everyone else got the whole thing sorted or not doing it!

as to your question Noelle,

'1. When editing a student, should you be able to edit the course he/she is registered for?'

presumably, editing student details should also allow for the editing of this field. i'm hoping to call up a reg form with all the fields filled (as though you've just filled it out) but now you're able to change any of the fields that need changing. i can't think of another way to edit student details (??)

'2. If yes, how do you control that the new course that you insert does exist?'

in the same way that you filled the dropdown list with courses which exist in the course table. i.o.w. the options in the dropdown show only whats available in the course table.

'3. When deleting a course, what happens if a student is already registered for that specific course? Should there be some control to check if a student is registered for that course that you are not allowed to edit it?'

i'm still having some problem with the editing of course table (the only thing you can edit is the course name, which seems to be the same as adding/deleting a course). i suspect we're not supposed to get too caught up in those details (like whether students, who can enter student details into the student table, also have access to the other tables). of course, i could be horribly mistaken!! but as Mac has pointed out before, there are more efficient ways to set up this database

anyway, i'll just be happy if i can get the main issues to work by the 9th!
so now, anyone have any more helpful hints on getting the cid & the sno to the student_course table?

tristan
avatar
Mac
confused smiley Re: Help please - final prac - login error for mySQL after editing user with phMyAdmin
October 28, 2008 07:52AM
I will give you a view of some efforts, all with varying levels of functionality, ideas etc. Some have marked errors, others not. Have a look at http://osprey.unisa.ac.za/mac/712. There are some pages that is not required (contact us and about us) and some other facilities (news, login page) that you should just ignore.Visual appearance is not important (this is not a HTML course) but of course there needs to be some sens eof order.

The one serious flaw with this example (and some examples lower down, which I find year after year) is that whenever you do anything, you don't get immediate feedback - for example, if you edit a student's details and you click the update button, the old detail appears! Your immediate impression is the information was not updated. But when you regenerate the student list, you actually see the information was updated!!!

Play around here (add, delete information) and see if you can pick up the logic.

You should also see things you could possible better - for example, if I add a course there is no feedback that the course was added - one has to generate the course list to see if it was successfull, which is not very user friendly. It's just an echo "The following course was added: $course"; (and perhaps a link "Add another course" just to make it easy for the user)

On the Manage student page, he has a course field (that is thankfully empty) for here you just manage students' personal information.

Then he has a link to View Registrations. When one sees the list of students registered for a course (you may first have to add a student or two), there is no option to delete a student's association with this course (deregistering him). It is here where the associations between students and the courses they have registered for should be managed. The Registration page adds associations - this page shows associations, and allows you to delete associations.

The Q from here above is a good one: When deleting a course, what happens if a student is already registered for that specific course? Should there be some control to check if a student is registered for that course that you are not allowed to edit it?'

Quite correct - you should not be able to delete a course if students are registered for it. It is not a difficult check, however - you have the course name and its cid. You add the cid to the delete link (as an example)
<a href='delete.php?cid=$cid>Delete $course</a>

On the delete page, you go and see if this cid exists in the student_course db.

$cid=$_GET['cid'];
$current_registrations=mysql_query("SELECT * FROM registration.student_course WHERE cid='$cid'"winking smiley;
$rows = mysql_numrows($current_registrations);
if($rows > 0) {
echo "Warning! There are students registered for this course! First delete the student and course associations before attempting to delete this course. Click <a href=whateverpage.php>here</a> to view student and course associations";
}
else {
//delete course
}

What this student did which is a no-no is to NOT include a single page with the db connection details, which meant I had to go and change those details on every single page - grrrrr!

OK, now have a look at http://osprey.unisa.ac.za/mac/718

Go Manage Students, and choose to edit one. I can edit his course - should I? No -here I just edit personal information. Under View Registrations, I should be able to delete assocations, as explained here above.. But here no course name appears to show me which course the student has registered for! And a lot of information that I do not need to see like gender, date of birth etc - I simply want a student number, a name, surname, year, course name....

Then see http://osprey.unisa.ac.za/mac/719/admin.php
and

http://osprey.unisa.ac.za/mac/709

and

http://osprey.unisa.ac.za/mac/700


Point I want to make is this - play with these four and ask yourself what is working well, what can be bettered, and how can I make it better?

The above efforts are not necessarily bad all together- in fact, they also serve as good examples of what is right! You should be able to see which one works best. It is no use I provide you with a perfect example...... and I haven't had one yet smiling smiley
avatar
Mac
confused smiley Re: Help please - final prac - login error for mySQL after editing user with phMyAdmin
October 28, 2008 09:28AM
> so now, anyone have any more helpful hints on getting the cid & the sno to the student_course table?

Let us assume a student completes a form with his personal details, whilst at the same time choosing a course (it does not have to be on the same form - he can register his personal details, then get a student number, which he then uses to register for a course on another page).

The options are like this
<select name=cid_chosen>
// below is in the loop
echo "<OPTION value='$cid>$cname</OPTION>";
echo "<OPTION value='$cid>$cname</OPTION>";
echo "<OPTION value='$cid>$cname</OPTION>";
</select>

which is really the following should you hard code it in HTML (assuming this is the first three courses in the db)

echo "<OPTION value='1'>Course A</OPTION>";
echo "<OPTION value='2'>Course A</OPTION>";
echo "<OPTION value='3'>Course A</OPTION>";

So if a student selects Course A, on the next page that the form points to
( <form action=register_student.php method=POST> )
you need to catch the value of his choice (Course A), which was sent with the form.

So on the next page, I get
$cid_chosen=$_POST['cid_chosen'];
which gives me the cid for the course the student has selected.
But I do not have a sno yet, so I need to add the student to the student db in order to obtain a sno, not so?

So I add the student to the db with INSERT, and once he is added, I immediately thereafter do a SELECT query to get his sno.

This SELECT query can be done in numerous ways.

You may want to include all that was sent with the form in the WHERE clause, as in
SELECT sno FROM student WHERE sname='$sname' and fname='$fname' etc to make sure you have the correct student (2 students can share the sane name and sname, so the more you include in the WHERE statement, the less likely it is). But why do you want to do all that when we have his id number, which is as individual as a fingerprint?

So SELECT sno FROM student WHERE idno='$id is used to find the sno.

So now you have the sno and the cid, which you just insert into student_course db, right after the select query here above. So you have
INSERT student details into student
SELECT to get the sno generated here above
INSERT sno and cid into student_course.

right after one another
confused smiley Re: Re: Help please - final prac - login error for mySQL after editing user with phMyAdmin
October 28, 2008 01:11PM
I think we're all struggling with something.

Believe it or not I'm struggling with a stupid date format. For the student dob I have three dropdown boxes, one for the year, month and day. Do you think that I can get any of the months or days to reflect leading Zeros or to pass the leading zeros to the next page? Driving me insane.

Anyways, found some code on Google this morning. Just want to get home now and try it out so this day is dragging. Holding thumbs that it works and I can get past the stupid date.
confused smiley Re: Help please - final prac - login error for mySQL after editing user with phMyAdmin
October 28, 2008 09:17PM
Thank you comrades in the struggle of PHP smile I have been struggling with the same problems as you and I thought I was just not capable smile Anyhow thank you for your comments and also to Mac for some constructive guidance. I must admit I was fast loosing hope and considered giving up because it was far too time consuming during a very busy period at work. Perhaps I will make some progress again now.

Best wishes

Johan
confused smiley Re: Help please - final prac - login error for mySQL after editing user with phMyAdmin
October 28, 2008 09:35PM
thank you Mac for your hints, i will defnitely take a look at the examples.

to answer tristan, i use the mysql_insert_id() function to retrieve the last inserted id (sno) that was inserted into the student table. i then have another query that inserts the last inserted sno into the student_course table.

eg. //my first query
$query1 = "INSERT INTO student VALUES(//all my values that i posted to this page from my form)";
$result......

//then i create a variable for my last inserted sno
$last_inserted = mysql_insert_id();

//then for my second query
$query2 = "INSERT INTO course_student VALUES('$last_inserted','$cid....'winking smiley";
$result2....

i then have a last question: what is the year field in the student_course table, and where do i get it from?
thanks!
avatar
Mac
confused smiley Re: Help please - final prac - login error for mySQL after editing user with phMyAdmin
October 29, 2008 06:41AM
Date drop down drop gorgeous http://www.javascriptkit.com/script/script2/curdateform2.shtml

Well done noelle with the advanced last inserted function - it is not easy to know that such functions exist. But the "advanced" lesson learned here is that if you want to achieve something, always look first if a function does not exist that already does that for you.....

The year is the year in which the student registered. You can use the date function of php.
confused smiley Re: Re: Help please - final prac - login error for mySQL after editing user with phMyAdmin
October 29, 2008 09:22AM
Quote
mac
Date drop down drop gorgeous [www.javascriptkit.com]

Thanks Mac.
Figured out yesterday though that by using "date("d.m.Y",strtotime......" I don't need the leading zero's because it automatically adds them in when converting to a date format. Wasted so much time on something which turned out to be small and insignificant. Oh well, such is life.
confused smiley Re: Help please - final prac - login error for mySQL after editing user with phMyAdmin
October 29, 2008 09:19PM
Maybe I understand wrongly. I was under the impression that we had to get the courses in the drop down list from the course table by using php. It seemed to me that all people were trying to solve the problems of how to deal with the drop down list as one of the primary problems. But now it seems to me that we are supposed to hard code the courses in HTML. Seems to me that is what was done in all examples too. If that is the case we have all wasted valuable time.What are we supposed to do?
The answer to Noelles question for the year is good to see although I already asked for it Oct 20???!!!
- see the thread: Problem in setting the relation of course_student to the other tables - the last question related to the year in this table.....

Iris
Sorry, only registered users may post in this forum.

Click here to login