Jump to content

What's Wrong With My Code?


accttech

Recommended Posts

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

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

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...