Jump to content


Photo

No errors, but no update


  • Please log in to reply
6 replies to this topic

#1 angel_cowgirl

angel_cowgirl
  • Members
  • PipPip
  • Member
  • 17 posts
  • LocationPoedunk America

Posted 14 December 2005 - 07:57 AM

*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...

#2 leokwan1982

leokwan1982
  • Members
  • Pip
  • Newbie
  • 6 posts
  • LocationHong Kong

Posted 14 December 2005 - 08:07 AM

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) View Post[/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...
[/quote]


#3 angel_cowgirl

angel_cowgirl
  • Members
  • PipPip
  • Member
  • 17 posts
  • LocationPoedunk America

Posted 14 December 2005 - 08:18 AM

//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![/quote]

#4 leokwan1982

leokwan1982
  • Members
  • Pip
  • Newbie
  • 6 posts
  • LocationHong Kong

Posted 14 December 2005 - 09:03 AM

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.

#5 angel_cowgirl

angel_cowgirl
  • Members
  • PipPip
  • Member
  • 17 posts
  • LocationPoedunk America

Posted 14 December 2005 - 09:22 AM

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

#6 ryanlwh

ryanlwh
  • Staff Alumni
  • Advanced Member
  • 511 posts

Posted 14 December 2005 - 04:48 PM

have you retrieved the data from the $_POST array? it seems that you're passing in empty strings.
Please use EDIT * 100...
Please use
or [php] * 1000...

PLEASE READ THE POSTED SOLUTIONS CAREFULLY * 1000000...

#7 angel_cowgirl

angel_cowgirl
  • Members
  • PipPip
  • Member
  • 17 posts
  • LocationPoedunk America

Posted 14 December 2005 - 05:58 PM

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 :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users