Page 1 of 1

[Solved]User defined tag - Retrieve information from database.

Posted: Thu Apr 08, 2010 8:11 am
by tilde
I have created a user defined tag with this content:
$con = mysql_connect("mysql4.gigahost.dk","agdrup","agd9700rup");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("agdrup_blf", $con);
$result = mysql_query("SELECT * From cup2010 ORDER BY vaegt DESC, laengde ASC");
echo "

Dato
Måned
Sted
Køn
Vægt i gram
Længde i cm
Navn
Agn
Udsat
";
while($row = mysql_fetch_array($result))
{
echo "";
echo "" . $row['dato'] . "";
echo "" . $row['maaned'] . "";
echo "" . $row['sted'] . "";
echo "" . $row['koen'] . "";
echo "" . $row['vaegt'] . "";
echo "" . $row['laengde'] . "";
echo "" . $row['navn'] . "";
echo "" . $row['agn'] . "";
echo "" . $row['genudsat'] . "";
echo "";
}
echo "";
mysql_close($con);

When I look on my site I see this information:
Warning: mysql_real_escape_string(): 27 is not a valid MySQL-Link resource in /home/www/blf.data-soren.dk/lib/adodb_lite/adodbSQL_drivers/mysql/mysql_driver.inc  on line 197

This is line 197:
return "'" . mysql_real_escape_string($string, $this->connectionId) . "'";

How do I remove of this warning?

Søren

Re: User defined tag - Retrieve information from database.

Posted: Thu Apr 08, 2010 9:25 pm
by Nullig
Add:

Code: Select all

adodb_connect();
as the last line of your UDT.

Nullig

Re: User defined tag - Retrieve information from database.

Posted: Sat Apr 10, 2010 4:11 am
by tilde
Nullig

Thank you.

Søren