Page 1 of 1
a few n00b questions
Posted: Fri Mar 26, 2004 10:31 am
by Mendes
first things first..
1. to redirect someone to a different page say if and if statement is true what is the best method?
header("Location: page.php");
the above is what i found in one of the tutorials is that the best way?
2. if i want to have a kill script that erases all information in my database what is the best way?
$del = "DELETE * FROM database"
$kill=mysql_query($del);
?
is that the best way.
3. are cookies the best/only way to automatically log somone in when they return to my site?
Thanks in advance!
Posted: Fri Mar 26, 2004 10:39 am
by patrikG
1. yes, but have a look at HTML Metatags. Forwarding in javascript can also be handy. It does depend on the situation/application
2. to delete a table write "DROP TABLE tablename"
3. They are a convenient and, on the internet, the only way (to my knoweldge). If there are other ways, I'd love to hear about them.
moved to PHP - Code, btw.
Posted: Fri Mar 26, 2004 11:02 am
by Mendes
patrikG wrote:1. yes, but have a look at HTML Metatags. Forwarding in javascript can also be handy. It does depend on the situation/application
2. to delete a table write "DROP TABLE tablename"
3. They are a convenient and, on the internet, the only way (to my knoweldge). If there are other ways, I'd love to hear about them.
moved to PHP - Code, btw.
Thanks. I do not want to delete the table just the information stored in it.
Posted: Fri Mar 26, 2004 11:04 am
by patrikG
use "TRUNCATE tablename"
Posted: Fri Mar 26, 2004 11:22 am
by Mendes
patrikG wrote:use "TRUNCATE tablename"
and that will totally clear out everything and leave me with an empty table? no fields period right?
Thanks a lot!
Posted: Fri Mar 26, 2004 11:28 am
by patrikG
Yup.

Posted: Fri Mar 26, 2004 4:26 pm
by tim
TRUNCATE will also set an auto_increment column to zero, if anyone cared. lol

Posted: Fri Mar 26, 2004 4:32 pm
by Illusionist
Mendes wrote:no fields period right?
patrikG wrote:yup
by fields do you mean the column names,right? So it just leaves a blank table in the database? So it would be the same as deleting the whole table and making a new one with the same name?
Posted: Fri Mar 26, 2004 4:46 pm
by markl999
Yeah.
http://www.mysql.com/doc/en/TRUNCATE.html pretty much covers the ins and outs of it.
Posted: Fri Mar 26, 2004 5:01 pm
by Illusionist
ahh! ok, thanks!!