PDA

View Full Version : 2 simple questions


weronpc
04-08-2003, 04:18 PM
I have 4 questions with mysql

1, how do I use mysql_create_db() to create a database and assign username and password to it? can you give me an example on how to create and drop a database?

2, I know how to use mysql_fetch_rows(), but i don't know how msql_data_seek() works, can someone give me an example?

3, can someone show me how? When user inserted new info from a form, a page will say "insert completed", then maybe 3 or 4 seconds later it will automatically go to the view-data page. (Use timing to auto redirect page)

4, what is the different between single ' and double " ?

Thank you so much,

Mike

raf
04-08-2003, 07:30 PM
For 1, look here
http://www.php.net/manual/en/function.mysql-create-db.php
or here
http://www.mysql.com/doc/en/mysql_create_db.html
do some searching around here, or install phpadmin (you'll do that sooner or later ...
http://www.phpmyadmin.net/ )
For 2, look here
http://www.php.net/manual/en/function.mysql-fetch-row.php
For 3, use a redirect script in javascript (see below)
For 4, single is what you become if you start loving you machine to much :D . A double is a number with a comma in it. Single ? Doesn't exist in MySQL (as far as i know) and you'll find everything you need to know about data types (or column types) here
http://www.mysql.com/doc/en/Column_types.html


javascript redirect;
<form name="redirect">
<center>
<b>Congratulation. You are now registered and can start building your free webtest.</b><br/><br/><br/>
You will be redirected to the loginpage of the build-module in <br/><br/>
<form>
<input type="text" size="3" name="redirect2">
</form>
seconds
<br/><br/><br/>If you are not redirected or don't want to wait, click <a href="mb_logon.html" title="To the logon-form of the build-module">here </a>.
</center>

<script>
<!--

var targetURL="mb_logon.html"
var countdownfrom=5

var currentsecond=document.redirect.redirect2.value=countdownfrom+1
function countredirect(){
if (currentsecond!=1){
currentsecond-=1
document.redirect.redirect2.value=currentsecond
}
else{
window.location=targetURL
return
}
setTimeout("countredirect()",1000)
}

countredirect()
//-->
</script>

weronpc
04-08-2003, 09:25 PM
I still don't know how to create a database with username and password,

you know, when you connect to a database, you need to specify useranme and password (if there is any), but how do I create usrename and password so when I connect to it, I have to provide username and password?

Thank you

raf
04-08-2003, 09:34 PM
http://www.mysql.com/doc/en/Adding_users.html