Jump to content

update inw3school


TheCatapult

Recommended Posts

Hi friends! I used the Update code written at W3Schools.Here's my new code.

<?php$con = mysql_connect("","","");if (!$con)  {  die('Could not connect: ' . mysql_error());  }mysql_select_db("", $con);mysql_query("UPDATE diskjockey1 SET jockey=no djWHERE id='0'");mysql_close($con);?>

I'm wondering why it does not change the value in jockey? Thanks!

Link to comment
Share on other sites

There are so many things that could've gone wrong...1. You may not have enabled the MySQL extension. Check your php.ini file.2. You haven't entered any host, username and password for MySQL. At least not in the example you're giving here. If you've enabled the MySQL extension and this is the problem, you should be seeing the "Count not connect" message.3. You haven't specified any DB at mysql_select_db() either. That's in this example at least.4. Are you sure the table "diskjockey1" exist in your DB (whichever it is)?5. Are you sure the column "id" is a (VAR)CHAR column? It's typically int, and if that's the case, you must remove the apostrophes around it, i.e.

WHERE id=0

6. Are you sure the entry you want to update actually has an ID with a value of 0?7. MOST LIKELY REASON: Assuming that "jockey" is a (VAR)CHAR column, you must enclose it its value in apostrophes, i.e.

SET jockey='no dj'

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...