...

View Full Version : extract not working



Taylor_1978
01-26-2004, 05:18 AM
Hiya,

This works:



<?
include ("connect.php");
echo "<title>Tourney Variables</title>";
$tid = 580;
$result = mysql_db_query(tourneys, "SELECT * FROM info WHERE tid='$tid'");
$row = mysql_fetch_array($result);
extract( $row );
echo "TOURNEY URL: $url";
?>


But this does not (leaves $t_url as blank):



<?
include ("connect.php");
echo "<title>Tourney Variables</title>";
$tid = 580;
$result = mysql_db_query(tourneys, "SELECT * FROM info WHERE tid='$tid'");
$row = mysql_fetch_array($result);
extract( $row , EXTR_PREFIX_ALL, "t_" );
echo "TOURNEY URL: $t_url";
?>


Any idea's why? I have tried both 't_' and "t_". Running PHP v4.2.1

Thanks in advance :thumbsup:

Taylor.

Taylor_1978
01-26-2004, 05:22 AM
Nevermind - worked it out! Should be:



<?
include ("connect.php");
echo "<title>Tourney Variables</title>";

$result = mysql_db_query(tourneys, "SELECT * FROM info WHERE tid='$tid'");
$row = mysql_fetch_array($result);
extract( $row , EXTR_PREFIX_ALL, "t" );
echo "TOURNEY URL: $t_url";
?>


No underscore in front of the t!!

Taylor.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum