Jump to content

MySQL query question


RobertSubnet

Recommended Posts

Greetings all.

 

Simple (hopefully) question here. I am trying to write a PHP/MySQL query to delete any users with the first name of margaret.

 

The table name is users

The column name is first_name

PHP version: 5.2.3

MySQL version: 5.0.37

 

Connect to the sitename database with the following:

 

$dbc = mysqli_connect (DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);

 

The problem PHP query goes like this:

 

$query1 = "delete from users where first_name = 'margaret'";

 

I run the query with this:

$result = mysqli_query ($dbc, $query1);

 

Unfortunately it doesn't remove the name. In MySQL client the exact same query works perfectly.

 

I have tried putting a space between the single and double quotes at the end, but still no go.

 

Would someone please let me know what I am doing wrong.

 

Thanks!

~Robert

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.