but the problem is that the "feature" is not saved, but the others were saved..
this is the data types of my table
category = text
title = text
image = longblob
feature = text
in html, the users input the feature in (textarea)..
is there a problem with the code? pls.. help
Expand|Select|Wrap|Line Numbers
- <?php
- // Connect to database
- $errmsg = "";
- if (! @mysql_connect("localhost","root","")) {
- $errmsg = "Cannot connect to database";
- }
- @mysql_select_db("upload");
- // Insert any new image into database
- if ($_REQUEST[completed] == 1) {
- // Need to add - check for large upload. Otherwise the code
- // will just duplicate old file ;-)
- // ALSO - note that latest.img must be public write and in a
- // live appliaction should be in another (safe!) directory.
- move_uploaded_file($_FILES['imagefile']['tmp_name'],"latest.img");
- $instr = fopen("latest.img","rb");
- $image = addslashes(fread($instr,filesize("latest.img")));
- if (strlen($instr) < 149000) {
- mysql_query ("insert into sharp (category, title, imgdata, feature) values (\"". $_REQUEST[categ] . "\", \"". $_REQUEST[whatsit] . "\", \"". $image . "\", \"". $feature . "\")");
- } else {
- $errmsg = "Too large!";
- }
- }
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Untitled Document</title>
- <link href="div.css" rel="stylesheet" type="text/css" />
- </head>
- <body>
- <style type="text/css">
- body
- {
- background-image: url(body.jpg);
- background-repeat: no-repeat;
- background-position: top left;
- }
- </style>
- <h3 align = "left">Please upload a new picture and title</h3>
- <form method=post>
- <table border = "0" align = "left">
- <tr>
- <td>Brand:</td>
- <td><select name = "brand">
- <option>SONY</option>
- <option>SHARP</option>
- <option>LG</option>
- <option>PANASONIC</option>
- <option>SAMSUNG</option>
- <option>JVC</option></select></td>
- </tr>
- <tr>
- <td>Category:</td>
- <td><select name = "categ">
- <option>TV</option>
- <option>AUDIO</option>
- <option>WASHING MACHINE</option>
- <option>REFRIGERATOR</option>
- <option>AIR CONDITIONER</option>
- <option>MICROWAVE OVEN</option></select></td>
- </tr>
- <tr>
- <td>Image Title:</td>
- <td><input name=whatsit></td>
- </tr>
- <tr>
- <input type=hidden name=MAX_FILE_SIZE value=150000>
- <input type=hidden name=completed value=1>
- <td>Upload Image:</td>
- <td><input type=file name=imagefile></td>
- </tr>
- <tr>
- <td>Feature:</td>
- <td><textarea name = "feature"></textarea></td>
- </tr>
- <tr>
- <td></td>
- <td><input type=submit value = "Save"></td>
- </tr>
- </table>
- <br>
- </form><br>
- </body>
- </html>