Page 1 of 1

Error code... input field = database field

Posted: Wed Feb 08, 2006 9:39 pm
by No0b
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:

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>
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.

Posted: Wed Feb 08, 2006 9:48 pm
by nickman013
I dont know, but here are 2 errors I found in your script.
<textarea name="discription" cols=45 rows=5 wrat=virtual></textarea></p>
should be
<textarea name="discription" cols=45 rows=5 wrap=virtual></textarea></p>

and
<input type="text" name="heading" value="<? echo "$result\"; ?>" size="30"></p>
should be
<input type="text" name="heading" value="<? echo '$result\'; ?>" size="30"></p>
EDIT:
Also there is not even 122 lines in this code

Posted: Wed Feb 08, 2006 9:59 pm
by No0b
ok so the script doesn't have any errors on it but just doesn't do what i want it to do. and that is have the input fields display the value of the picture field in the database. it's all in the first post.

Posted: Wed Feb 08, 2006 10:06 pm
by d3ad1ysp0rk
Get rid of your @ symbols, fix the error nickman pointed out, and repost the code with any errors.

Posted: Wed Feb 08, 2006 10:16 pm
by No0b
why should i get rid of the @ in my code?

Posted: Wed Feb 08, 2006 11:43 pm
by josh
because it slows down your code and also prevents you from seeing errors that could be the symptom of a larger overall problem