473,568 Members | 2,905 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Storing images into MySQL DB

I'm currently trying to store images into my DB. But the collation used
on my DB is big5, since my client wants this default encoding on their
webpage.
So to be able read the retreived data I have to use the command
mysql_query('SE T NAMES big5');.

But when I do this, I'm not able to save the images to my DB. When I
attempt to, I recieve an SQL Error stating:

"You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near
'WƎ\\0G/-M3z...o p\\07¿B4o ^#Pu\\\'Z 揨Z2Qs f·'
at line 1"

If I changed the command to mysql_query('SE T NAMES utf-8'); there are
no errors and the images save properly.

I suppose the encoding of the binary data in big5 contains some type of
invalid character causing the SQL string to error.

Anyone know how I can get around this?

Jul 27 '06 #1
1 1600
steelghost wrote:
I'm currently trying to store images into my DB. But the collation used
on my DB is big5, since my client wants this default encoding on their
webpage.
So to be able read the retreived data I have to use the command
mysql_query('SE T NAMES big5');.

But when I do this, I'm not able to save the images to my DB. When I
attempt to, I recieve an SQL Error stating:

"You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near
'WƎ\\0G/-M3z...o p\\07¿B4o ^#Pu\\\'Z 揨Z2Qs f·'
at line 1"

If I changed the command to mysql_query('SE T NAMES utf-8'); there are
no errors and the images save properly.

I suppose the encoding of the binary data in big5 contains some type of
invalid character causing the SQL string to error.

Anyone know how I can get around this?
Are you using mysql_real_esca pe_string on the image before storing it?

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jul 27 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
11747
by: dave | last post by:
Hello there, I am at my wit's end ! I have used the following script succesfully to upload an image to my web space. But what I really want to be able to do is to update an existing record in a table in MySQL with the path & filename to the image. I have successfully uploaded and performed an update query on the database, but the problem...
0
1647
by: Eben Goodman | last post by:
I am storing book isbn numbers in a table. isbn numbers are 10 digit numbers and many start with 0. The data type of the field I am storing this info in is a bigint(16) unsigned. It appears that isbns that start with 0 are going in as 9 digit numbers, the 0 is being ignored or stripped. I have experienced this before with integer data...
0
428
by: Ash Christopher | last post by:
Is there a way to store images in a mySQL database? I was hoping to store them in a table, then use php to call them from the database and display the picture on a webpage. Any help would be appreciated.
7
3476
by: Benoit St-Jean | last post by:
I am looking at options/ways to store 12 million gif/jpg images in a database. Either we store a link to the file or we store the image itself in the database. Images will range from 4k to 35k in size and there will be 12 millions of them (at the beginning)... I expect a 8% growth every year. We will also have to perform some cleanup...
6
3039
by: bissatch | last post by:
Hi, I am currently writing a news admin system. I would like to add the ability to add images to each article. What I have always done in the past is uploaded (using a form) the image to a folder on the server and then in the database table that I INSERT the news article, I'll store the path of the uploaded image. To me this seems a...
2
9286
by: bissatch | last post by:
Hi, I am trying to write script that is run when a form is submitted. The form contains an image input field and when submitted, the image is uploaded, resized and added as binary information to a db table. Please note, I am using a PostgreSQL database I have written all the code out below that deals with the submission processing:
4
2717
by: Rednelle | last post by:
Greetings all, As a newbie, using Access 2000, I would appreciate advice on the best way to include pictures. I have developed a 'Home Inventory' database which can include jpeg thumbnails of my items and I can review things at anytime - on the desktop where I created all this - no problem so far. I networked the mdb file (only) across...
3
1895
by: Lucky_Syringe | last post by:
I wrote this script to display different files from a database and properly display them by their respective MIME types. I have two questions: the first is that it just so happens not to work, and I'm just wondering if there are any discrepancies that I can't see that maybe someone else can, and the second is what would be the benefits and...
2
2031
by: ghjk | last post by:
I want to develop web site for vehicle sale. There I want to store vehicle images. I'm planing to use mysql DB. Please tell me is it possible to user mysql db for that kind of data storage?
0
7693
marktang
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, well explore What is ONU, What Is Router, ONU & Routers main...
0
8118
jinu1996
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...
0
7962
tracyyun
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...
0
6277
agi2029
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 projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5501
isladogs
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...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2105
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
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
933
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.