Jump to content
php.lv forumi

Kur ir kluda


tk1

Recommended Posts

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

Link to comment
Share on other sites

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 by bubu
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 =[

Link to comment
Share on other sites

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 by tk1
Link to comment
Share on other sites

<?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??

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 4 weeks later...

<?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!

Link to comment
Share on other sites

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";

Link to comment
Share on other sites

×
×
  • Create New...