xerts Posted May 23, 2007 Report Share Posted May 23, 2007 Sveiks man ir jautajums ka var iznemt datus no vienas db un no otras piemeram DB_country country_id 1 country_name Latvia country_img lv.gif DB_users user_id 1 user_name xerts user_country 1 Ka man izdarit lai viss sanaktu pareizi un beigu beigas man sanaktu lv karodzinsh un blakus uzrakstita valsts .... $result = dbquery("SELECT u.user_id, u.user_country, u.user_name, c.country_id, c.country_name, c.country_img FROM DB_users AS u LEFT JOIN DB_country AS c ON (c.country_id=u.user_country) WHERE .............................. " while ($data = dbarray($result)) ); palidziet ludzu Link to comment Share on other sites More sharing options...
andrisp Posted May 23, 2007 Report Share Posted May 23, 2007 Kas tev īsti nesanāk ? Ja tev vajag lai izdod visus lietotājus, tad novāc to WHERE vispār. Ja vajag, lai tikai vienam, tad pieliec WHERE u.user_id = 1 Link to comment Share on other sites More sharing options...
xerts Posted May 23, 2007 Author Report Share Posted May 23, 2007 man vajag ja es ieeju kadam profila .... tad lai liek vinja id un vinja izveleto valsti raksta un parada karodzinu Link to comment Share on other sites More sharing options...
andrisp Posted May 23, 2007 Report Share Posted May 23, 2007 nu tad pieliec to WHERE. Kur īsti problēma ? Karodziņu "izdrukā" ar <img>. Link to comment Share on other sites More sharing options...
xerts Posted May 23, 2007 Author Report Share Posted May 23, 2007 es zinu bet kad es izdaru shita $result = dbquery( "SELECT u.user_id,u, user_name, u.user_country.c.country_id, c.country_name, c.country_image FROM ".PREFIX."users AS u LEFT JOIN ".PREFIX."country AS c ON (u.user_country=c.country_name) where u.user_id='$userdata[user_id]'" ); while ($data = dbarray($result)) { <img src='/img/flags/".$data['country_image']."'> '".$userdata['user_country']."'</td> izmet kljudu } Link to comment Share on other sites More sharing options...
andrisp Posted May 23, 2007 Report Share Posted May 23, 2007 Tāpēc, ka tu jauc html tagus kopā ar php kodu. <?php $result = dbquery( "SELECT u.user_id,u, user_name, u.user_country.c.country_id, c.country_name, c.country_image FROM ".PREFIX."users AS u LEFT JOIN ".PREFIX."country AS c ON (u.user_country=c.country_name) where u.user_id='$userdata[user_id]'" ); while ($data = dbarray($result)) { echo "<img src='/img/flags/".$data['country_image']."'> '".$userdata['user_country']."'</td>"; } ?> Link to comment Share on other sites More sharing options...
xerts Posted May 23, 2007 Author Report Share Posted May 23, 2007 Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /www/www.esport.lv/profile/edit/index.php on line 66 66: "SELECT u.user_id,u, user_name, u.user_country.c.country_id, Link to comment Share on other sites More sharing options...
andrisp Posted May 23, 2007 Report Share Posted May 23, 2007 Nu konkrēti šajā koda gabalā ko pārpeistoju sintakses kļūdu nav (kaut gan redzams, ka kverijs ir līks). Kļūda ir citur. Link to comment Share on other sites More sharing options...
mixis Posted May 23, 2007 Report Share Posted May 23, 2007 Ir gan tur kļuda. Viena punkta vietā vajag komatu. Link to comment Share on other sites More sharing options...
xerts Posted May 23, 2007 Author Report Share Posted May 23, 2007 kur konkreti ? Link to comment Share on other sites More sharing options...
andrisp Posted May 23, 2007 Report Share Posted May 23, 2007 mixis, sintakses kļūdu nav, pārbaudīju ar pārseri. Bet tas, ka kverijs nepareizs, jau teicu. u.user_id,u, user_name, u.user_country.c.country_id, vietā u.user_id, u.user_name, u.user_country, c.country_id, Link to comment Share on other sites More sharing options...
xerts Posted May 23, 2007 Author Report Share Posted May 23, 2007 nez galigi stupcela Link to comment Share on other sites More sharing options...
mixis Posted May 23, 2007 Report Share Posted May 23, 2007 nez galigi stupcela Varbūt vispirms palasīt pamācības, pakodēt kaut kādus vienkāršus piemēriņus un tikai tad bliezt augšā lielākus projektus. Link to comment Share on other sites More sharing options...
xerts Posted May 23, 2007 Author Report Share Posted May 23, 2007 mixis es neesmu jauninajs ... vnk uz visiem veidiem ... man parada syntax error ',' or ';' ...... Link to comment Share on other sites More sharing options...
andrisp Posted May 23, 2007 Report Share Posted May 23, 2007 xerts, meklē kur trūkst. Nu ja galīgi esi izmisumā, tad iemet visu skriptu iekš paste.php.lv, mēģināsim apskatīt. Link to comment Share on other sites More sharing options...
Recommended Posts