Re: Quotes are messign up my SQL Query, need help
| From: | ranman at ranman dot nbtel dot net | Date: | Wed, 06 Dec 2000 14:58:45 +0000 |
| Subject: | Re: Quotes are messign up my SQL Query, need help | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-28915@lists.php.net to get a copy of this message | ||
Sounds like $sel_record isn't what you exspect it to be, hence
try entering it manual and see if a test record is deleted, hence:
WHERE col_id = 'Hun-Gan-Tse'
unless, your error reporting is turned way down, hence:
mysql_connect($hostname, $user, $password)
or die("Unable to connect to SQL server");
mysql_db_query("yourDB", "DELETE FROM featured WHERE col_id =
'$sel_record'");
echo mysql_errno().": ".mysql_error();
On Wed, 6 Dec 2000, Shane McBride wrote:
> I have a customer who keeps me on my toes. Each time I think I got the php code bullet proof,
> she throws me a curve ( and she doens't even know it).
>
> She uploads what we call "Featured Items". The one in question now have a value like
> this:
> "Hun-Gan-Tse" ("I Am Going")
>
> It gets written to the MySQL DB just fine, and pulled from the DB for display on a web page.
> The problem comes in when I/she tries to remove the item from the DB.
>
> Here's what I have:
> //Create SQL Statement
> $sql = "DELETE FROM featured WHERE title = '$sel_record'";
>
> //Execute SQL query and get results
> $sql_result = mysql_query($sql, $connection) or die ("Couldn't execute query");
>
> I suppose all the quotes and parenthesis screw this up. Any ideas?
>
> TIA,
>
> Shane
>
>