beboo002 Posted August 31, 2007 Share Posted August 31, 2007 hello freaks i hav wrritten a script which is show the name via mysql database now i want each time its show only two name and after refresh the page Previous name replace to next new two name. here i am paste my script which show one name and after each refresh it print new name. <?php $link=mysql_connect("localhost","root",""); if(!$link) die("can not connect to mysql"); mysql_select_db("timesheet",$link); $sql2="select firstName from employeeinfo order by rand() "; $result2=mysql_query($sql2,$link) or die("Error: ". mysql_error(). " with query ". $sql2); $query1=mysql_fetch_array($result2); echo "<table border=1 align = center>"; echo $query1['firstName']; echo "</table>"; mysql_close($link); ?> Quote Link to comment https://forums.phpfreaks.com/topic/67409-solved-php-mysql-problem/ Share on other sites More sharing options...
Psycho Posted August 31, 2007 Share Posted August 31, 2007 <?php $link=mysql_connect("localhost","root",""); if(!$link) die("can not connect to mysql"); mysql_select_db("timesheet",$link); $query = "SELECT firstName FROM employeeinfo ORDER BY RAND() LIMIT 2" $result=mysql_query($query, $link) or die("Error: ". mysql_error(). " with query ". $query); echo "<table border=\"1\" align=\"center\">"; while ($record = mysql_fetch_assoc($result)) { echo "<tr><td>{$record['firstname']}</td></tr>"; } mysql_close($link); ?> Quote Link to comment https://forums.phpfreaks.com/topic/67409-solved-php-mysql-problem/#findComment-338421 Share on other sites More sharing options...
beboo002 Posted August 31, 2007 Author Share Posted August 31, 2007 thanks mjdamodo for prompt peply Quote Link to comment https://forums.phpfreaks.com/topic/67409-solved-php-mysql-problem/#findComment-338424 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.