Jump to content
php.lv forumi

Recommended Posts

Posted

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

Posted (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 by bubu
Posted

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.

Posted

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

Posted (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 by tk1
Posted

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

Posted

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

Posted

nja ;) paldies, es ta4 tik macos ''delfin'' nevajag tak dirst virsu !!! Es tik tiko iemacijos rikoties ar php kopa ar mysql ;)

  • 4 weeks later...
Posted

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

Posted

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

×
×
  • Create New...