maxbox Posted December 17, 2008 Share Posted December 17, 2008 Hello , i need show in a html page all telephone nummber from tables can you help me db suecia tables user: tel code And my code to conn to db <?php $mysql_host="xxxxxxxxxxx"; $mysql_user="xxxxxx"; $mysql_password="xxxxx"; $mysql_db = "suecia"; $mysql_tables = "user"; $conn = mysql_connect("$mysql_host","$mysql_user","$mysql_password","$mysql_tables"); if (!$conn) { die('Could not connect: ' . mysql_error()); } mysql_select_db($mysql_db,$conn); $result = @mysql_query(SELECT * FROM user); ...................... Quote Link to comment https://forums.phpfreaks.com/topic/137378-solved-help-show-values-from-db/ Share on other sites More sharing options...
premiso Posted December 17, 2008 Share Posted December 17, 2008 <?php $mysql_host="xxxxxxxxxxx"; $mysql_user="xxxxxx"; $mysql_password="xxxxx"; $mysql_db = "suecia"; $mysql_tables = "user"; $conn = mysql_connect("$mysql_host","$mysql_user","$mysql_password","$mysql_tables"); if (!$conn) { die('Could not connect: ' . mysql_error()); } mysql_select_db($mysql_db,$conn); $result = mysql_query("SELECT * FROM user"); while ($row = mysql_fetch_assoc($result)) { echo "User Tel: " . $row['tel'] . " User Code: " . $row['code'] . "<br />"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/137378-solved-help-show-values-from-db/#findComment-717777 Share on other sites More sharing options...
Maq Posted December 17, 2008 Share Posted December 17, 2008 This is one of the most basic extractions from a MySQL database. Please read up on the basics. while($row = mysql_fetch_array($result)) { echo "Tel: " . $row['tel'] . " code: " . $row['code'] . " "; } Quote Link to comment https://forums.phpfreaks.com/topic/137378-solved-help-show-values-from-db/#findComment-717779 Share on other sites More sharing options...
maxbox Posted December 17, 2008 Author Share Posted December 17, 2008 Thank you very much How i can make a link for each telephone nummber something like this : 0853191844 to this adress http://privatpersoner.eniro.se/query?searchword=0853191844&what=wphone Quote Link to comment https://forums.phpfreaks.com/topic/137378-solved-help-show-values-from-db/#findComment-717826 Share on other sites More sharing options...
ngreenwood6 Posted December 17, 2008 Share Posted December 17, 2008 you would just do this: while($row = mysql_fetch_array($result)) { echo "<a href='http://privatpersoner.eniro.se/query?searchword=" . $row['code'] . "&what=wphone'>" . $row['tel'] . "</a>"; } Quote Link to comment https://forums.phpfreaks.com/topic/137378-solved-help-show-values-from-db/#findComment-717833 Share on other sites More sharing options...
maxbox Posted December 17, 2008 Author Share Posted December 17, 2008 Thank you this work fine Quote Link to comment https://forums.phpfreaks.com/topic/137378-solved-help-show-values-from-db/#findComment-717956 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.