Jump to content

how can access to this column variable sql by php


fafa0

Recommended Posts

Hello
 
I want receive "5" from column "mycol" in record with id ="20" in table "mytable" in database "mydb"
I want to change "5" to "0" with "PHP" code . but I can't ?
 
IF it possible help me ,please. ::)
 
as show in this pic:

 

 

 

60525318616046058944.png

Link to comment
Share on other sites

Help you with what? You neither posted the code nor described the problem. Remember: We're not sitting next to you, we don't see what you see.

 

Right now, all I can say is that your database layout is broken. So your first steps would be to learn the basics of normalization and then restructure your database. Maybe that also solves your current problem (whatever that is).

Link to comment
Share on other sites

Help you with what? You neither posted the code nor described the problem. Remember: We're not sitting next to you, we don't see what you see.

 

Right now, all I can say is that your database layout is broken. So your first steps would be to learn the basics of normalization and then restructure your database. Maybe that also solves your current problem (whatever that is).

 

How can I call "5" from id=20 as show in pic . I want to update e.x.: 5 to 0 . 

 

05212934913433207995.png

 

I  attached sql file too.

mydb.zip

Link to comment
Share on other sites

You should take Jacques1 advice and normalize your data. Updating values within a value is bad practice 

 

But for now you can do the replacement using a query like

UPDATE mytable SET space = REPLACE(space, ' 5 ', ' 0 ') WHERE id = 20

The query will update the row where id = 20 and replace (space)5(space) with  (space)0(space)

If we didn't pad 5 with spaces it will replace all instances of 5 to 0, eg 15 will become 10

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.