Mysql

software development

#1

why cant i update mysql database from my web page

i have a database called cbjdfamily and a table called foo with a field labeld hit

what is wrong with this code, note i am not showing the password.

is there more set up i need to do.

<?php $connection = mysql_connect('mysql.cbjdfamily.com', 'cbjdfamily', '*****') or die ("No connection!"); mysql_select_db('cbjdfamily', $connection) or die ("No database!"); $query=("UPDATE count SET hit = 12 "); $result=mysql_query=($query); ?>


#2

Looks like you specify table named ‘count’ instead of ‘foo’. Also looks like there is a trailing space ( which might be harmless ).

Single-table syntax:

UPDATE [LOW_PRIORITY] [IGNORE] tbl_name
SET col_name1=expr1 [, col_name2=expr2 …]
[WHERE where_definition]
[ORDER BY …]
[LIMIT row_count]


#3

Note that “count” is a reserved word in SQL. You may need to change the table name if it is named “count”.

You might try executing the SQL directly using phpmydmin to see what happens.