porko2004 Posted August 24, 2011 Share Posted August 24, 2011 <?php require('config.php'); $sql = "SELECT m.Title as title , f.Reg_URL as reg FROM website_main as m JOIN website_front as f LIMIT 0,01 "; $result = @mysql_query($sql) or die(mysql_error()); echo "<table border='3'>"; echo "<font size='9'><tr> <th><FONT COLOR=red><center>Title</center></font></th> <th><FONT COLOR=red>reg</th> </tr></font>"; // keeps getting the next row until there are no more to get while($row = mysql_fetch_array( $result )) { // Print out the contents of each row into a table $reg = $row['reg']; echo "<tr><td bgcolor=''><center>"; echo $row['title']; echo "</td><td bgcolor=''><center>"; echo '.$reg.'; echo "</td></tr>"; } ?> I got a problem i try to use an attribute for $reg but only appears as .$reg. on website anyone know why? Parts i have problems with are $reg = $row['reg']; and echo '.$reg.';. thank you Quote Link to comment https://forums.phpfreaks.com/topic/245566-little-problem/ Share on other sites More sharing options...
WebStyles Posted August 24, 2011 Share Posted August 24, 2011 change this: echo '.$reg.'; to: echo $reg; Quote Link to comment https://forums.phpfreaks.com/topic/245566-little-problem/#findComment-1261253 Share on other sites More sharing options...
porko2004 Posted August 24, 2011 Author Share Posted August 24, 2011 ty Quote Link to comment https://forums.phpfreaks.com/topic/245566-little-problem/#findComment-1261255 Share on other sites More sharing options...
porko2004 Posted August 24, 2011 Author Share Posted August 24, 2011 is it possible to put it into <div class="login"><a title="reg" href="$reg" target="_blank"></a></div>? Quote Link to comment https://forums.phpfreaks.com/topic/245566-little-problem/#findComment-1261258 Share on other sites More sharing options...
WebStyles Posted August 24, 2011 Share Posted August 24, 2011 Sure: html version: <div class="login"><a title="reg" href="<?php echo $reg;?>" target="_blank"></a></div> php version: echo '<div class="login"><a title="reg" href="'.$reg.'" target="_blank"></a></div>'; Quote Link to comment https://forums.phpfreaks.com/topic/245566-little-problem/#findComment-1261260 Share on other sites More sharing options...
porko2004 Posted August 24, 2011 Author Share Posted August 24, 2011 ty so very much Quote Link to comment https://forums.phpfreaks.com/topic/245566-little-problem/#findComment-1261261 Share on other sites More sharing options...
porko2004 Posted August 24, 2011 Author Share Posted August 24, 2011 if i wanna put the script in its own file i put. include ('reg.php'); right so it appears on other page? Quote Link to comment https://forums.phpfreaks.com/topic/245566-little-problem/#findComment-1261273 Share on other sites More sharing options...
WebStyles Posted August 24, 2011 Share Posted August 24, 2011 4 different options: include -- will include the file, and you can add it more times on same page require -- does the same but script will not continue if it cannot find the file include_once -- same as include but will only let you include it once, so no duplications occur require_once -- same as require, but also just once. Quote Link to comment https://forums.phpfreaks.com/topic/245566-little-problem/#findComment-1261276 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.