MyBB Community Forums

Full Version: Variable in Where clause in php script not working
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am building a script to add into my form. But something seems to be not working.

The Where Clause, where I define a variable :
WHERE store = '$hostt'

is not working. If replace this variable with the actual value it works.
Plz help.
<?php

$result = mysqli_query($con,"SELECT * FROM main WHERE store = '$hostt'"); 
while($row = mysqli_fetch_array($result))
  {
  echo $row['prefix'];
  }


?>

(2013-06-08, 09:03 AM)chetankchandak Wrote: [ -> ]I am building a script to add into my form. But something seems to be not working.

The Where Clause, where I define a variable :
WHERE store = '$hostt'

is not working. If replace this variable with the actual value it works.
Plz help.
<?php

$result = mysqli_query($con,"SELECT * FROM main WHERE store = '$hostt'"); 
while($row = mysqli_fetch_array($result))
  {
  echo $row['prefix'];
  }


?>

Solved it thanks