Page 1 of 1

Code error!!!

Posted: Mon Oct 05, 2009 6:39 am
by Ron_e
EXPERTS!!! How can I replace B with A??

A worked fine. But after few adjustments now it looks like B. B wont work!!


A
while($line = mysql_fetch_assoc($results)) {
echo "<item>" . $line["Email"] . "</item>\n";
}


B
$urlText = $mystring;
$findme = '/?';
$pos = strpos($mystring, $findme);

if ($pos !== false)
{
$pos += 2;
$SomeVar = mysql_real_escape_string(substr($mystring,$pos));
$query = "SELECT * FROM mail_list WHERE ID = '$SomeVar'";
$results = mysql_query($query);
if($line = mysql_fetch_assoc($results))
{
echo "<item>" . $line["Email"] . "</item>\n";
}

What I need is to match the string to an ID in the MySQL and call a email. (query string id = MySQL ID)