Web Hosting Talk







View Full Version : MySQL & phpMyAdmin


_plAsma
07-24-2004, 05:04 PM
Hi, is there anyway to, in phpMyAdmin choose a value to be automatically created one number higher than the one before? Sorry if i am bieng confusing.
Basically, when records are created i want a number generated automatically like

0001
0002
0003
0004
0005
...etc


Another thing i was wondering about is if there is a script to automatically create an email forwarder from a site for cPanel 9. eg. A user enters their current email adres and the alias they wanted on the site in a form and a email forwarder is automatically created for them.

Thanks.
_plAsma :D

MGCJerry
07-24-2004, 05:15 PM
I can help with the first problem, but not the second. MySQL can do this with having a field set with "auto_increment"... Just make sure the scipt doesnt insert anything into that field. MySQL will do it automatically.

_plAsma
07-24-2004, 05:18 PM
Thanks! :D

_plAsma
07-24-2004, 05:38 PM
How do i do this phpMyAdmin? What field type should i use?
I always get this error:

#1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'NOT NULL AUTO_INCREMENT FIRST' at line 1

Or error #1063

Burhan
07-25-2004, 04:08 AM
Auto increment fields must be defined as primary keys.

CREATE TABLE `foo` (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY);

etc.

feras
07-25-2004, 04:34 PM
yea, i believe what fyrestrstr said is right

Pap
07-25-2004, 06:03 PM
If the user logs into his e-mail account via the web interface at (sorry, I can't post URLs yet) "domain dot com forward-slash webmail", then there is an option to set up forwarding right there at the bottom.

If you are talking about the owner of the cPanel account,then all you have to do is log into cPanel and click on Mail, and forwarding will be listed there.