2010-11-15 75 views
0

由於某種原因,這個變量不會顯示。以下是代碼:

<?php 
require_once("functions/redirect.php"); 
require_once("functions/connect.php"); 
require_once("queries/member-table-query.php"); 

$id = $_GET["id"]; 

// Query the db to get all of the info to put in the XML file 
$result = mysql_query("SELECT members.* FROM members JOIN $nombre ON  members.member_ID=$nombre.friends") or die(mysql_error()); 
$number = mysql_num_rows($result); 


$xmlout = "<?xml version='1.0' encoding='ISO-8859-1'?><Peers>"; 
while($msg = mysql_fetch_assoc($result)) 
{ 
$xmlout .= "<friend lang='en'> 
    <name>".$msg['first_name']." ".$msg['last_name']."</name> 
    <url>petition_invite_member.php?petition_ID=$id& amp;member_ID=".$msg['member_ID']." </url> 
    <photo>".$msg['photo']."</photo> 
    <location>".$msg['home_state']." - ".$msg['district']."</location> 
    </friend>"; 
} 
$xmlout .= "</Peers>"; 
?> 

由於某些原因,$ id變量不會在url中的標記之間顯示。

任何想法?謝謝

+0

什麼呢'的var_dump($ ID);'右後'的$ id = $ _ GET [」 id「];'return? – stillstanding 2010-11-15 07:23:14

+0

'$ id'的價值是什麼? – 2010-11-15 07:24:07

+0

$ id的值是動態的。它是一個長度可達1-15位的整數 – Lance 2010-11-15 07:52:52

回答

0

哪裏是URL標記中的$ id的值,我沒有看到它。

+0

petition_invite_member.php?petition_ID = $ id & amp; member_ID =「。$ msg ['member_ID']」。 Lance 2010-11-15 07:51:06

+0

也許$ result ['Member_ID'] ??? – sanders 2010-11-15 08:12:13

0

& $ id後立即可能會令人困惑的PHP。嘗試

${id}&amp; 

改爲。

+0

仍然不起作用。我真的認爲這個可能已經難倒了我:( – Lance 2010-11-15 08:25:30

0

你可以試試這樣嗎?

petition_invite_member.php?petition_ID =「。$ id。」 & member_ID =「。$ msg ['member_ID']」。

在$ id之前和之後添加雙引號,就像您在$ msg中所做的那樣。 感謝

+0

嘗試過它...仍然無法使用!這段代碼一直困擾我幾個小時了! – Lance 2010-11-15 08:51:40

0

正是

petition_ID={$id}&amp; 

你也可以確信$ id變量不空