User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 456,560 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,470 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 518 | Replies: 1 | Solved
Reply
Join Date: Oct 2007
Posts: 37
Reputation: drsmith is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
drsmith drsmith is offline Offline
Light Poster

Problem getting data back from MySQL DB

  #1  
Oct 23rd, 2007
Not sure if this is a PHP or a MySQL problem...I am pretty new at both. Basically I have a .php form that is writing data to the db just fine and most of the data is saving back to the .php file fine. I have several "text" boxes that I am using varchar...as well as some using "text" and int for the db. Anyway...when I got to using "textarea" it fails. Here is a little code from both the _db.php and the .php. Any help would be much appreciated.

From the DB:

$EXT = $_POST[EXT];
$Collab = $_POST[Collab];
$WSR = $_POST[WSR];
$AWIPS = $_POST[AWIPS];
$Other = $_POST[Other];
$Misc = $_POST[Misc];
$Backup = $_POST[Backup];
$dateString = $year."-".$month."-".$day;
$dbhost=$_SERVER['DB_HOST'];
$strConn=@mysql_connect($dbhost,"*******","*******");
mysql_select_db("shift_duties",$strConn);
$table="A_shift_duties";

mysql_query("UPDATE $table SET `month`='$month',`day`='$day',`year`='$year',`LT`='$LT',`ST`='$ST',`HMT`='$HMT',`Sick`='$Sick',`Annual`='$Annual',`Comp`='$Comp',`OT`='$OT',`AFD`='$AFD',`CCF`='$CCF',`ZFP`='$ZFP',`ZON`='$ZON',`PFM`='$PFM',`AFM`='$AFM',`HWO`='$HWO',`FWF`='$FWF',`FWL`='$FWL',`RFI`='$RFI',`RFD`='$RFD',`WXStory`='$WXStory',`RWSKS`='$RWSKS',`SendNDFD`='$SendNDFD',`EXT`='$EXT',`Collab`='$Collab',`WSR`='$WSR',`AWIPS`='$AWIPS',`Other`='$Other',`Misc`='$Misc',`Backup`='$Backup' WHERE `date`='$dateString'") or die (mysql_error());
?>

 

From the .php:

 if($row['Collab'] == ""){
       echo"<td width='794' bgcolor='#C0C0C0'><p>Collaboration:</p><p><textarea name='Collab' cols='69' rows='5' wrap='physical'></textarea></p></td>";
    }else{
       $Collab[$i] = $row['Collab'];
    echo"<td width='794' bgcolor='#C0C0C0'><p>Collaboration:</p><p><textarea name='Collab' cols='69' rows='5' wrap='physical' value='.$Collab[$i].'></textarea></p></td>";
         }

Thanks
DS
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Sep 2007
Location: Budapest
Posts: 252
Reputation: fatihpiristine has a little shameless behaviour in the past 
Rep Power: 0
Solved Threads: 14
fatihpiristine's Avatar
fatihpiristine fatihpiristine is offline Offline
Posting Whiz in Training

Re: Problem getting data back from MySQL DB

  #2  
Oct 23rd, 2007
first: put in this form
$EXT = $_POST['EXT'];

or why dont you use form post method if you are new to this?

$dbhost=$_SERVER['DB_HOST']; =>
$dbbost= "locahost"; #or 127.0.0.1

here what if you same dates on your db...
your record will be involved... track the ID
WHERE `date`='$dateString'")

and if you are trying to post ur sql script before assing the values to those variables.. it will return "ZERO"

u cannot add anyting to textarea like this
' rows='5' wrap='physical' value='.$Collab[$i].'></textarea><

----
<textarea name='Collab' cols='69' rows='5' wrap='physical'> <?php print $Collab[$i] ?>
</textarea>
Do a favour, leave me alone
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb PHP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 5:41 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC