tk1 Posted September 8, 2006 Report Posted September 8, 2006 nju sanaca kodins : <?php // Connecting, selecting database $link = mysql_connect('localhost', 'lietotajvards', 'parole') or die('Could not connect: ' . mysql_error()); echo 'Connected successfully'; mysql_select_db('reg') or die('Could not select database'); // Performing SQL query $query ='SELECT `ft_user_accounts`.`username` ORDER BY datums DESC LIMIT 10'; $result = mysql_query($query) or die('Query failed: ' . mysql_error()); // Printing results in HTML echo "<table>\n"; while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "\t<tr>\n"; foreach ($line as $col_value) { echo "\t\t<td>$col_value</td>\n"; } echo "\t</tr>\n"; } echo "</table>\n"; // Free resultset mysql_free_result($result); // Closing connection mysql_close($link); ?> bet man rada : Connected successfullyQuery failed: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY datums DESC LIMIT 10' at line 1
bubu Posted September 8, 2006 Report Posted September 8, 2006 RTFM: http://dev.mysql.com/doc/refman/5.0/en/select.html hints: FROM P.S. nākamreiz pats lieto [ code ] bbtagu.
koko Posted September 8, 2006 Report Posted September 8, 2006 Bubu, zb jau :D Vienmēr paspēj pirmais :DDDD
tk1 Posted September 8, 2006 Author Report Posted September 8, 2006 (edited) mos tomer kludu kads izlabos man kautkas neaiziet :D <?php // Connecting, selecting database $link = mysql_connect('localhost', 'tk1', 'chester') or die('Could not connect: ' . mysql_error()); echo 'Connected successfully'; mysql_select_db('reg') or die('Could not select database'); // Performing SQL query $query ='SELECT * FORM `ft_user_accounts`.`username` ORDER BY datums DESC LIMIT 10'; $result = mysql_query($query) or die('Query failed: ' . mysql_error()); // Printing results in HTML echo "<table>\n"; while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "\t<tr>\n"; foreach ($line as $col_value) { echo "\t\t<td>$col_value</td>\n"; } echo "\t</tr>\n"; } echo "</table>\n"; // Free resultset mysql_free_result($result); // Closing connection mysql_close($link); ?> tapat rada Connected successfullyQuery failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FORM `ft_user_accounts`.`username` ORDER BY datums DESC LIMIT 10' at line 1 Edited September 8, 2006 by bubu
bubu Posted September 8, 2006 Report Posted September 8, 2006 Atrodi trīs atšķirības (nu labi, labi - vienu): hints: FROM un // Performing SQL query$query ='SELECT * FORM `ft_user_accounts`.`username` ORDER BY datums DESC LIMIT 10'; Atkārtošos: lieto [ code ] BBTAGU! Pēdējo reizi laboju tavus postus.
tk1 Posted September 8, 2006 Author Report Posted September 8, 2006 Connected successfullyQuery failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FORM `ft_user_accounts`.`username` ORDER BY datums DESC LIMIT 10' at line 1 kluda nemainas es ta4 tev ar to teicu ka es izlaboju a vins neko nedara lietas laba =[
bubu Posted September 8, 2006 Report Posted September 8, 2006 Tu esi stulbs vai izliecies? lasi pa burtiem: F-R-O-M.
tk1 Posted September 8, 2006 Author Report Posted September 8, 2006 (edited) Connected successfullyQuery failed: Table 'ft_user_accounts.username' doesn't exist kipa es domaju table ft_user_accounts un taja ieksa ir sadala username man vajag tos pedejos 10 username tikai bet taja ft_user_accounts ir ari pass utt!! palidziet ludzu ;( <?php // Connecting, selecting database $link = mysql_connect('localhost', 'lietotv', 'parol') or die('Could not connect: ' . mysql_error()); echo 'Connected successfully'; mysql_select_db('reg') or die('Could not select database'); // Performing SQL query $query ='SELECT * FROM `ft_user_accounts`.`username` ORDER BY datums DESC LIMIT 10'; $result = mysql_query($query) or die('Query failed: ' . mysql_error()); // Printing results in HTML echo "<table>\n"; while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "\t<tr>\n"; foreach ($line as $col_value) { echo "\t\t<td>$col_value</td>\n"; } echo "\t</tr>\n"; } echo "</table>\n"; // Free resultset mysql_free_result($result); // Closing connection mysql_close($link); ?> Edited September 8, 2006 by tk1
tk1 Posted September 8, 2006 Author Report Posted September 8, 2006 <?php // Connecting, selecting database $link = mysql_connect('localhost', 'niks', 'pass') or die('Could not connect: ' . mysql_error()); echo '15 Jaunakie lietotaji :'; mysql_select_db('reg') or die('Could not select database'); // Performing SQL query $query = 'SELECT `username` FROM `ft_user_accounts` LIMIT 0, 15'; $result = mysql_query($query) or die('Query failed: ' . mysql_error()); // Printing results in HTML echo "<table>\n"; while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "\t<tr>\n"; foreach ($line as $col_value) { echo "\t\t<td>$col_value</td>\n"; } echo "\t</tr>\n"; } echo "</table>\n"; // Free resultset mysql_free_result($result); // Closing connection mysql_close($link); ?> amm nu sitads variants man iet bet vins nekarto 15 jaunakos bet 15 pirmos, ka uzlikt lai karto un neraditu erroru??
Delfins Posted September 9, 2006 Report Posted September 9, 2006 bugagā. paaudzies vispirms - palasi grāmatas par algoritmiem, tehnoloģijām. Un tikai tad raksti selektus. Izskatās, ka tu vispār kopē kodu no kaut kurienes un pats īsti nesaprot, ko tas dara... vari atšķirt tikai kur ir tukša rinda :) bezjēga ir šitāda trilināšana pa forumu
tk1 Posted September 10, 2006 Author Report Posted September 10, 2006 aga tad pasties http://sammuner.mixers.be
bubu Posted September 10, 2006 Report Posted September 10, 2006 Paskaties pats: http://dev.mysql.com/doc/refman/5.0/en/select.html
tk1 Posted September 10, 2006 Author Report Posted September 10, 2006 nja ;) paldies, es ta4 tik macos ''delfin'' nevajag tak dirst virsu !!! Es tik tiko iemacijos rikoties ar php kopa ar mysql ;)
tk1 Posted October 8, 2006 Author Report Posted October 8, 2006 <?php // Connecting, selecting database $link = mysql_connect('localhost', 'root', 'pass') or die('Could not connect: ' . mysql_error()); echo '150 Jaunakie lietotaji :'; mysql_select_db('reg') or die('Could not select database'); // Performing SQL query $query = 'SELECT `niks` FROM `registracija` LIMIT 0, 150'; $result = mysql_query($query) or die('Query failed: ' . mysql_error()); // Printing results in HTML echo "<table>\n"; while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "\t<tr>\n"; foreach ($line as $col_value) { echo "\t\t<td>$col_value</td>\n"; } echo "\t</tr>\n"; } echo "</table>\n"; // Free resultset mysql_free_result($result); // Closing connection mysql_close($link); ?> Varat ieet paskatities http://tkd.1.vg/indexmember.php visus userus vins karto stabinja bet man vajadzetu lai kartotu piem tk1, jankr utt ka to panakt itka ko jamaina te // Printing results in HTML echo "<table>\n"; while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "\t<tr>\n"; foreach ($line as $col_value) { echo "\t\t<td>$col_value</td>\n"; } echo "\t</tr>\n"; } echo "</table>\n"; bet sito php tik labi nezsaprotu!
tk1 Posted October 8, 2006 Author Report Posted October 8, 2006 jakadam vajag tas izstas sadi // Printing results in HTML echo "<p>\n"; while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "\t<tr>\n"; foreach ($line as $col_value) { echo "\t\t<td>$col_value</td>,\n"; } echo "\t</tr>\n"; } echo "</table>\n";
Recommended Posts