Forum     

Go Back   Digit Technology Discussion Forum > Software > Programming
Register FAQ Calendar Mark Forums Read

Programming The destination for developers - C, C++, Java, Python and the lot


Closed Thread
 
LinkBack Thread Tools Display Modes
Old 09-06-2008, 07:21 PM   #1 (permalink)
In The Zone
 
Sridhar_Rao's Avatar
 
Join Date: Feb 2007
Posts: 353
Default help in php and mysql


Dear friends,
I have a unique problem as I am new to mysql and php. don't ask me why I want it that way, but that is my requirement. Please look at the image which will give you clear picture. Anyone with skill in mysql and php is requested to help me in achieving this. Please bear in mind that number of fields is 49, which cannot be changed or split.
__________________
Want to study M.Sc in any medical subjects? Read this www.microrao.com/msc.htm
Microx, a diagnostic microbiology laboratory software application www.labmicrox.com
Sridhar_Rao is offline  
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 18-06-2008, 05:49 PM   #2 (permalink)
Right Off the Assembly Line
 
Join Date: Jun 2008
Posts: 1
Default Re: help in php and mysql

If your problem is writing long code with same kind of variable name, you can use $$variable facility in PHP.

or you can do it in a loop using mysql_fetch_fields() function to get all fields dynamically


http://dev.mysql.com/doc/refman/5.0/...ch-fields.html
If it is not your problem, please tell me where you stuck actually? Where should I help?
pknissar is offline  
Old 26-06-2008, 11:35 PM   #3 (permalink)
In The Zone
 
Sridhar_Rao's Avatar
 
Join Date: Feb 2007
Posts: 353
Default Re: help in php and mysql

Never mind Pknissar, I figured it out myself.
I was using crude ways to get it done and was hoping someone would point me a simple way of doing it. My first script in achieving this ran over 100 hundred lines, now I reduced it to 15 lines.
__________________
Want to study M.Sc in any medical subjects? Read this www.microrao.com/msc.htm
Microx, a diagnostic microbiology laboratory software application www.labmicrox.com
Sridhar_Rao is offline  
Old 27-06-2008, 12:14 AM   #4 (permalink)
हॉर्न ओके प्लीज़
 
victor_rambo's Avatar
 
Join Date: Sep 2007
Posts: 1,493
Default Re: help in php and mysql

For 1st problem, it can be achieved in a single SQL query:
[CODE
$sql="UPDATE table_name SET product=test1*test2*test3*test4*......*test49 WHERE id='$id'";

//You may use a loop to create the test1*test2*test3*... part of the SQL
[/CODE]


For the 2nd question, gues you will have to do it manually by fetching values and deriving from them.
__________________
विक्टर रॅंबो - चाणकया प्रभावित व्यक्ति

गीक होना माँगता
victor_rambo is offline  
Closed Thread

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
php+mySQL help.. the.kaushik Open Source 3 28-02-2007 05:07 PM
Mysql Help Desi-Tek.com Open Source 4 27-11-2006 12:24 PM
php and mysql arunks QnA (read only) 3 12-08-2006 07:58 PM
MySQL - GUI / CLI Trinity QnA (read only) 7 23-07-2005 07:25 PM
SQL & MySQL Trinity QnA (read only) 2 05-07-2005 07:58 PM

 
Latest Threads
- by Sujeet
- by clmlbx
- by Sujeet
- by icebags

Advertisement




All times are GMT +5.5. The time now is 11:03 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2