php - SQL "Where" Statement Only working for on Database Column -


my statement works fine until add "where" stops. using same "where" statement used date column worked fine. little baffled way not work other column in database. have tried other suggestions provided in other questions regarding "where" statements nothing working. appropriated.

     // create connection      $conn = new mysqli($servername, $username, $password, $dbname);     // check connection    if ($conn->connect_error) {   die("connection failed: " . $conn->connect_error);   }   $sql = "select website, url, dropdown, description basic dropdown = social media"; $result = $conn->query($sql);  if ($result->num_rows > 0) {  echo "<table><tr><th>website</th><th>url</th><th>dropdown</th><th>description</th></tr>";  // output data of each row   while($row = $result->fetch_assoc()) {      echo "<tr><td><a href='".$row["website"]."'>".$row["url"]."</a></td>     <td>      <td>" . $row["dropdown"]. "</td><td>" . $row["description"]. "</td>      </tr>";    }    echo "</table>";  } else {  echo "0 results";   }   $conn->close();   ?> 

simply add single quotes social media. here line fixed:

$sql = "select website, url, dropdown, description basic dropdown = social 'media'"; 

Comments

Popular posts from this blog

c++ - CPP, 'X' button listener -

shared memory - gstreamer shmsrc and shmsink with h264 data -

.net - Bulk insert via Dapper is slower than inserting rows one-by-one -