PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I'm trying to make my page show an "iframe" if certain parameters is ok, but it doesnt seem to work. Can somebody please guide me in the right direction?
I think that your $currUser['uid'] is an array, (since it seems to contain $currUser['uid']['3d']), which will cause problems if you try and echo it...
GM wrote:I think that your $currUser['uid'] is an array, (since it seems to contain $currUser['uid']['3d']), which will cause problems if you try and echo it...
OK - i was just looking at the code in the iframe part, which says $currUser['uid']['3d'] - which suggested that $currUser['uid'] is an array, and therefore an attempt to echo it would produce 'Array'.
You responded while I was typing, so I didn't see your response before I posted mine. I agree with you that $currUser is probably the problem.
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
OK. Tryid to make an array...
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I want to show all the fields regardless of the "3d" field is set to "yes" or "no". I want to show the iframe if the "3d" is set to "yes". The "3d" field is set to "enum" with a yes/no choice.
$query="SELECT * FROM users WHERE uid='".$uid."'";
$result=mysql_query($query) or die("Unable to find requested user");
$currUser = mysql_fetch_array($result);
if ($currUser['3d'] == "yes") {
echo "iframe";
} else {
echo "no iframe";
}
SUPER!!! It did the job but.... Just one little error left. It gets the iframe but not with the html page it should. It shows the "index" page in the iframe but should be showing something else. Any idea???
Doesn't seem to be it! I tryid to make the source "http://www.cnn.com" but I still got the "index" page??? There must be something wrong in the code. Any idea?