Danny620 Posted August 21, 2009 Share Posted August 21, 2009 i no that the script works fine but when u use ' ' to echo something it echos it as it is but how do i make it to echo the table where it also shows the varables i need it to echo the table with the varables <?php require('config.php'); if(isset($_GET[profile])){ $username = $_GET[profile]; $q = "SELECT wins, lose, clan, username FROM test WHERE username = '$username'"; $r = mysqli_query($dbc, $q); $profiletest = mysqli_fetch_array($r, MYSQLI_ASSOC); $q = "SELECT * FROM profile WHERE username = '$username'"; $r = mysqli_query($dbc, $q); $profile = mysqli_fetch_array($r, MYSQLI_ASSOC); echo '<table width="200" border="0" align="center"> <tr> <td width="82"><div align="right">Username:</div></td> <td width="108"><?php echo $profile[username]; ?></td> </tr> <tr> <td><div align="right">Nickname:</div></td> <td><?php echo $profile[nickname]; ?></td> </tr> <tr> <td><div align="right">Clan:</div></td> <td><?php echo $profile[clan]; ?></td> </tr> <tr> <td><div align="right">Wins:</div></td> <td><?php echo $profile[wins]; ?></td> </tr> <tr> <td><div align="right">Lose:</div></td> <td><?php echo $profile[lose]; ?></td> </tr> </table>'; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/171345-solved-need-help/ Share on other sites More sharing options...
Aravinthan Posted August 21, 2009 Share Posted August 21, 2009 I dont understand... The way you are echoing now Should work, But if not try: <?php echo "" .$profile[username]. ""; ?> Quote Link to comment https://forums.phpfreaks.com/topic/171345-solved-need-help/#findComment-903612 Share on other sites More sharing options...
Danny620 Posted August 21, 2009 Author Share Posted August 21, 2009 i need to to echo <?php echo $profile[nickname]; ?> in my table but i think it is beacuse i used '' to echo the table Quote Link to comment https://forums.phpfreaks.com/topic/171345-solved-need-help/#findComment-903616 Share on other sites More sharing options...
Maq Posted August 21, 2009 Share Posted August 21, 2009 echo "</pre> <table width="'200'" border="'0'" align="'center'"> Username: {$profile['username']} Nickname: {$profile['nickname']} Clan: {$profile['clan']} Wins: {$profile['wins']} Lose: {$profile['lose']} </ta Use double quotes for your string, so your variables interpolate. Use single quotes for your attributes. You can utilize curly braces around associative arrays to escape them. You're aready in <?php tags, you can't use them again (near your variables). You also don't need to echo again since all you're really doing is giving echo a long string. Try this and see if it works, good luck. *EDIT: Fixed some associative array syntax. Quote Link to comment https://forums.phpfreaks.com/topic/171345-solved-need-help/#findComment-903619 Share on other sites More sharing options...
Aravinthan Posted August 21, 2009 Share Posted August 21, 2009 Oh of course, Missed that -.- Quote Link to comment https://forums.phpfreaks.com/topic/171345-solved-need-help/#findComment-903622 Share on other sites More sharing options...
Maq Posted August 22, 2009 Share Posted August 22, 2009 Oh of course, Missed that -.- Hehe. Is everything working properly? You should Google "PHP interpolation", and read up on some tutorials. http://www.astahost.com/info.php/Php-Interpolation_t4286.html Quote Link to comment https://forums.phpfreaks.com/topic/171345-solved-need-help/#findComment-903722 Share on other sites More sharing options...
Aravinthan Posted August 22, 2009 Share Posted August 22, 2009 It is not me who has the problem. Lol, So Dany is everything ok? Quote Link to comment https://forums.phpfreaks.com/topic/171345-solved-need-help/#findComment-903919 Share on other sites More sharing options...
Danny620 Posted August 23, 2009 Author Share Posted August 23, 2009 yes thats fixed it sorry i cound't reply quicker beacuse my internet went down for a while Quote Link to comment https://forums.phpfreaks.com/topic/171345-solved-need-help/#findComment-904573 Share on other sites More sharing options...
Maq Posted August 24, 2009 Share Posted August 24, 2009 It is not me who has the problem. Lol, So Dany is everything ok? Whoops, sorry about that Glad everything is working now, Danny. Quote Link to comment https://forums.phpfreaks.com/topic/171345-solved-need-help/#findComment-905047 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.