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!
<?php
include ( "defaults.php" );
include ( "connect.php" );
mysql_query("SELECT useremail FROM email WHERE emailname=1") or die (mysql_error());
$result=mysql_query($query);
echo $result;
mysql_close();
exit();
?>
Hi, I've got a valid entry in the database where emailname = 1 and an email address has been set in field useremail but the page prints nothing, any ideas??
Thanks, but it still displays absolutely nothing... literally all I won't to do is display one field from the MYSQL DB! Is there anyway I can re-write this code altogether? I can't see any reason why it shouldn't work though.... Could it be anything to do with the settings for the fields in the database?
Table Properties
Properties of the table 'email' are shown below
Field Type Null Key Default Extra Action
emailname int(11) MUL auto_increment Change Drop Primary Index Unique
useremail text YES Change Drop Primary Index Unique
Keys Key name Unique Field Action
emailname NO emailname Drop
oh yea, it should be printing someones email address by the way..
The page now just produces the same ID error everytime, the problem must be on
$query = "SELECT useremail FROM email WHERE emailname = '1'";
but it seems incredibly basic??
your code didn't work because you run a mysql query, do not store the returned value, then run another query with a nonexistant variable, storing that return. That return, if it had anything would also print "Resource Id #X"..