开发者

"No data received" on GET request

I keep getting a "No data received" error, I know this is common with Google Chrome so I tried in IE and I get a connection problem error. Here is my script, I really don't see what is causing this error.

$getAlName = mysql_query("SELECT * FROM categories WHERE id=" . $cat);
$alName = mysql_feth_assoc($get开发者_Go百科AlName);

$images = mysql_query("SELECT * FROM images WHERE category=" . $alName['name']);
while($imgs = mysql_fetch_object($images)) {
    $url = $imgs->url; 
    $id = $imgs->id;
    echo ("<img src='" . $url . "'></img>\n"); 

}


You need to add single quotes around your strings:

"SELECT * FROM images WHERE category = '" . $alName['name']) . "'";

...and you also got a typo, use mysql_fetch_assoc instead of mysql_feth_assoc($getAlName);


//Make a subquery and you'll thank yourself later: 
$q = "SELECT URL, ID FROM images WHERE category IN ".
  "( SELECT * FROM categories WHERE id=" . $cat . ")";

echo $q; // just to test. no data received probably has to do with no output to 
         // the browser. This will output to the browser.

$images = mysql_query($q);
// this is the same.
while($imgs = mysql_fetch_object($images)) {
    $url = $imgs->url; 
    $id = $imgs->id;
    echo ("<img src='" . $url . "'></img>\n"); 
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