PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old March 4th, 2005, 06:45 PM
cptn_future cptn_future is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 1 cptn_future User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 10 sec
Reputation Power: 0
Re: Commintg changes to MySql database

Hi all...

Does anyone know the code to commit the changes to MySql data base?
You see, I got the code below, and i want to be able to comit the changes to the Dbase itself, not just the array, so does anyone know how to go about that??
Thanx

<?php
$name = $_POST["name"];
$age = $_POST["age"];
$prov = $_POST["provence"];

mysql_connect ("localhost") or
die ("could not connect to Database");
mysql_select_db("biz") or
die("could not find database");

$query = "insert into inof(name,age,prov) values ('$name','$age','$prov')";
mysql_query($query) or
die(mysql_error());

$result = mysql_query("select * from inof") or
die (mysql_error());
while($row=mysql_fetch_array($result)){
if ($row['age']=="41"){
$row['name']="bubba";

echo "\n";
echo $row['name'],"\t",$row['age']. "<br>\n";
}
}
?>

Reply With Quote
  #2  
Old March 5th, 2005, 03:36 PM
atatum atatum is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 3 atatum User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 11 m 49 sec
Reputation Power: 0
Quote:
Originally Posted by cptn_future
Hi all...

Does anyone know the code to commit the changes to MySql data base?
You see, I got the code below, and i want to be able to comit the changes to the Dbase itself, not just the array, so does anyone know how to go about that??
Thanx

<?php
$name = $_POST["name"];
$age = $_POST["age"];
$prov = $_POST["provence"];

mysql_connect ("localhost") or
die ("could not connect to Database");
mysql_select_db("biz") or
die("could not find database");

$query = "insert into inof(name,age,prov) values ('$name','$age','$prov')";
mysql_query($query) or
die(mysql_error());

$result = mysql_query("select * from inof") or
die (mysql_error());
while($row=mysql_fetch_array($result)){
if ($row['age']=="41"){
$row['name']="bubba";

echo "\n";
echo $row['name'],"\t",$row['age']. "<br>\n";
}
}
?>

It looks like you are doing the commit here:

$query = "insert into inof(name,age,prov) values ('$name','$age','$prov')";
mysql_query($query) or die(mysql_error());

UNless you are talking about a transactional table, then that's a different story.

Can you give more information about the problem you are having?

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > Re: Commintg changes to MySql database


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT