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,

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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,

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.