Error in script
Posted: Tue Jul 22, 2003 7:28 am
Hi!!!
I Have one SQL in my script. And the result this SQL return 0 rows. But i have fields in my DataBase with this condition.
Maybe i error in SQL sintaxe.
Help me please!!!
The script is this:
$res = mysql_connect("localhost","escola");
if ($res)
{
$colocar = $_POST["D1"];
$sql = "Select * from Cursos Where DesCurso like('$colocar%') ";
$result = Mysql_db_query("escola","$sql",$res);
echo mysql_num_rows($result);
while ($present = mysql_fetch_array($result))
{
if ($present["DesCurso"] = $colocar)
{
$valor = $present["ValCurso"];
$quant = $present["ParCurso"];
echo $present["DesCurso"];
}
}
}
I´m try too this SQL:
$sql = "Select * from Cursos Where DesCurso = $colocar";
And nothing.
Thank´s
Miguel
I Have one SQL in my script. And the result this SQL return 0 rows. But i have fields in my DataBase with this condition.
Maybe i error in SQL sintaxe.
Help me please!!!
The script is this:
$res = mysql_connect("localhost","escola");
if ($res)
{
$colocar = $_POST["D1"];
$sql = "Select * from Cursos Where DesCurso like('$colocar%') ";
$result = Mysql_db_query("escola","$sql",$res);
echo mysql_num_rows($result);
while ($present = mysql_fetch_array($result))
{
if ($present["DesCurso"] = $colocar)
{
$valor = $present["ValCurso"];
$quant = $present["ParCurso"];
echo $present["DesCurso"];
}
}
}
I´m try too this SQL:
$sql = "Select * from Cursos Where DesCurso = $colocar";
And nothing.
Thank´s
Miguel