the code saves the category, image title, image, and feature..
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 -
<?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>
-
3 1752 ak1dnar 1,584
Recognized Expert Top Contributor
In line number 22 (Your SQL Insert Statement), you have to assign the posted textarea value to $feature variable. You should use $_REQUEST['feature'] instead of $featureOr else put this Line before your sql query.
[PHP]$feature = $_REQUEST['feature'];[/PHP]
In line number 22 (Your SQL Insert Statement), you have to assign the posted textarea value to $feature variable. You should use $_REQUEST['feature'] instead of $featureOr else put this Line before your sql query.
[PHP]$feature = $_REQUEST['feature'];[/PHP]
thanks for correcting me, it worked..
i was figuring that out the whole day..
thanks again..
Markus 6,050
Recognized Expert Expert
You should also try and use single quotes around array indeces!
[php]
$_something = $_FILES[file][type]; // baaaad!
$_something = $_FILES['file']['type'] // good good good!
[/php]
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Wayno |
last post by:
My php logs are coming up empty. I have done all I can think of, and
all that made sense to me. Can someone take a look at my php.ini
please and tell me what you think may be the problem.
I double-checked the path to my error log. It is in
/var/www/logs/php_error_log
Thanks. :)
-Wayne Stevenson
|
by: Maciej Paras |
last post by:
Hello! I've written 2 pages: one i HTML format, and second - in ASP. When
I'm posting data from HTML page, I receive this error generated by ASP page:
Microsoft JET Database Engine (0x80040E14)
Syntax error (missing operator) in query expression '' AND (='OFFICE DEPOT')''.
"Office Depot" is the value from form.
When all values are set to "*" the script generates correct results, but if
its value contains any string it generates the...
|
by: Joe |
last post by:
Hello All,
I am trying to insert a record in the MS Access DB and for some reason I cannot get rid of error message,
System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement.
And the line it shows in red is
cmd.ExecuteNonQuery()
|
by: Joe |
last post by:
Hello All,
I am trying to insert a record in the MS Access DB and for some reason I cannot get rid of error message,
System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement.
And the line it shows in red is
cmd.ExecuteNonQuery()
|
by: Krakatioison |
last post by:
Hi everyone,
can someone point me to download of an example for saving and retrieving
to/from MYSQL database.
Or did anyone of you tried this and could share your code with me.
I've got some data which needs to be put to mysql database using VB.NET and
I can't figure this out.
Thanks a lot.
K.
| |
by: Mikey G |
last post by:
Hi, I created a simple VB.NET 2003 application through Visual Studio
that connects to a MySQL database and loads a table into a Dataset, and
then displays that table information in a DataGrid on a form for
editing. The table fill works fine, the delete function works fine, but
when I try to update a row, the application fails with the following
error message:
An unhandled exception of type 'System.Data.Odbc.OdbcException' occurred
in...
|
by: Wayne Smith |
last post by:
I've taken the following code from a developers web site which should allow
a user to register and receive an email message with a link to activate
their account, but when I click the link on my home page to take me to the
'registration.aspx' page, it throws up the following error message and I
can't figure out why.
------------------------------------------------------------------------------
Server Error in '/' Application.
...
|
by: jessDMiller |
last post by:
I have no clue why the data from the form isn't saving into the database. What am I doing wrong?
addAnnounce.php:
<td align=top>
<form action="index2.php" method="post">Heading:<br /><textarea name="heading" cols="50" rows="10"></textarea><br /><br />Announcement:<br />
<textarea name="announce" cols="50" rows="10"></textarea>
<br /><br />Date:<br /><textarea name="date" cols="50" rows="10"></textarea><br /><br /><input...
|
by: kammaldeep |
last post by:
hi,
i m newbie 2 PHP & to b frank ... will alwaz be ... i dont think i will go into much details with PHP as my work doesnot include workin with PHP
bt i have a forum .. and i want to make a personal contact page in it .... and save all details in my new database....
i have website in the root folder
i get dis error
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |