Skip to main content
added 219 characters in body
Source Link
Sergiu Costas
  • 560
  • 4
  • 9
  • 26

Please help me, I am new in this field trying to understand how to achieve updating a column from table with Numbering of each row from that table. (from 1 to ~).
Table name PRODUCTS.
Column name NUMBER.
I want to mention from that the start that Field Number is totally different from the ID. Products are inserting and deleting and ID is autoincrementing. But Field Number is UPDATING with the number of rows. So I want to achieve to have a button while submiting to update the field Number with corespondent number of rows.

Please suggest some PHP/MySql script which could help me to update the Field NUMBER with numbers. I would much appreciate any of your suggestion. Thank you in advance!

Something should be in my opinon i=0 and then i++My script is wrong:

$rank="0"; $q = mysql_query("SELECT NUMBER FROM PRODUCTS"); $productCount = mysql_num_rows($q); if ($productCount > 0) { while($row = @mysql_fetch_row($q)){ mysql_query("update PRODUCTS set NUMBER=$rank++ where ID IS NOT NULL"); } 

edited: Database now:

ID NAME NUMBER ________________ 201 Apple 3 203 Orange 5 204 Grape 17 

should be after updating:

ID NAME NUMBER ________________ 201 Apple 1 203 Orange 2 204 Grape 3 

Please help me, I am new in this field trying to understand how to achieve updating a column from table with Numbering of each row from that table. (from 1 to ~).
Table name PRODUCTS.
Column name NUMBER.
I want to mention from that the start that Field Number is totally different from the ID. Products are inserting and deleting and ID is autoincrementing. But Field Number is UPDATING with the number of rows. So I want to achieve to have a button while submiting to update the field Number with corespondent number of rows.

Please suggest some PHP/MySql script which could help me to update the Field NUMBER with numbers. I would much appreciate any of your suggestion. Thank you in advance!

Something should be in my opinon i=0 and then i++

edited: Database now:

ID NAME NUMBER ________________ 201 Apple 3 203 Orange 5 204 Grape 17 

should be after updating:

ID NAME NUMBER ________________ 201 Apple 1 203 Orange 2 204 Grape 3 

Please help me, I am new in this field trying to understand how to achieve updating a column from table with Numbering of each row from that table. (from 1 to ~).
Table name PRODUCTS.
Column name NUMBER.
I want to mention from that the start that Field Number is totally different from the ID. Products are inserting and deleting and ID is autoincrementing. But Field Number is UPDATING with the number of rows. So I want to achieve to have a button while submiting to update the field Number with corespondent number of rows.

Please suggest some PHP/MySql script which could help me to update the Field NUMBER with numbers. I would much appreciate any of your suggestion. Thank you in advance!

My script is wrong:

$rank="0"; $q = mysql_query("SELECT NUMBER FROM PRODUCTS"); $productCount = mysql_num_rows($q); if ($productCount > 0) { while($row = @mysql_fetch_row($q)){ mysql_query("update PRODUCTS set NUMBER=$rank++ where ID IS NOT NULL"); } 

edited: Database now:

ID NAME NUMBER ________________ 201 Apple 3 203 Orange 5 204 Grape 17 

should be after updating:

ID NAME NUMBER ________________ 201 Apple 1 203 Orange 2 204 Grape 3 
added 4 characters in body
Source Link
Sergiu Costas
  • 560
  • 4
  • 9
  • 26

Please help me, I am new in this field trying to understand how to achieve updating a column from table with Numbering of each row from that table. (from 1 to ~).
Table name PRODUCTS.
Column name NUMBER.
I want to mention from that the start that Field Number is totally different from the ID. Products are inserting and deleting and ID is autoincrementing. But Field Number is UPDATING with the number of rows. So I want to achieve to have a button while submiting to update the field Number with corespondent number of rows.

Please suggest some MySqlPHP/MySql script which could help me to update the Field NUMBER with numbers. I would much appreciate any of your suggestion. Thank you in advance!

Something should be in my opinon i=0 and then i++

edited: Database now:

ID NAME NUMBER ________________ 201 Apple 3 203 Orange 5 204 Grape 17 

should be after updating:

ID NAME NUMBER ________________ 201 Apple 1 203 Orange 2 204 Grape 3 

Please help me, I am new in this field trying to understand how to achieve updating a column from table with Numbering of each row from that table. (from 1 to ~).
Table name PRODUCTS.
Column name NUMBER.
I want to mention from that the start that Field Number is totally different from the ID. Products are inserting and deleting and ID is autoincrementing. But Field Number is UPDATING with the number of rows. So I want to achieve to have a button while submiting to update the field Number with corespondent number of rows.

Please suggest some MySql script which could help me to update the Field NUMBER with numbers. I would much appreciate any of your suggestion. Thank you in advance!

Something should be in my opinon i=0 and then i++

edited: Database now:

ID NAME NUMBER ________________ 201 Apple 3 203 Orange 5 204 Grape 17 

should be after updating:

ID NAME NUMBER ________________ 201 Apple 1 203 Orange 2 204 Grape 3 

Please help me, I am new in this field trying to understand how to achieve updating a column from table with Numbering of each row from that table. (from 1 to ~).
Table name PRODUCTS.
Column name NUMBER.
I want to mention from that the start that Field Number is totally different from the ID. Products are inserting and deleting and ID is autoincrementing. But Field Number is UPDATING with the number of rows. So I want to achieve to have a button while submiting to update the field Number with corespondent number of rows.

Please suggest some PHP/MySql script which could help me to update the Field NUMBER with numbers. I would much appreciate any of your suggestion. Thank you in advance!

Something should be in my opinon i=0 and then i++

edited: Database now:

ID NAME NUMBER ________________ 201 Apple 3 203 Orange 5 204 Grape 17 

should be after updating:

ID NAME NUMBER ________________ 201 Apple 1 203 Orange 2 204 Grape 3 
added 229 characters in body
Source Link
Sergiu Costas
  • 560
  • 4
  • 9
  • 26

Please help me, I am new in this field trying to understand how to achieve updating a column from table with Numbering of each row from that table. (from 1 to ~).
Table name PRODUCTS.
Column name NUMBER.
I want to mention from that the start that Field Number is totally different from the ID. Products are inserting and deleting and ID is autoincrementing. But Field Number is UPDATING with the number of rows. So I want to achieve to have a button while submiting to update the field Number with corespondent number of rows.

Please suggest some MySql script which could help me to update the Field NUMBER with numbers. I would much appreciate any of your suggestion. Thank you in advance!

Something should be in my opinon i=0 and then i++

edited: Database now:

ID NAME NUMBER ________________ 201 Apple 3 203 Orange 5 204 Grape 17 

should be after updating:

ID NAME NUMBER ________________ 201 Apple 1 203 Orange 2 204 Grape 3 

Please help me, I am new in this field trying to understand how to achieve updating a column from table with Numbering of each row from that table. (from 1 to ~).
Table name PRODUCTS.
Column name NUMBER.
I want to mention from that the start that Field Number is totally different from the ID. Products are inserting and deleting and ID is autoincrementing. But Field Number is UPDATING with the number of rows. So I want to achieve to have a button while submiting to update the field Number with corespondent number of rows.

Please suggest some MySql script which could help me to update the Field NUMBER with numbers. I would much appreciate any of your suggestion. Thank you in advance!

Something should be in my opinon i=0 and then i++

edited: Database now:

ID NAME NUMBER ________________ 201 Apple 3 203 Orange 5 

should be after updating:

ID NAME NUMBER ________________ 201 Apple 1 203 Orange 2 

Please help me, I am new in this field trying to understand how to achieve updating a column from table with Numbering of each row from that table. (from 1 to ~).
Table name PRODUCTS.
Column name NUMBER.
I want to mention from that the start that Field Number is totally different from the ID. Products are inserting and deleting and ID is autoincrementing. But Field Number is UPDATING with the number of rows. So I want to achieve to have a button while submiting to update the field Number with corespondent number of rows.

Please suggest some MySql script which could help me to update the Field NUMBER with numbers. I would much appreciate any of your suggestion. Thank you in advance!

Something should be in my opinon i=0 and then i++

edited: Database now:

ID NAME NUMBER ________________ 201 Apple 3 203 Orange 5 204 Grape 17 

should be after updating:

ID NAME NUMBER ________________ 201 Apple 1 203 Orange 2 204 Grape 3 
added 229 characters in body
Source Link
Sergiu Costas
  • 560
  • 4
  • 9
  • 26
Loading
Source Link
Sergiu Costas
  • 560
  • 4
  • 9
  • 26
Loading