Your HostICan Community  


Go Back   Your HostICan Community > Programming & Design > PHP / MySQL Assistance

PHP / MySQL Assistance We understand. Not all of you are experienced programmers, but some of you are highly skilled at coding. So we've set aside this forum so you can ask questions, and provide answers to the most commonly asked PHP / MySQL issues.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-17-2008, 05:35 AM
Junior Member
 
Join Date: Mar 2008
Posts: 20
Exclamation flush database

Hi there,

1. I have connected mysql db using php (for my register form) but I cannot see the results displayed in my database.

2. I tried to flush my database but I get this message:
#1227 - Access denied; you need the RELOAD privilege for this operation.

I am the only user and I have all privilages.

What do I have to do?

Thanks
Reply With Quote
  #2 (permalink)  
Old 04-17-2008, 09:06 AM
lnxcode's Avatar
The British Kid
 
Join Date: Sep 2007
Location: Richmond, VA
Posts: 1,772
Send a message via AIM to lnxcode Send a message via Skype™ to lnxcode
Default

Quote:
Originally Posted by Pavlos1316 View Post
Hi there,

1. I have connected mysql db using php (for my register form) but I cannot see the results displayed in my database.

2. I tried to flush my database but I get this message:
#1227 - Access denied; you need the RELOAD privilege for this operation.

I am the only user and I have all privilages.

What do I have to do?

Thanks
What you should do is login to your cPanel and check that you have ALL privileges as it seems you don't, thats the only thing it could be.
__________________
Thanks,

Denis Motova
Affiliate / Operations Manager

HostICan Answers | HostICan Newsletter | HostICan Blog | Become a HostICan Affiliate | Create a Support Ticket.
Reply With Quote
  #3 (permalink)  
Old 04-17-2008, 09:58 AM
Junior Member
 
Join Date: Mar 2008
Posts: 20
Default

Hi

Thanks but I did that 5 times to be sure before sending a post for help.
It seems I have to ask host-i-can directly.
Thank you anyway.

Something else... Mysql database gives me a limit of 255 IDs. Is there a way to increase this number or I must creating a new db every time after the 255 ID?

If there is a way it would be much help for me because I will need a big db.

Thank you again
Reply With Quote
  #4 (permalink)  
Old 04-17-2008, 02:00 PM
lnxcode's Avatar
The British Kid
 
Join Date: Sep 2007
Location: Richmond, VA
Posts: 1,772
Send a message via AIM to lnxcode Send a message via Skype™ to lnxcode
Default

Quote:
Originally Posted by Pavlos1316 View Post
Hi

Thanks but I did that 5 times to be sure before sending a post for help.
It seems I have to ask host-i-can directly.
Thank you anyway.

Something else... Mysql database gives me a limit of 255 IDs. Is there a way to increase this number or I must creating a new db every time after the 255 ID?

If there is a way it would be much help for me because I will need a big db.

Thank you again
I really dont understand what you are talking about with the ID 255? Sorry...

Are you trying to import a db via shell? If so, you can do this via shell pretty easily...just look in the hostican kb, and you should be all set.
__________________
Thanks,

Denis Motova
Affiliate / Operations Manager

HostICan Answers | HostICan Newsletter | HostICan Blog | Become a HostICan Affiliate | Create a Support Ticket.
Reply With Quote
  #5 (permalink)  
Old 04-17-2008, 02:54 PM
Junior Member
 
Join Date: Mar 2008
Posts: 20
Exclamation

hi

1st about the id.
I create from cpanel a mysql db which gives automaticaly ID values. When i am going to set the max number of IDs to be taken it limits me to 255.

Now for the privileges.
I go to mysql databases fron cpanel, i click my username and all the privilleges are on.
Then I open phpmyadmin where I can see my database. As I noticed there, in someplace it says no privileges with red letters. Are these privileges diffrent from my db privileges?? If yes how do I change them? Am I skipping something?

Thank you
Reply With Quote
  #6 (permalink)  
Old 04-18-2008, 11:58 AM
lnxcode's Avatar
The British Kid
 
Join Date: Sep 2007
Location: Richmond, VA
Posts: 1,772
Send a message via AIM to lnxcode Send a message via Skype™ to lnxcode
Default

Hey,

1. Yes, that sounds right, I don't know too much about how cPanel structure the MySQL integration (sorry).... but I think 255 is the absolute max.

