Jump to content

Archived

This topic is now archived and is closed to further replies.

angel_cowgirl

No errors, but no update

Recommended Posts

*sigh* seems like I can't find answers to anything on my own...sorry for asking so many questions..

 

I'm not getting any errors but its not updating the datbase either.

 

//Create an update query string with the updated horse data
$strUpdateQuery = "UPDATE horses SET horse_name = '".$strHorseName."', horse_dob = '".$intHorseDOB."', horse_sex = '".$strHorseSex."', horse_height = '".$intHorseHeight."', horse_color = '".$strHorseColor."', horse_sire = '".$strHorseSire."', horse_dam = '".$strHorseDam."' WHERE pk_horse_id = ".$intHorseID;

 

The variables are being passed from a form on the previous page, and I have checked the spelling and I've tried using only ' instead of " and ive tried using the query with out . around the variables but nothing.

 

Sometimes its actually not fun not getting errors...

Share this post


Link to post
Share on other sites

Your SQL is correct in code level, so can you post the code there.

 

Btw, did you check the connection to the database? do you set auto commit = false? The record is exist or not? did you try to pinrt the sql in the screen and check is it what you expect?

 

 

[!--quoteo(post=327327:date=Dec 14 2005, 02:57 AM:name=angel_cowgirl)--][div class=\'quotetop\']QUOTE(angel_cowgirl @ Dec 14 2005, 02:57 AM) 327327[/snapback][/div][div class=\'quotemain\'][!--quotec--]

*sigh* seems like I can't find answers to anything on my own...sorry for asking so many questions..

 

I'm not getting any errors but its not updating the datbase either.

 

//Create an update query string with the updated horse data
$strUpdateQuery = "UPDATE horses SET horse_name = '".$strHorseName."', horse_dob = '".$intHorseDOB."', horse_sex = '".$strHorseSex."', horse_height = '".$intHorseHeight."', horse_color = '".$strHorseColor."', horse_sire = '".$strHorseSire."', horse_dam = '".$strHorseDam."' WHERE pk_horse_id = ".$intHorseID;

 

The variables are being passed from a form on the previous page, and I have checked the spelling and I've tried using only ' instead of " and ive tried using the query with out . around the variables but nothing.

 

Sometimes its actually not fun not getting errors...

 

Share this post


Link to post
Share on other sites

//Call connection to database
require("Connect.php");

$intHorseID = $id;

//Update the Record

//Create an update query string with the updated horse data
$strUpdateQuery = "UPDATE horses SET horse_name = '".$strHorseName."', horse_dob = '".$intHorseDOB."', horse_sex = '".$strHorseSex."', horse_height = '".$intHorseHeight."', horse_color = '".$strHorseColor."', horse_sire = '".$strHorseSire."', horse_dam = '".$strHorseDam."' WHERE pk_horse_id = ".$intHorseID;

//execute the query
$rsModifyResult = ConnectDatabase($strUpdateQuery);

echo $rsModifyResult;

echo "<b><h3>Horse record successfully modified!</h3></b><br>";

 

gives me...

 

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Succeeded in connecting to the database.

 

1

Horse record successfully modified!

Share this post


Link to post
Share on other sites

The info is not enought, can you show the code of ConnectDatabase?

 

Moreover, try to echo the sql into screen and run it in MySQL client or phpMyAdmin. See is the sql run smoothly? if yes, the problem is raised by ConnectDatabase.

Share this post


Link to post
Share on other sites

thats all the info there is, in that file.

 

its not connectdatabase because the absolutely only thing that does is connect to the database and 1. it said it was successfully at doing so and 2. that function is used many many many times on every page of the site.

 

i actually did try running it in phpMyAdmin and hard coding values in works just fine

 

And as shown above the result of echoing it in IE was "1"... and when it does that it leaves that row blank in the DB

Share this post


Link to post
Share on other sites

have you retrieved the data from the $_POST array? it seems that you're passing in empty strings.

Share this post


Link to post
Share on other sites

Thank you for pointing out what a n00b I am, :) hehe. I had considered that before but for some how/ reason I got the impression it was happening somewhere in there but the more I read it the more I didn't see it I just hadn't tried it cause I was just sure there was something else I was missing.

 

Guess ya should always go with instinct and try EVERYthing even when ya dont THINK its right..

 

Anyway thanks again :)

Share this post


Link to post
Share on other sites

×

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.