Jump to content

[SOLVED] Slight issue with str_replace with apostrophe.


Solarpitch

Recommended Posts

Hey,

 

I'm trying to submit a form to my database but it's telling me..

 

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 'Sullivan John Mr','','','test 3')' at line 3

 

The reason being that the name is O'Sullivan John but I think the apostrophe is causing the issue. I tried the following code to rplace the ' with a blank space but it just make the whole name blank. Is there anyway I can still use the apostrophe in the name without having to replace it for the DB?

 

<?php

	$member= $_SESSION['member']; 

	$strip = array("'");
	$member = str_replace($strip, "", " ");
/>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.