Jump to content

turning sql into a query


Shadowing

Recommended Posts

having a problem turning this sql into a query and I need it to only update rows where id field is empty.

 

 UPDATE systems SET naqahdah = naqahdah + naqahdah_mines * 2 

 

I tried this out with failure

 <?php mysql_query("UPDATE systems SET naqahdah= naqahdah + naqahdah_mines * 2 WHERE id <> ' ' "); ?> 

 

so i tried getting rid of WHERE and couldnt even get this to work. I tested the sql out it works fine.

 

 <?php mysql_query("UPDATE systems SET naqahdah= naqahdah + naqahdah_mines * 2 "); ?> 

Link to comment
Share on other sites

yah my termnology is nothing short but noob like.

Im getting hit with a syntax issue. unexpected T_STRING

so i guess my problem is how do I turn this SQL statement into a workable string?

 

 UPDATE systems SET naqahdah = naqahdah + naqahdah_mines * 2 

 

updates all naqahdah columns and adds the naqahdah column value plus  naqahdah_mines column * 2 only in rows where id isnt empty. I use dial up so googling is extremly time consusming but so far i think i need () in the math im trying to do here

 

 <?php mysql_query("UPDATE systems SET naqahdah= naqahdah + naqahdah_mines * 2 WHERE id <> ' ' "); ?> 

 

 

 

 

 

Link to comment
Share on other sites

The error you are receiving is a PHP error, not mysql. There is nothing in the code you have provided that would produce that error. PHP will tell you where is halted because of the error, you will often find that the error however occurs a a few lines prior to where PHP halted.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.