KasparsM Posted December 29, 2010 Report Share Posted December 29, 2010 (edited) Sveiki, No PHP gandrīz neko nezinu, pēc pamācības aptuveni uzkabināju tabulu, kurā vajadzētu parādīties visiem lietoājiem, vārdam utt. no datubāzes. Viss strādā labi, izņemot to, ka garumzīmes neparādās. Datubāzē garumzīmes ir, tā kā tur nevajadzētu būt vaina. Kāds varētu lūdzu uzmest aci kodam? <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Untitled Document</title> </head> <?php $host="localhost"; // Host name $username="root"; // Mysql username $password=""; // Mysql password $db_name="lost"; // Database name $tbl_name="jos_users"; // Table name // Connect to server and select database. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // Retrieve data from database $sql="SELECT * FROM $tbl_name"; $result=mysql_query($sql); // Start looping rows in mysql database. ?> <table border="1px" cellspacing="0" cellpadding="3"> <tr> <td width="150px"><strong>Vārds</strong></td> <td width="150px"><strong>Uzvārds</strong></td> <td width="150px"><strong>Telefons</strong></td> <td width="150px"><strong>Uzņēmums</strong></td> <td width="150px"><strong>E-pasts</strong></td> </tr> </table> <?php while($rows=mysql_fetch_array($result)){ ?> <table border="1px" cellspacing="0" cellpadding="3"> <tr> <td width="150px"><?php echo $rows['name'];?></td> <td width="150px"><?php echo $rows['surname'];?></td> <td width="150px"><?php echo $rows['username'];?></td> <td width="150px"><?php echo $rows['company'];?></td> <td width="150px"><?php echo $rows['email'];?></td> </tr> </table> <?php } mysql_close(); ?> Edited December 29, 2010 by KasparsM Quote Link to comment Share on other sites More sharing options...
Blitz Posted December 29, 2010 Report Share Posted December 29, 2010 (edited) mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); mysql_query("SET NAMES 'utf8'"); Edited December 29, 2010 by Blitz Quote Link to comment Share on other sites More sharing options...
KasparsM Posted December 29, 2010 Author Report Share Posted December 29, 2010 mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); mysql_query("SET NAMES 'utf8'"); Liels paldies, tikko pats atradu.. Quote Link to comment Share on other sites More sharing options...
KasparsM Posted December 29, 2010 Author Report Share Posted December 29, 2010 (edited) Es tagad vēl izveidoju kolonu - Reģistrācijas laiks. Varbūt var kāds uz ātro pateikt kā visus tos ierakstus var sakārtot pēc reģistrācijas laika, augošā secībā? Atradu pats, paldies! Edited December 29, 2010 by KasparsM Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.