Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 224
  • Last Modified:

Whats wrong with my MySQL statement?

What's wrong with this?
mysql_query("DELETE * FROM universities
WHERE universityName LIKE '%Commission%'");

Open in new window

0
NewWebDesigner
Asked:
NewWebDesigner
  • 3
1 Solution
 
svgmucCommented:
You are missing the database connection context.
0
 
NewWebDesignerAuthor 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

0
 
NewWebDesignerAuthor Commented:
Solved it, had to get rid of the asterisk.
0
 
SharathData EngineerCommented:
try this.
mysql_query("DELETE FROM universities
WHERE universityName LIKE '%Commission%'");

Open in new window

0
 
NewWebDesignerAuthor 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
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now