almightyegg Posted January 15, 2007 Share Posted January 15, 2007 I have a persons profile page and they have an option of 3 custom fields, and this sees if they have filled anything in or not etc:[code=php:0]<? if($profile['customt1'] == 0){}else{ ?><tr><td valign="top"><b><? echo "$profile[customt1]"; ?></b> </td><td valign="top"><? echo "<p>$profile[customtext1]</p>"; ?></td></tr><? } if($profile['customt2'] == 0){}else{ ?><tr><td valign="top"><b><? echo "$profile[customt2]"; ?></b></td><td valign="top"><? echo "<p>$profile[customtext2]</p>"; ?></td></tr><? } if($profile['customt3'] == 0){}else{ ?><tr><td valign="top"><b><? echo "$profile[customt3]"; ?></b> </td><td valign="top"><? echo "<p>$profile[customtext3]</p>"; ?></td></tr><? } ?></table>[/code]hellllppp!! ??? Quote Link to comment Share on other sites More sharing options...
paul2463 Posted January 15, 2007 Share Posted January 15, 2007 what are you checking for???what do you need???I dont understand what you want Quote Link to comment Share on other sites More sharing options...
almightyegg Posted January 15, 2007 Author Share Posted January 15, 2007 well, I want it to echo out those 3 custom bits which are in my database, and they are not equal to 0 so they should show, except they don't show anything Quote Link to comment Share on other sites More sharing options...
simcoweb Posted January 15, 2007 Share Posted January 15, 2007 For it to 'echo' you need to run a query. Do you have a query code established? Quote Link to comment Share on other sites More sharing options...
almightyegg Posted January 15, 2007 Author Share Posted January 15, 2007 what, you mean a query for it to recognise $profile and associated in that row??well yes I've used alsorts of $profile[?] stuff on this page Quote Link to comment Share on other sites More sharing options...
simcoweb Posted January 15, 2007 Share Posted January 15, 2007 I mean a query to the database. You have to summon the data first then echo the data in the page. Post your MySQL query code so we can take a look at it. Quote Link to comment Share on other sites More sharing options...
almightyegg Posted January 16, 2007 Author Share Posted January 16, 2007 This?[code=php:0]$GET = $id;$first = "SELECT * FROM users WHERE id = '$GET'";$second = mysql_query($first);$profile = mysql_fetch_assoc($second);[/code] Quote Link to comment Share on other sites More sharing options...
simcoweb Posted January 16, 2007 Share Posted January 16, 2007 I believe that should be written like this:$id = $_GET['id];$first = "SELECT * FROM users WHERE id='$id'";The $_GET snags the id from the url assuming you're passing the id in the url like this:http://www.yoursitename.com/somefile.php?id=XXXXX Quote Link to comment Share on other sites More sharing options...
almightyegg Posted January 16, 2007 Author Share Posted January 16, 2007 no change in anything ??? everything is exactly the same...it's an error in this i think:[code=php:0]<? if($profile['customt1'] == 0){echo gah;}else{ ?><tr><td valign="top"><b><? echo "$profile[customt1]"; ?></b> </td><td valign="top"><? echo "<p>$profile[customtext1]</p>"; ?></td></tr><? } if($profile['customt2'] == 0){echo gah;}else{ ?><tr><td valign="top"><b><? echo "$profile[customt2]"; ?></b></td><td valign="top"><? echo "<p>$profile[customtext2]</p>"; ?></td></tr><? } if($profile['customt3'] == 0){echo gah;}else{ ?><tr><td valign="top"><b><? echo "$profile[customt3]"; ?></b> </td><td valign="top"><? echo "<p>$profile[customtext3]</p>"; ?></td></tr><? } ?>[/code] Quote Link to comment Share on other sites More sharing options...
almightyegg Posted January 16, 2007 Author Share Posted January 16, 2007 I thought it may be to do with layout of it so i changed it to this:[code=php:0]<? if($profile['customt1']==0){echo "gah";}else{ ?><tr><td valign="top"><b><? echo "$profile[customt1]"; ?></b> </td><td valign="top"><? echo "<p>$profile[customtext1]</p>"; ?></td></tr><? } if($profile['customt2']==0){echo "gah";}else{ ?><tr><td valign="top"><b><? echo "$profile[customt2]"; ?></b></td><td valign="top"><? echo "<p>$profile[customtext2]</p>"; ?></td></tr><? } if($profile['customt3']==0){echo "gah";}else{ ?><tr><td valign="top"><b><? echo "$profile[customt3]"; ?></b> </td><td valign="top"><? echo "<p>$profile[customtext3]</p>"; ?></td></tr><? } ?>[/code] Quote Link to comment Share on other sites More sharing options...
almightyegg Posted January 21, 2007 Author Share Posted January 21, 2007 anyone? 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.