[php+mysql] query fout ??? zie hem niet

Pagina: 1
Acties:
  • 31 views sinds 30-01-2008

  • Menblack
  • Registratie: November 2001
  • Laatst online: 28-06 20:10
stukje php
-------------------------------
if($action == "view")
{
$query_view_p = "SELECT *".
"FROM plaatjes".
"WHERE product_id = 0"; <-- error
$result = mysql_query($query_view_p);
if(!$result)
{
echo mysql_errno().": ".mysql_error()."<BR>";
exit;
}
//print mysql_num_rows($result);
$row = mysql_fetch_array($result);
//print $row["product_id"];
$data = urldecode($row["img_small"]);
$len = strlen($data);
header("Content-type: image/jpg");
header("Content-Length: $len");
header("Content-Disposition: inline; filename=test.jpg");
print $data;

}
---------------------------------
tabel opbouw
---------------------------------
CREATE TABLE plaatjes (
product_id INTEGER UNSIGNED NOT NULL,
img_small BLOB NOT NULL,
size_small INTEGER UNSIGNED NOT NULL,
type_small VARCHAR(20) NOT NULL,
big_img VARCHAR(3),
type_big VARCHAR(20),
img_big BLOB,
size_big INTEGER UNSIGNED,
PRIMARY KEY (product_id))";
-----------------------------------
error
-----------------------------------
1064: You have an error in your SQL syntax near '= 0' at line 1
-----------------------------------

wat is er fout zie het niet al aan andere gevraagt een weten het ook niet dus dan maar op GoT.

  • Janoz
  • Registratie: Oktober 2000
  • Laatst online: 09-09 20:58

Janoz

Moderator Devschuur®

!litemod

(zoals ook al in de faq staat)

Waneer je deze query eens afdrukt ipv uitvoert, dan zie je de fout waarschijnlijk wel. (grote toets, middenonder op het toetsenbord :))

Ken Thompson's famous line from V6 UNIX is equaly applicable to this post:
'You are not expected to understand this'


  • Menblack
  • Registratie: November 2001
  • Laatst online: 28-06 20:10
als je spatie bedoel werkt niet hoort had ikal gedaan net als ''

  • Janoz
  • Registratie: Oktober 2000
  • Laatst online: 09-09 20:58

Janoz

Moderator Devschuur®

!litemod

Dus volgens jou is
code:
1
SELECT *FROM plaatjesWHERE product_id = 0;

net zo geldig als
code:
1
SELECT * FROM plaatjes WHERE product_id = 0;

?

Ken Thompson's famous line from V6 UNIX is equaly applicable to this post:
'You are not expected to understand this'


  • Boomerang
  • Registratie: November 2000
  • Niet online
Probeer het zo eens:
$query_view_p = "SELECT *".
"FROM plaatjes".
"WHERE product_id = '0'";

  • Olaf van der Spek
  • Registratie: September 2000
  • Niet online
Ik zou tussen plaatjes en WHERE een spatie zetten, zoals al aangegeven.

  • D2k
  • Registratie: Januari 2001
  • Laatst online: 31-08 10:19

D2k

dit lijkt me duidelijk genoeg
en als dat niet het geval is zal ik hoogst persoonlijk mijn debugskilzz in de strijd gooien

Doet iets met Cloud (MS/IBM)

Pagina: 1

Dit topic is gesloten.