Click to See Complete Forum and Search --> : Adding database info


Javajoob
05-16-2007, 08:02 PM
When you have a mySQL database running I believe with PHP you can make a code with sends new information to the database? Could anybody at least tell me where to look? Thabk you

scragar
05-17-2007, 05:54 AM
if you already have a connection to a DB(look here (http://uk.php.net/manual/en/function.mysql-connect.php) and here (http://uk.php.net/manual/en/function.mysql-select-db.php))then just running a simple insert query will be fine:
mysql_query("INSERT INTO tblName(feilds listed here...)
VALUES(values listed here in the same order as the feilds)");

Javajoob
05-17-2007, 01:36 PM
Thank you for that. Can I ask is there a way with PHP you can log the IP of somebody registering to your site and then add it to the database?

sae
05-17-2007, 05:18 PM
see this:

http://www.plus2net.com/php_tutorial/php_ip.php

then you just save $ip to your database. You would have to get this script to run everytime someone loaded the main page...possibly using a cookie to only do it the first time someone visits. Your database might become large very quickly though.