# Php Profile



## binsky3333 (Sep 12, 2008)

Hi,
I was just wondering how could i make a profile for users. I anlready kno how to create users and have them login but how can i make it so members can have profiles. Is there like an alreayd make php script that has that.


----------



## ZenZimZaliben (Sep 16, 2008)

Are asking to store user information? Like address, phone, quote of the day, that kind of stuff?


----------



## Disparia (Sep 16, 2008)

How do you set up users now? Database? Build off of that by adding fields/tables for the information you want to store.


----------



## Moose (Sep 17, 2008)

<?PHP

$username = "MYSQL USERNAME";
$password = "MYSQL PASSWORD";
$database = "MYSQL DATABASE";
$server = "localhost";

$db_handle = mysql_connect($server, $username, $password);
$db_found = mysql_select_db($database, $db_handle);

if ($db_found) {

$SQL = "SELECT * FROM TABLE TO INCLUDE";
$result = mysql_query($SQL);

while ($db_field = mysql_fetch_assoc($result)) {
print $db_field['FIELD TO INCLUDE'];
}

mysql_close($db_handle);

}
else {
print "Database NOT Found ";
mysql_close($db_handle);
}

?>

Use the script above to insert a MYSQL entry into your website replacing MYSQL USERNAME, MYSQL PASSWORD, MYSQL DATABASE, TABLE TO INCLUDE, FIELD TO INCLUDE, in the text above with you own stuff.


----------



## Moose (Sep 17, 2008)

<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST'){
	$content = $_POST['content'];

$username = "MYSQL LOGIN";
$password = "MYSQL PASSWORD";
$database = "MYSQL DATABASE";
$server = "localhost";

$db_handle = mysql_connect($server, $username, $password);
$db_found = mysql_select_db($database, $db_handle);


if ($db_found) {
$SQL = "UPDATE TABLE TO UPDATE SET FIELD TO UPDATE  = '$content'";

mysql_query($SQL);


mysql_close($db_handle);
}

}

?>



<FORM NAME ="form1" METHOD ="POST" ACTION ="PAGE NAME.php">

<textarea rows="5" cols="25" name="content" id="input_box">
<?php

$username = "MYSQL LOGIN";
$password = "MYSQL PASSWORD";
$database = "MYSQL DATABASE";
$server = "localhost";

$db_handle = mysql_connect($server, $username, $password);
$db_found = mysql_select_db($database, $db_handle);


if ($db_found) {

$SQL = "SELECT * FROM TABLE TO INCLUDE";
$result = mysql_query($SQL);

while ($db_field = mysql_fetch_assoc($result)) {
print $db_field['FIELD TO INCLUDE'];
}

mysql_close($db_handle);

}
else {
print "Database NOT Found ";
mysql_close($db_handle);
}
?>
</textarea>

<br><INPUT TYPE = "Submit" Name = "Submit1"  VALUE = "Submit">

</FORM>

Sorry for double post but here is some PHP I made to edit the table it includes the old version too for you to edit.


----------

