16. november 2003 - 20:37Der er
16 kommentarer og 2 løsninger
problemer med $_GET
Hej jeg laver en sql udtræk med $_GET men får følgende fejl Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING
$req = mysql_query("select h.pc_id, l.navn, b.model, p.navn, c.model, p1.navn, ha.model, p2.navn, r_t.type, r_a.ns, r_s.size, p3.navn from hardware as h, lokation as l, bundkort as b, producent as p, cpu as c, producent as p1, harddisk as ha, producent as p2, ram as r, ram_type as r_t, ram_accesstime as r_a, ram_size as r_s, producent as p3 where (h.pc_id = $_GET['id_pc']) and (h.lokation_id = l.lokation_id) and (h.bundkort_id = b.bundkort_id) and (b.producent_id = p.producent_id) and (h.cpu_id = c.cpu_id) and (c.producent_id = p1.producent_id) and (h.harddisk_id = ha.harddisk_id) and (ha.producent_id = p2.producent_id) and (h.ram_id = r.ram_id) and (r.producent_id = p3.producent_id) and (r.ram_accesstime_id = r_a.ram_accesstime_id) and (r.ram_type_id = r_t.ram_type_id) and (r.ram_size_id = r_s.ram_size_id)") or die(mysql_error());
Hmm... Er ikke 100% sikker, men er det ikke noget i den her stil?:
$req = mysql_query("select h.pc_id, l.navn, b.model, p.navn, c.model, p1.navn, ha.model, p2.navn, r_t.type, r_a.ns, r_s.size, p3.navn from hardware as h, lokation as l, bundkort as b, producent as p, cpu as c, producent as p1, harddisk as ha, producent as p2, ram as r, ram_type as r_t, ram_accesstime as r_a, ram_size as r_s, producent as p3 where (h.pc_id = " . $_GET['id_pc'] . ") and (h.lokation_id = l.lokation_id) and (h.bundkort_id = b.bundkort_id) and (b.producent_id = p.producent_id) and (h.cpu_id = c.cpu_id) and (c.producent_id = p1.producent_id) and (h.harddisk_id = ha.harddisk_id) and (ha.producent_id = p2.producent_id) and (h.ram_id = r.ram_id) and (r.producent_id = p3.producent_id) and (r.ram_accesstime_id = r_a.ram_accesstime_id) and (r.ram_type_id = r_t.ram_type_id) and (r.ram_size_id = r_s.ram_size_id)") or die(mysql_error());
mente egentlig jeg havde tjekket med {} men har nok sat der forkert. det virker ihvertfald nu, fedt at have brugt 10 min på det når der så hurtig respons herinde.
Yes sir! Du kan dog også have det ved tal - ved at gøre det altid, er der en ting mindre at bekymre sig om. Det er dog kun lige i MySql det la'r sig gøre.
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.