Ben korkunç PHP hata
alıyorum
Parse error: syntax error, unexpected T_STRING in /path/to/the/file in line 14
İşte kod:
function getSomeList($userid) {
$query = "SELECT list_id, username_id FROM user_list WHERE username_id = 1";
$result = mysql_query($query, $this->db);
if (! $result ) {
$message = "Bad Query: getUserSiteList(): " . mysql_error() . "<br>";
$message .= "Query: " . $query;
die($message);
}
$num = mysql_num_rows($result);
echo "Number of Rows Found " . $num . "!!<br>";
echo get_resource_type($result) . "<br>";
if ( $num > 0 ) {
echo "No rows found, nothing to print so am exiting<br>";
}
... more code ...
}
Yani her şey ben $ num değişkeni kullanmak 'if' deyimi kadar çalışıyor. $ Sonuç değişkeni bir mysql sonucu olmasıdır. Ayrıca her zaman ben bu hatayı alıyorum $ sonuç kaynak kullanımı. Örneğin, daha sonra işlevi Ben bu çağrıyı kullanarak bir satır veri erişmeye çalıştığınızda:
while ( $row = mysql_fetch_assoc($result)) { ... more code ...
It errors out with the same T_STRING error, (this is after removing the if statement shown above.) I am at a loss, anyone have any suggestions where my error is? I personal feel it has something to do with the resource returned by the mysql query. Something is amiss with it.
Yardımlarınız için teşekkürler.
Ben OS X üzerinde PHP 5.3.0 ve MySQL 5.1 kullanıyorum PS