Click to See Complete Forum and Search --> : UPDATE statement in mysql


diamonds
08-26-2003, 10:22 AM
I know how to run a SELECT queary in mysql, but how would you execute a update queary?
UPDATE `articles` SET `title` = 'title',`article` = 'article text' WHERE `name` = 'name'

jacen6678
08-26-2003, 10:50 AM
I know how to run a SELECT queary in mysql, but how would you execute a update queary?
UPDATE `articles` SET `title` = 'title',`article` = 'article text' WHERE `name` = 'name'
===============
Try:

UPDATE articles SET title='title', article='article text' WHERE name='name'

I think you were using too many quotes.

diamonds
08-26-2003, 11:28 AM
How do you execute it?
PHP is still looking at it blankly.
$sql = "UPDATE articles SET title = '$title',article = '$article_text' WHERE name = '$name'";
$q = mysql_query($sql);

jacen6678
08-26-2003, 11:40 AM
$sql="UPDATE articles".
" SET title='".$title."', ".
" article='".$article_text."'".
" WHERE name= '".$name."'";

If the query is not the problem, are you sure that the query function is correct? Did you open a connection to the DB, etc?

diamonds
08-26-2003, 11:49 AM
sure.
Ive connected and selected the database.

PHP is not even returning an error.
:confused:

jacen6678
08-26-2003, 11:58 AM
are you using phpMyAdmin? if so, echo the query to screen and paste it into phpMyAdmin's query form... see what happens there.

Can you save the source code as a .txt and attach it here?

diamonds
08-26-2003, 12:03 PM
Funny...
All of a sudden it is working now:confused:

jacen6678
08-26-2003, 12:06 PM
Hahahahaha... computers just dont make sense