Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

profile script!

Codes here !

Moderators: macek, egami, gesf

profile script!

Postby php-punk » Thu Jul 03, 2003 1:29 pm

right i have made a profile script for the reviews on my website, i got most of it working, up untill the user wants to update the profile CODE:

Code: Select all
<center><iframe frameborder=0 src="" width="120"
height="60" target="_blank" scrolling="no"> </iframe></center>

$c = mysql_connect("localhost","","") or die(mysql_error());
$db = mysql_select_db(punk_style_to_j_com);
$query_Recordset1 = "SELECT * FROM users WHERE user='$user'";
$Recordset1 = mysql_query($query_Recordset1,$c) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="pragma" content="no-cache">

<body bgcolor="#0099FF">
<p><img src="" width="144" height="139">


<p><B><font color=\"#FFFFFF\">Name</font> :-: <?php echo $row_Recordset1['user']; ?></B></p>
<p><B><font color=\"#FFFFFF\">Position</font> :-: <?php echo $row_Recordset1['posit']; ?></B></p>
<p><B><font color=\"#FFFFFF\">Age</font> :-: <?php echo $row_Recordset1['age']; ?></B></p>
<p><B><font color=\"#FFFFFF\">From</font> :-: <?php echo $row_Recordset1['lives']; ?></B></p>

<p><b>More about <? $user ?></B><br>
  <b><font color=\"#FFFFFF\">About Me</font> :-: <?php echo $row_Recordset1['about']; ?></B></p>
<p><B><font color=\"#FFFFFF\">My hobbies/interests </font> :-: <?php echo $row_Recordset1['hobbies']; ?></B></p>
<p><B><font color=\"#FFFFFF\">Profession/studying</font> :-: <?php echo $row_Recordset1['study']; ?></b><br>
  <strong>Some of the things <? $user ?> likes</B></strong><br>
  <B><font color=\"#FFFFFF\">Food</font>:-:<?php echo $row_Recordset1['food']; ?> </B><br>
  <B><font color=\"#FFFFFF\">Music</font> :-: <?php echo $row_Recordset1['music']; ?></B><br>
  <B><font color=\"#FFFFFF\">TV Shows</font> :-: <?php echo $row_Recordset1['tv']; ?></b><br>
  <B><font color=\"#FFFFFF\">Movies</font> :-: <?php echo $row_Recordset1['movie']; ?> </B><br>
  <B><font color=\"#FFFFFF\">Clubs</font> :-: <?php echo $row_Recordset1['venue']; ?></B><br>
  <B><font color=\"#FFFFFF\">Restaurant</font> :-: <?php echo $row_Recordset1['rest']; ?></B><br>
  <B><font color=\"#FFFFFF\">Place</font> :-: <?php echo $row_Recordset1['place']; ?></B><br>
  <B><font color=\"#FFFFFF\">Possession</font> :-: <?php echo $row_Recordset1['poset']; ?></B><br>

case yes:
         $c =mysql_connect("localhost","","") or die(mysql_error());
         $db =mysql_select_db(punk_style_to_j_com);
      UPDATE `users` SET `pw` = '$_POST[pw]',
      `name` = '$_POST[name]',
      `posit` = '$_POST[posit]',
      `lives` = '$_POST[lives]',
      `about` = '$_POST[about]',
      `study` = '$_POST[study]',
      `food` = '$_POST[food]',
      `music` = '$_POST[music]',
      `tv` = '$_POST[tv]',
      `movie` = '$_POST[movie]',
      `venue` = '$_POST[venue]',
      `rest` = '$_POST[rest]',
      `place` = '$_POST[place]',
      `poset` = '$_POST[poset]' WHERE `user` = '$_GET[user]' LIMIT 1") or die(mysql_error());
      $c =mysql_connect("localhost","","") or die(mysql_error());
      $db =mysql_select_db(punk_style_to_j_com);
      $query = "SELECT * FROM users WHERE user='$user'";
      $result = mysql_query($query)  or die(mysql_error());
      $row = mysql_fetch_assoc($result);?>
      <form name="profile" action="<? $user ?>&&submit=true" method"post">
      echo("username: ".$row['user']);
      echo("password: <input type=\"text\" name=\"pw\" value='".$row['pw']."'>");
      echo("Where do you live: <input type=\"text\" name=\"lives\" value='".$row['lives']."'>");
      echo("About you: <input type=\"text\" name=\"about\" value='".$row['about']."'>");
      echo("What ya Studying? <input type=\"text\" name=\"study\" value='".$row['study']."'>");
      echo("Fave Food <input type=\"text\" name=\"food\" value='".$row['food']."'>");
      echo("Fave Music Style <input type=\"text\" name=\"music\" value='".$row['music']."'>");
      echo("Fave TV Show <input type=\"text\" name=\"tv\" value='".$row['tv']."'>");
      echo("Fave Movie<input type=\"text\" name=\"movie\" value='".$row['movie']."'>");
      echo("Fave Venue: (The valley will not be accepted!) <input type=\"text\" name=\"venue\" value='".$row['venue']."'>");
      echo("Fave Restaurant - So i no where to ask you out to ;P <input type=\"text\" name=\"rest\" value='".$row['rest']."'>");
      echo("Fave Place<input type=\"text\" name=\"place\" value='".$row['place']."'>");
      echo("Fave Possesion<input type=\"text\" name=\"poset\" value='".$row['poset']."'>");
      echo("<input type=\"submit\" Value=\"Yo, Send Me Shichz\">");

any help would be grateful appreciated!!

New php-forum User
New php-forum User
Posts: 60
Joined: Sun Feb 02, 2003 2:10 am
Location: Leeds, Uk

Postby Redcircle » Thu Jul 03, 2003 1:37 pm

yuckie yuckie!! What tutorial did you steal that code from (no offense if it's yours.)

on your submit button you need to name the button.
User avatar
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA

Return to mySQL & php coding

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.