accttech Posted June 4, 2009 Share Posted June 4, 2009 Good day,I am new to PHP and SQL and am learning through the W3 Schools Web site.I built an SQL database and am now trying to use PHP and MY SQL code to return simple query results so that I can see the fruits of my labor before I move on to more complex goals.THE CODE:(I modified this code from a W3 Schools example. - NOTE: Lines above and below omitted for security reasons - but I can tell that they work.) $db_selected = mysql_select_db("PLANPAL",$con);$sql = "SELECT * FROM NEW ORLEANS MARRIOTT";$result = mysql_query($sql,$con);$type = mysql_field_type($result, 0);echo $type; THE ERROR MESSAGE:Warning: mysql_field_type(): supplied argument is not a valid MySQL result resource in ... on line 16.Line 16 is the one that begins with the $type variable.Any help any of you could provide would be most appreciated. Link to comment Share on other sites More sharing options...
Beffic Posted June 4, 2009 Share Posted June 4, 2009 Maybe try something like $sql = "SELECT * FROM `NEW ORLEANS MARRIOTT`"; because there is three words in your mysql database name. Link to comment Share on other sites More sharing options...
Synook Posted June 4, 2009 Share Posted June 4, 2009 You can always echo mysql_error() to see what is wrong with your query.By the way it is bad practice to name your tables in uppercase or with multiple words. Link to comment Share on other sites More sharing options...
accttech Posted June 14, 2009 Author Share Posted June 14, 2009 Maybe try something like$sql = "SELECT * FROM `NEW ORLEANS MARRIOTT`"; because there is three words in your mysql database name. Thank you! Link to comment Share on other sites More sharing options...
accttech Posted June 14, 2009 Author Share Posted June 14, 2009 You can always echo mysql_error() to see what is wrong with your query.By the way it is bad practice to name your tables in uppercase or with multiple words. Thank you! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.