Wednesday, 28 August 2013

Read from sql stops when I include WHERE using php

Read from sql stops when I include WHERE using php

I have a script where I would like to read from a table and list out all
the "tasks" where the column check = 1. My script works fine and will list
all the tasks....until I include the WHERE. Then nothing will be read into
the page. What am I doing wrong?
The problem is the WHERE check="1"
$sql = mysql_query('SELECT tasks FROM tasks WHERE check="1"');
while($row = mysql_fetch_array($sql))
{
echo $row['tasks'];
echo "<br />";
}
The table name is "tasks" and the two columns are "tasks" (varchar255) and
"check" (int11)

No comments:

Post a Comment