2. Yes, that is because cPanel has coded the feature to control all the permissions from cPanel directly, thus phpmyadmin doesn't have the ability to do this... by itself
__________________
Thanks,

Denis Motova
Affiliate / Operations Manager

HostICan Answers | HostICan Newsletter | HostICan Blog | Become a HostICan Affiliate | Create a Support Ticket.
Reply With Quote
  #7 (permalink)  
Old 04-18-2008, 04:47 PM
Junior Member
 
Join Date: Mar 2008
Posts: 20
Default

Thanks mate
Reply With Quote
  #8 (permalink)  
Old 04-19-2008, 12:31 PM
lnxcode's Avatar
The British Kid
 
Join Date: Sep 2007
Location: Richmond, VA
Posts: 1,772
Send a message via AIM to lnxcode Send a message via Skype™ to lnxcode
Default

Quote:
Originally Posted by Pavlos1316 View Post
Thanks mate
Glad I was able to assist you.
__________________
Thanks,

Denis Motova
Affiliate / Operations Manager

HostICan Answers | HostICan Newsletter | HostICan Blog | Become a HostICan Affiliate | Create a Support Ticket.
Reply With Quote
  #9 (permalink)  
Old 04-19-2008, 02:29 PM
Junior Member
 
Join Date: Mar 2008
Posts: 20
Exclamation

I hope you keep doing it!!!

Here is my code:

//Connect to database
mysql_connect ($dbhost, $dbuser, $dbpass)or die("Error: " .mysql_error());
mysql_select_db($dbname) or die(mysql_error());
$Full_Name=$_Post['Full_Name'];
$Birthday=$_Post['Birthday'];
$Phone_No=$_Post['Phone_No'];
$E_mail=$_Post['E_mail'];$
Mail=$_Post['Mail'];
$Username=$_Post['Username'];
$Password=$_Post['Password'];

$checkuser=mysql_query("SELECT Username FROM Register WHERE Username='$Username'");
$Username_exist=mysql_num_rows($checkuser);
if($Username_exist>0){
echo "Username Already Registered!";
unset($Username);
include 'register.html';
exit();
}

$query="INSERT INTO Register (ID, Full_Name, Birthday, Phone_No, E_mail, Mail, Username, Password) VALUES ('NULL','$Full_Name','$Birthday','$Phone_No','$E_m ail','$Mail_Adrdress','$Username','$Password')";

mysql_query($query) or die(mysql_error());mysql_close();
echo "Registration Successful!";

OK here is the problem.

When I test my registration form for 1st time I get: Registration successful. But in mysql db (throught control panel) I have only blank fields exept for ID field.

Then when I try my form for second or third time and so on I always get: Username allready registered!!!!!

Have you anything to suggest?

Thank you
Reply With Quote
  #10 (permalink)  
Old 04-25-2008, 02:23 PM
itwasntme's Avatar
Senior Member
 
Join Date: Sep 2007
Posts: 120
Default

Quote:
Something else... Mysql database gives me a limit of 255 IDs. Is there a way to increase this number or I must creating a new db every time after the 255 ID?
You need to set the data type of your ID field to "int" for up to 99999999999 unique ID's, or even "bigint" for even more. Then set the "extra" parameter to auto_increment if it isn't already. That will solve your problem with the limit of 255 on the ID's.

Once you have made those changes to your DB, you can leave the ID field out of your INSERT query, as MySQL will handle it automatically. For example, your new query would be:

Code:
$query="INSERT INTO Register (Full_Name, Birthday, Phone_No, E_mail, Mail, Username, Password) VALUES ('$Full_Name','$Birthday','$Phone_No','$E_m ail','$Mail_Adrdress','$Username','$Password')";
As for your code problem, are you giving us all your code? if so, the reason all the fields but the ID are empty in the DB is that you haven't POST'ed the values to your script and haven't got code to set the variables prior to the INSERT query (unless that is done in register.html, which should be named register.php if it has PHP in it...). Thus, all you add to the DB is empty values. As a result, when the code runs the second time, there is already a user in there with an empty user name and you get a "Username already registered" message.

By the way, make sure you incorporate some code to validate the POST variables or you are leaving your site wide open for a SQL injection attack. You might also add some code to handle magic quotes, which are usually enabled.

You can Google for sample of PHP from handling that will give you some good examples of how to handle what you are attempting, just make sure the ones you use include the validation and security measures I mentioned above.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -4. The time now is 08:48 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

Copyright © 2003 - 2008 HostICan. All Rights Reserved.