/    Sign up×
Community /Pin to ProfileBookmark

UPDATE statement in mysql

I know how to run a SELECT queary in mysql, but how would you execute a update queary?
[COLOR=darkred]UPDATE `articles` SET `title` = ‘title’,`article` = ‘article text’ WHERE `name` = ‘name’[/COLOR]

to post a comment
PHP

7 Comments(s)

Copy linkTweet thisAlerts:
@jacen6678Aug 26.2003 — 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.
Copy linkTweet thisAlerts:
@diamondsauthorAug 26.2003 — How do you execute it?

PHP is still looking at it blankly.
[code=php]$sql = "UPDATE articles SET title = '$title',article = '$article_text' WHERE name = '$name'";
$q = mysql_query($sql);[/code]
Copy linkTweet thisAlerts:
@jacen6678Aug 26.2003 — $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?
Copy linkTweet thisAlerts:
@diamondsauthorAug 26.2003 — sure.

Ive connected and selected the database.

PHP is not even returning an error.

?
Copy linkTweet thisAlerts:
@jacen6678Aug 26.2003 — 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?
Copy linkTweet thisAlerts:
@diamondsauthorAug 26.2003 — Funny...

All of a sudden it is working now?
Copy linkTweet thisAlerts:
@jacen6678Aug 26.2003 — Hahahahaha... computers just dont make sense
×

Success!

Help @diamonds spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...