Jump to content

Recommended Posts

hi all

 

i have a field name "detail_description" in my product_table on number 5.

 

i have a field name "product_image" in my product_table on number 11.

 

i want to interchange them and want to move "detail_description" field to number 11 and product_image field to number 5.

 

As some data has been already been added to the database so i dont want to spoil my data.

 

how can i do it safely

 

vineet

Link to comment
https://forums.phpfreaks.com/topic/162725-interchange-fields-place-in-phpmyadmin/
Share on other sites

There shouldn't be a need to 'reorder' the fields of a table, as relational databases are based on sets, which have no order.

 

If you are using mysql_fetch_row(), then rows are returned in a numbered array.  I can see why you might want to change the 'order' of the fields, but why not change the code instead of the database?

 

You can use mysql_fetch_assoc(), which will return the rows as an associative array, and you can access the fields by name.

hi daniel

 

As i m using FCKeditor and image upload fields, so i wanted to upload image before fckeditor content. At present this code uploads the image after fckeditor and the image sometimes get missed somewhere and i have to upload it again. I dont know may be because of the heaviness of fckeditor content, the script times out or what happens but sometimes image misses out.

 

My below code is according to sequence of fields in database. If i add the products according to this sequence then the product gets added successfully but sometimes image misses out and if i change the sequence of fields in this code then i get error. Like if i add 10 products then the 7 times the product get uploaded completely and 3 times the image misses out.

 

$insertqry="insert into product_table(product_date, category_id, dealer_id, product_name, category_name, description, detail_description, cutout_price, price, image, shipping_cost, shipping_detail,warranty,sub_catg) 
values('$product_date',$catid,$dealerid,'$prod_name','$category_name','$prod_desc', '$prod_descbig', 
$prod_cutprice, $prod_price, '$path',$prod_ship,'$shipping_detail','$warranty','$sub_catg')";

 

Does this happen to everyone who changes the sequence of fields or is there any solution. Do you know any light version of fckeditor.

 

vineet

You can enter data into the database in any order.  For example:

 

INSERT INTO table (table1, table2) VALUES ('table1value', 'table2value');

 

is the same as:

 

INSERT INTO table (table2, table1) VALUES ('table2value', 'table1value');

 

 

What I would be focusing on is what is causing the script to timeout or fail.  ie. which out of the 10 records is failing and why

put an or die(mysql_error());

 

after queries they will display any errors that occured in the query which otherwise wouldn't display:

 

 <?php
$insertqry= mysql_query("insert into product_table(product_date, category_id, dealer_id, product_name, category_name, description, detail_description, cutout_price, price, image, shipping_cost, shipping_detail,warranty,sub_catg) 
values('$product_date',$catid,$dealerid,'$prod_name','$category_name','$prod_desc', '$prod_descbig', 
$prod_cutprice, $prod_price, '$path',$prod_ship,'$shipping_detail','$warranty','$sub_catg')") or die(mysql_error());
?>

 

Then post back any error your given. Also why are some $variables in '  '        symbols and others not ?

hi echofool

 

i will surely post back the exact error i get while adding product.

 

secondly

Some $variables are within '   ' symbols 

 

because they are not integers or simply i can say they are not numeric values thats why are within these ' ' symbols.

 

vineet

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.