Code error!!!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Ron_e
Forum Newbie
Posts: 13
Joined: Tue Sep 15, 2009 11:59 pm

Code error!!!

Post 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)
Post Reply