0

event id以下の例から、template の最後にあるヘッダー URLに取得しようとしていますtest.html。誰かが私が間違っていることを教えてもらえますか?

これが私のコードです:

<?php
header("Location: templatetest.html?.$row['event_id']."); 

mysql_connect("xxxx", "xxxx", "xxxx") or die(mysql_error());
mysql_select_db("xxxx") or die(mysql_error());


$result = mysql_query("SELECT a.* FROM events a INNER JOIN (SELECT id_user, MAX(event_id) as maxID FROM events GROUP BY id_user) b ON a.id_user = b.id_user AND a.event_id = b.maxID WHERE a.id_user = '$test'")
or die(mysql_error()); 


// store the record of the "example" table into $row
while($row = mysql_fetch_array($result)){
};    
?>  

ありがとうございました。

4

3 に答える 3

3

注文して代金を支払い、受け取る前にハンバーガーを食べることはできません。プログラミングでも同じこと。headerの後に移動します$row = mysql_fetch_array($result)。その間、何も印刷しないようにしてください。

于 2012-12-26T05:37:32.993 に答える
1

構文エラーがあります:

header("Location: templatetest.html?.$row['event_id'].");

そして、次のようにする必要があります。

header("Location: templatetest.html?".$row['event_id']);

$row未定義になりますが

于 2012-12-26T05:37:52.000 に答える
0

最低限:

header("Location: templatetest.html?{$row['event_id']}");

しかし、必要に応じて url パラメータ (?something=)必要になる場合があります。

于 2012-12-26T05:37:48.110 に答える