RE: [PHP] Function not working
| From: | PHP Developers | Date: | Sat, 10 May 2003 23:11:29 +0000 |
| Subject: | RE: [PHP] Function not working | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-147161@lists.php.net to get a copy of this message | ||
you need to put plings '' around date in the query, mysql $result will be an
incorrect identifier as the sql failed....
$sql = "SELECT * FROM materias";
$sql .= " where id_editoria = $id_editoria ";
$sql .= "AND data = '$date' ORDERBY prioridade LIMIT 1";
Rgds,
Ben
> From: Dani Matielo [mailto:dmatielo@uol.com.br]
> here I have another problem, now with a function:
>
> function destaque($id_editoria) {
> $date = date("Y-m-d");
> $result = mysql_query("SELECT * FROM materias where id_editoria =
> $id_editoria AND data = $date ORDERBY prioridade LIMIT 1");
> $destaque = mysql_fetch_array($result);
> return $destaque;
> };
> ?>
>
> The error is acused in the line starting with $destaque... what did I do
> wrong? :(
>
[snip]