Error code... input field = database field
Posted: Wed Feb 08, 2006 9:39 pm
This post as been edited:
there are no more errors just that there it's not doing what i want it to read below...
and my code is:
What i'm trying to do is take info from the database and place it in the input fields. Example: say your username is dude and you log in as dude the $_SESSION[username] super is now dude you go over to your preferences and want to change your pick the <input type="file"> in the code above should have the value of the field in the database called "picture" and should only be the row where the username field in the database equals the $_SESSION[username] super, so that it's only your picture. If this makes any sence to you please post, if it doesn't??? Well just post anyway. lol...
Thanks for reading and all help is appreciated.
there are no more errors just that there it's not doing what i want it to read below...
and my code is:
Code: Select all
<?
$db_name = "dbname";
$table_name = "tbname";
$connection = @mysql_connect("localhost", "id", "pass") or die(msql_error());
$db = @mysql_select_db($db_name, $connection) or die(mysql_error());
$sql = "SELECT picture FROM $table_name WHERE username = '$_SESSION[username]'";
$result = @mysql_query($sql,$connection) or die(mysql_error());
?>
<body>
<div align=center>
<br><br>
<table width="500" border="1" cellspacing="0" cellpadding="0" align="center" bordercolorlight="#CCCCCC" bordercolordark="#CCFFFF">
<tr>
<td height="40" background="/images/Gradient.jpg">
<font size="5"><b>Edit Spot</b></font>
</td>
</tr>
<tr>
<td>
<br>
<FORM METHOD="POST" ACTION=" do_upload.php" ENCTYPE="multipart/form-data">
<p><strong>Web Address:</strong><br>
<input type="text" name="webaddress" size="30"></p>
<p><strong>Eyecon:</strong><br>
<INPUT TYPE="file" NAME="eyecon" value="<? mysql_fetch_array($result); ?>" SIZE="30"></p>
<p><strong>Heading:<strong><br>
<input type="text" name="heading" value="<? mysql_fetch_array($result); ?>" size="30"></p>
<p><strong>Description:</strong><br>
<textarea name="description" cols=45 rows=5 wrap=virtual></textarea></p>
<p><strong>Keywords:</strong><br>
<input type="text" name="key1" size="20"><input type="text" name="key2" size="20"><br>
<input type="text" name="key3" size="20"><input type="text" name="key4" size="20"><br>
<input type="text" name="key5" size="20"><input type="text" name="key6" size="20"><br>
<input type="text" name="key7" size="20"><input type="text" name="key8" size="20"><br>
<input type="text" name="key9" size="20"><input type="text" name="key10" size="20"><p>
</td>
</tr>
<tr>
<td height="40" background="/images/Gradient.jpg">
<p><input type="submit" name="submit" value="Save Changes"></p>
</td>
</tr>
</table>
</form>
</body>
</html>Thanks for reading and all help is appreciated.