We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Whats wrong with my MySQL statement?

NewWebDesigner
on
Medium Priority
241 Views
Last Modified: 2012-05-11
What's wrong with this?
mysql_query("DELETE * FROM universities
WHERE universityName LIKE '%Commission%'");

Open in new window

Comment
Watch Question

Commented:
You are missing the database connection context.

Author

Commented:
Note: If I change DELETE to SELECT and uncomment the while statement, it works.

<?php
$con = mysql_connect("localhost","root","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("my_db", $con);



//mysql_query("UPDATE universities SET stateID='1'"); 
 mysql_query("DELETE * FROM universities
WHERE universityName LIKE '%Commission%'");

//while($row = mysql_fetch_array($result))
  //{
  //echo $row['universityID'] . " " . $row['universityName'];
  //echo "<br />";
  //}


mysql_close($con);
?>

Open in new window

Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
SharathData Engineer
CERTIFIED EXPERT

Commented:
try this.
mysql_query("DELETE FROM universities
WHERE universityName LIKE '%Commission%'");

Open in new window

Author

Commented:
I solved it myself by looking at an example.  I accidently included the asterisk.  I don't need points for solving my own problem
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.