Lokolo Posted May 7, 2007 Share Posted May 7, 2007 $update_guestsstaying = "UPDATE `rooms` SET stayinglength='$updatedstayinglength' WHERE roomID='$roomID'"; ok its setting the stayinglength to 0 when roomID = '$roomID' instead of setting it to the $updatedstayinglength i can echo $updatedstayinglength and it will give the number 4 for example, yet when i run that it updates it to 0. I know its most probably the most obvious thing but I have been snipping/changing etc. for an hour now and cannot see why its not updating it to the variable. Thanks, Quote Link to comment https://forums.phpfreaks.com/topic/50369-solved-updateing-setting-to-0-instead-of-var/ Share on other sites More sharing options...
fenway Posted May 7, 2007 Share Posted May 7, 2007 Sounds like it's a string to number conversion issue... mysql5? Quote Link to comment https://forums.phpfreaks.com/topic/50369-solved-updateing-setting-to-0-instead-of-var/#findComment-247335 Share on other sites More sharing options...
Lokolo Posted May 7, 2007 Author Share Posted May 7, 2007 nope 4. using phpdev and that came with mysql4 and phpmyadmin 2.3.2 um, well what i did before was $updatedstayinglength = $stayinglength - 1 i thought that would keep it as a numeric - obviously not. anyway or sorting this out? (i have no idea - a link will do if you don't want to explain) thanks, Lokolo Quote Link to comment https://forums.phpfreaks.com/topic/50369-solved-updateing-setting-to-0-instead-of-var/#findComment-247341 Share on other sites More sharing options...
fenway Posted May 7, 2007 Share Posted May 7, 2007 Echo the query after the variables have been substituted. Quote Link to comment https://forums.phpfreaks.com/topic/50369-solved-updateing-setting-to-0-instead-of-var/#findComment-247419 Share on other sites More sharing options...
Lokolo Posted May 7, 2007 Author Share Posted May 7, 2007 i am getting mysql fetch array error now hm $get_newvalues = ("SELECT * FROM `rooms` WHERE roomID = '1'"); $funnyrow = mysql_fetch_array($get_newvalues); $thevariable = $funnyrow['stayinglength']; $secondvar = $funnyrow['guest']; echo $funnyrow; echo $thevariable; on '$funnyrow = mysql_fetch_array($get_newvalues);' <-- that line i know im being a n00b but my brain hurts thanks, Quote Link to comment https://forums.phpfreaks.com/topic/50369-solved-updateing-setting-to-0-instead-of-var/#findComment-247506 Share on other sites More sharing options...
Lokolo Posted May 7, 2007 Author Share Posted May 7, 2007 ok using the above code (fixed - i missed mysql_query - i don't know what i was thinking, as i said, very tired ) however the echos gave: Array 0 hm ignore the Array thing - i have typed in the wrong variable name LOL. the 0 however, is the stored value for the new stayinglegnth - which shouldn't be 0!!!!! RAR Quote Link to comment https://forums.phpfreaks.com/topic/50369-solved-updateing-setting-to-0-instead-of-var/#findComment-247537 Share on other sites More sharing options...
fenway Posted May 7, 2007 Share Posted May 7, 2007 You have way too many issues in this post -- I don't see you ever running the query. Quote Link to comment https://forums.phpfreaks.com/topic/50369-solved-updateing-setting-to-0-instead-of-var/#findComment-247549 Share on other sites More sharing options...
Lokolo Posted May 7, 2007 Author Share Posted May 7, 2007 it doesn't matter now - i figured it out - it wasn't keepin it as a numeric, sorted it now though Quote Link to comment https://forums.phpfreaks.com/topic/50369-solved-updateing-setting-to-0-instead-of-var/#findComment-247560 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.