Snukzz Posted October 15, 2004 Report Posted October 15, 2004 $list=user_num($_GET['list']); $sub_kat_id=user_num($_GET['skatid']); $res=mysql_query('SELECT nos, art, kat_id, sub_kat_id, id, stock, brends FROM preces WHERE stock = 1 AND sub_kat_id=.$sub_kat_id AND brends='.$list); $res3=mysql_query('SELECT preces.nos, preces.art, preces.kat_id, preces.sub_kat_id, preces.id, preces.stock, preces.brends, brendi.id, brendi.nos FROM preces, nos WHERE preces.brends=brendi.id AND preces.sub_kat_id='.$sub_kat_id); while($row3=mysql_fetch_row($res3)){ ... } <----kljuuda???? Nu nesaprotu, kaapeec php man saka ka Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in D:\WEB\ILB\include\switch_brand.php on line 11 (kodaa taa ir 11 rindinja)... moz kaac redz kur tas sunc ir aprakc!
рпр Posted October 15, 2004 Report Posted October 15, 2004 paarabudi ar mysql_error vai tev nav mysql_query kljuuda.
hu_ha Posted October 15, 2004 Report Posted October 15, 2004 vaicaajums nav korekts, kaads lauks saucas savaadaak vai atrodas citaa tabulaa... ieliec to pashu vaicaajumu myslControlCentre un apskaties vai vaicaajums izpildaas un kaut kas tiek atgriezts
Snukzz Posted October 15, 2004 Author Report Posted October 15, 2004 tok bija mysql errors! paldies! :D
Snukzz Posted October 15, 2004 Author Report Posted October 15, 2004 veel viena shkrobe... $res=mysql_query('SELECT preces.nos, preces.art, preces.kat_id, preces.sub_kat_id, preces.id, preces.stock, preces.brends, brendi.id, brendi.nos FROM preces, brendi WHERE preces.stock = 1 AND preces.sub_kat_id=.$sub_kat_id AND id.brendi=.$list AND id.brendi=preces.brends'); Ceru ka kaads sapratiis kas ar to domaats jo nezinu kaa tas rakstaas.. :) Nu man vajag lai kverijs izvada ierakstu kursh glabaajas vienaa tabulaa bet parametrs peec kura nosaka vinja izvadiishanu glabaajas otraa... tabulaa preces glabaajas ieraksts brends, kas buutiibaa ir vienaads ar tabulaa brendi glabaajamo brenda id... bet shos parametrus kaads tieshi ir id sanjem cau GET... tagad jautaajums - kaa to panaakt? Pats nesaprotu ko sarakstiiju, bet varbuut citc sapratiis! ;)
Venom Posted October 15, 2004 Report Posted October 15, 2004 tā pati kļūda - skaties String sintaksi. echo 'text '.$variable.' text'; echo "text $variable text"; почувствуй разницу! (с)
Snukzz Posted October 15, 2004 Author Report Posted October 15, 2004 ne jau taa... ska -- $res=mysql_query('SELECT nos, art, kat_id, sub_kat_id, id, stock FROM preces WHERE stock = 1 AND sub_kat_id='.$sub_kat_id); <-- sitas izvada normaalus datus $res=mysql_query('SELECT preces.nos, preces.art, preces.kat_id, preces.sub_kat_id, preces.id, preces.stock, preces.brends, brendi.id, brendi.nos FROM preces, brendi WHERE preces.stock = 1 AND preces.sub_kat_id=.$sub_kat_id AND preces.brends='.$list); <---sitas nee почувствуй разницу! :P
Venom Posted October 15, 2004 Report Posted October 15, 2004 a es saku - paņem editoru, kas iekŗaso sintaksi. http://venom.venta.lv/stats/syn.gif - tas, kas žaļš, tiek nodots mysql pa tiešo un mainīgais arī netiks nodots. Zemāk tā kā vajag. Ar pašu kvēriju viss vairāk vai mazāk varētu būt ok (nb: var izmantot arī SELECT preces.*, brendi.* FROM preces, brendi ...)
bubu Posted October 15, 2004 Report Posted October 15, 2004 (edited) Snukzz āksts tu esi, citā threadā jau līdzīga problēma bija, vai arī tu tas biji, neatceros. No tavis paša teksta: $res=mysql_query('SELECT preces.nos, preces.art, preces.kat_id, preces.sub_kat_id, preces.id, preces.stock, preces.brends, brendi.id, brendi.nos FROM preces, brendi WHERE preces.stock = 1 AND preces.sub_kat_id=.$sub_kat_id AND preces.brends='.$list); <---sitas nee ... AND preces.sub_kat_id=.$sub_kat_id AND... ... AND preces.brends='.$list); ... почувствуй разницу pats!! Atšķirību starp =.$sub_kat_id un ='.$list neredzi? un vispār eksistē mysql_error() funkcija, kas pasaka kur vaicājumā ir kļūda! Edited October 15, 2004 by bubu
Snukzz Posted October 15, 2004 Author Report Posted October 15, 2004 ja shitaa $res=mysql_query('SELECT preces.nos, preces.art, preces.kat_id, preces.sub_kat_id, preces.id, preces.stock, preces.brends, brendi.id, brendi.nos FROM preces, brendi WHERE preces.stock = 1 AND preces.sub_kat_id='.$sub_kat_id' AND preces.brends='.$list); ir pareizi, tad vinsh ma izmet erroru Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in D:\WEB\ILB\include\switch_brand.php on line 9 ko shis errors noziimee???
bubu Posted October 15, 2004 Report Posted October 15, 2004 (edited) ... AND preces.sub_kat_id='.$sub_kat_id' AND ... Atšķirību neredzi? Kur strings beidzas un kur sākas? Kā stringus konkatenē laikam vispār neesi redzējis. Tak paņem un palasi kautvai viselemnātrākos PHP sintakses pamatus. Edited October 15, 2004 by bubu
Gacha Posted October 15, 2004 Report Posted October 15, 2004 '.$sub_kat_id' tev neliekas, ka aiz to $sub_kat_id vajadzētu punktu? Punkti jaliek pirms un pēc mainīgā! PS. Nesaprotu, kapec bubu tads slikts garigais :D
bubu Posted October 15, 2004 Report Posted October 15, 2004 Gacha, sāk jau besīt šitādi sintakses jautājumi. Tak visulaiku to pilns ka biezs. Neviens pats negrib meklēt problēmas un mācīties, bet tikai gatavu skriptu dabūt, po kā. Un sliktākais, ka negrib ievērot savas kļūdas, kautvai ar pirkstu rāda kur! Neviens tak citu vietā kodu nerakstīs.
Snukzz Posted October 15, 2004 Author Report Posted October 15, 2004 bubuuuu....nedusmojies.... nevisem dots tik aatri saprast... ;) tip kljuudu atrisinaaju, taga skataiishos kas no taa visa sanaaks... :D
bubu Posted October 15, 2004 Report Posted October 15, 2004 tip kljuudu atrisinaaju Nē, tu neatrisināji. Gacha priekšā visu uzrakstīja.
Recommended Posts