Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
PHP Databases Using PHP in conjunction with databases. PHP questions not specific to databases should be directed to one of the other PHP forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old May 25th, 2005, 03:23 PM
Registered User
Join Date: May 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default inserting into oracle using php

When I try to insert a string that contains an apostrophe or single quote into my oracle database from a php script, it gives me an error. So I tried searching the string for any single quotes and using ereg_replace("'","''",$str);, to replace any single quotes with two single quotes. It was able to insert, but, instead of inserting a single quote, it inserted a backslash (\), before the single quote. (\')

Any ideas of how to insert an apostrophe or single quote into an oracle database using php?

Old May 26th, 2005, 03:01 AM
Friend of Wrox
Join Date: Mar 2004
Posts: 357
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to anshul

Ues addslashes($data) before inserting data to db. After retrieval from db use stripslahes($data), before displaying data.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting records to Oracle db from asp page jowjow Classic ASP Basics 0 April 4th, 2006 09:24 AM
inserting records in oracle from asp page jowjow Oracle ASP 0 April 4th, 2006 09:17 AM
Problem in inserting 100KB string into oracle db MSUser Oracle 1 December 31st, 2004 05:55 AM
problem in inserting blob data to oracle selphyr JSP Basics 2 December 2nd, 2004 01:44 PM
Bulk Inserting from VB to Oracle parshavgarg Pro VB Databases 0 July 29th, 2004 07:18 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.