5 Replies - 872 Views - Last Post: 30 May 2011 - 02:26 AM Rate Topic: -----

#1 dangmnx  Icon User is offline

  • D.I.C Regular

Reputation: -1
  • View blog
  • Posts: 428
  • Joined: 10-April 09

Setting update value

Posted 29 May 2011 - 05:13 AM

My 'members' table values are not updating!

<?php
include('connect.php');

$hacker = $_POST['hacker'];

if ($hacker != 0 ){
mysql_query("UPDATE `members` SET `wins`='0' AND loses='0'  WHERE username='$user'");
}
?>

This post has been edited by Dormilich: 29 May 2011 - 06:04 AM
Reason for edit:: please use [code] /* your code source here */ [/code] tags when posting code

Is This A Good Question/Topic? 0
  • +

Replies To: Setting update value

#2 CTphpnwb  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 3001
  • View blog
  • Posts: 10,393
  • Joined: 08-August 08

Re: Setting update value

Posted 29 May 2011 - 05:25 AM

$user is null.
You shouldn't use query strings directly in a query since it makes it hard to output/error_log the query. If you can't output it you can't see how it got built.


Was This Post Helpful? 1
  • +
  • -

#3 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3541
  • View blog
  • Posts: 10,257
  • Joined: 08-June 10

Re: Setting update value

Posted 29 May 2011 - 06:05 AM

additionally, you have an SQL syntax error.
Was This Post Helpful? 1
  • +
  • -

#4 dangmnx  Icon User is offline

  • D.I.C Regular

Reputation: -1
  • View blog
  • Posts: 428
  • Joined: 10-April 09

Re: Setting update value

Posted 29 May 2011 - 01:24 PM

I still can't get it right, What would be the correct format to set this code up?
Was This Post Helpful? -1
  • +
  • -

#5 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3541
  • View blog
  • Posts: 10,257
  • Joined: 08-June 10

Re: Setting update value

Posted 29 May 2011 - 01:47 PM

the MySQL UPDATE syntax.
Was This Post Helpful? 0
  • +
  • -

#6 calebjonasson  Icon User is offline

  • $bert = new DragonUnicorn(); $bert->rawr();
  • member icon

Reputation: 209
  • View blog
  • Posts: 989
  • Joined: 28-February 09

Re: Setting update value

Posted 30 May 2011 - 02:26 AM

I'm going to give you a hint so you can move along with the project much more quickly.

AND is not used to separate update values.
Compare it to the simple update query here.
http://www.w3schools...ysql_update.asp
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1