Jump to content

[SOLVED] UPDATEing setting # to 0 instead of $var


Lokolo

Recommended Posts

$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,

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

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,

ok using the above code (fixed - i missed mysql_query - i don't know what i was thinking, as i said, very tired :P )

 

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

Archived

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

×
×
  • Create New...

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.