
richiec
Members-
Posts
126 -
Joined
-
Last visited
Never
Everything posted by richiec
-
lol yeah it was abit of a mess sorry.. and i never got the hang of using arrays but anyways... I tried that, still get the Parse error: parse error, unexpected $ in ... on line 217 line 217 is the end of the page, just a blank line =\ ive had these errors before just to find out that is just a missing ; somewhere but i cant find one so i figured this must be something else =\ any more ideas
-
Having a little problem here, im trying to add something to my site, with out the following part it works fine (sadly this is the part i want to add lol) so i know that it is something im missing here but its really starting to annoy me now... anyone have any ideas? heres the whole code for the part im trying to add... <?php $crewget = $_GET['crew']; if ($crewget == v1){ $getcrew = "v1"; } elseif ($crewget == v2t){ $getcrew = "v2t"; } elseif ($crewget == v2s){ $getcrew = "v2s"; } elseif ($crewget == v3){ $getcrew = "v3"; } else $getcrew = "fail"; include('db.php'); mysql_connect($server,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM `splits`"; $result=mysql_query($query) or die(hmm); $query="SELECT * FROM `splits` WHERE `crew` = '$getcrew' ORDER BY (id) ASC"; $result=mysql_query($query) or die(hmm); $num = mysql_num_rows($result); $i=0; if ($num < 1){ echo " "; } else { $splitname = mysql_result($result,$i,"splitname"); $name = mysql_result($result,$i,"name"); $godname = mysql_result($result,$i,"god"); $launch = mysql_result($result,$i,"launch"); $crew = mysql_result($result,$i,"crew"); echo "=============================== <br> $god - $launch - ($crew) <br> ===============================<br>"; while ($i < $num) { $i++; echo "$splitname - $name<br>"; } echo "<br>"; ?> Any ideas? Thanks Rich
-
lol alright thanks, anyone have any idea about the other things?
-
Hey i have a group of 20 text boxes with a submit at the bottom when submit is clicked it puts the info of the 20 text boxes into DB then echos them on another page.. Thats working fine.. What i would like to do is when they click submit, it checks to make sure none of them are the same - no idea how to do this could someone show me an example.. Another thing each text box has to be 5 lines - not 4 or 6 is there anyway to check if it has 5 lines? One more thing lol... When it is put into the db, each text line are in new lines (like it should be) but when it is echoed back on the site it puts them in the same line... any idea how to make it echo exactly the same as it is in db? That last one doesnt sound very clear.. Say you have enterd 5 lines of text into 1 of the text boxes "line 1 line 2 line 3 line 4 line 5" it puts that into the db, but then on the site echos back "line 1 line 2 line 3 line 4 line 5" Thanks rich.
-
that worked great thank you both! ~Rich
-
I will try and explain this best i can, i have an update page where users can select different things and put due at different times... It puts the time and date they chose into a DB.. Currently i have them putting the date in unix format year-month-day (it needs to be for things which i do with the date) but on the page where users can see that date i would like to show it in a different format like day-month-year hopefuly that explains what i want to do... Does anyone know how i can do that? Thanks Rich
-
i got the 3 layers working using Unix date and time.. now all i need to do is convert it once they update it in month/day/year so that when its in the db it is unix format... and when it echos back on the site it is in month/day/year format but this is a different issue so i will make a new thread for it.. thanks for your help i would have given up otherwise. Rich
-
ok i decided not to give up on it how do you convert it before inserting it and then get it to display the way i want it when it gets it from db? this is what i have now.... <?php if(strtotime('now') > strtotime("{$date} {$time}")) { echo "something if current date and time is > than both $date and $time"; } elseif(((strtotime('now') > strtotime("{$date}")) & ((strtotime('now') < strtotime("{$time}"))) { echo "something if current date > $date but time is < than $time"; } else { echo "something if current date < $date"; } ?> Can you see whats wrong here? its giving me an unexpected T_ECHO error.. for this echo: <?php echo "something if current date > $date but time is < than $time"; <? also this part is just an idea a had duno if it will work or not <?php elseif(((strtotime('now') > strtotime("{$date}")) & ((strtotime('now') < strtotime("{$time}"))) <? Any ideas?
-
the thing is, i have an update page where users can update when things are due so they go there and put in a date and time for a list of things.. that date and time gets put into the DB.. the main reason i wanted to change the date format is because they didnt like the way they had to put in the date as in year-month-day so i changed the way for them to put in the date and started using date() to check against the date in the db.. i guess current date and time stamps just confuse me...
-
i have given up on it and just changed it back to the way i have been using it.. showing one thing when it is after a date and time showing another thing when it is before date and time. i removed if it was the correct date but before the time part and gone back to using unix time to check the date and time. thanks anyway ~Rich
-
what he said
-
paste your php form for the insert into blah blah
-
change your primary key to a field which is something like 'ID' as INT and have that as auto increment, that should prevent you from getting a duplicate error.
-
ok ill start at the start.. maybe it will help you understand what i am trying to do more.. <?php putenv("TZ=America/New_York"); if(strtotime('now') > strtotime("{$date}")) {// compares current unix timestamp to that date echo "if the date and time are > than $date in db"; } else { echo "if the current date is < $date in db"; ?> That is what i had at first, and it worked fine for a few months but now i want to change it around a bit.. I want to change the date format to check a different way because year-month-day is backwards lol so i wanted to change it to check against month-day-year that is where i started using date() to put it to the format i wanted.. Other than changing the date format i wanted to add another option because the code above would display on the correct date but things change during the day.. So what i want to be able to do is: 1) have it check if current date is < than the date in DB - that displays something 2) have it check if current date is > than the date in DB but < the time in DB - that displays something else 3) have it check if current date and time is > than the date and time in DB - that displays something else so any ideas how i can set that up, and keep the date format that i want so it doesnt check year- month - day
-
bumping... So noone knows how to read if current date and time is > than $date $time in my db?
-
no, thats how i had it set up at first. The case command is pretty much the same as else/if in this case anyway What i need it to do is read the current date and time for the time zone selected if that is > than $date $time then it echos that bit
-
I think i have figured where my problem is however im not sure how to solve it.. This is what i have... <?php putenv("TZ=America/New_York"); $currentdate = date('n-j-Y'); $date = mysql_result($result,$i,"date"); $time =mysql_result($result,$i,"time"); case ($currentdate > $date): // this is where the problem is which i need help with.... echo "if $currentdate and time is > than $date $time"; break; case ($currentdate == $date): echo "if $currentdate is = to $date"; break; default: echo "defult for if $currentdate hasnt come around yet"; } ?> ok any ideas how i can get this working because it is really starting to stress me out now.... i basicly have a time stamp and date stamp in DB and all i want to be able to do is... if it is todays date but before the time it echos something... if it is past the date and time it echos something else and if it is before the date it echos something else...
-
you can have the update page the same theres no need to have ?user=name ect for this.. try <?php $siteuser = $_SESSION["myusername"]; $query="SELECT * FROM `users` WHERE `username` = '$siteuser'"; $result=mysql_query($query) or die(mysql_error()); <? Then have all of text fields or whatever you want for them to update what they had you can have it so it displays what they currently have for example: <?php $option1= mysql_result($result,$i,"option1"); $option2= mysql_result($result,$i,"option2"); //then echo what info is already in the DB in option 1 and option 2 into the text boxes echo " <input type=\"text\" name=\"myname\" maxlength=\"50\" size=\"20\" value=\"$option1\"> option 1<br> <input type=\"text\" name=\"myage\" maxlength=\"50\" size=\"20\" value=\"$option2\"> option 2<br> <p><input type=\"submit\" name=\"submit\" value=\"Submit\"></p> </form>"; ?> then just use $_REQUEST and update the DB fields to what they change them to. Hope it helps.. Rich
-
[SOLVED] passing through variables in a session??
richiec replied to rnb_cassanova's topic in PHP Coding Help
try <?php $user= $_SESSION["Name"]; $query="SELECT * FROM `table_name` WHERE `username_field` = '$user'"; $result=mysql_query($query) or die(mysql_error()); <? If i understand what you want to do correctly... then echo what info you want -
bumping sorry, but i still cant get this to work right so im going to post the whole secton of code so you can maybe see more of what i am trying to do... <?php $now = putenv("TZ=America/New_York"); $currentdate = date('n-j-Y'); $datentime = date('n-j-Y',strtotime('now')); $name = mysql_result($result,$i,"name"); $date = mysql_result($result,$i,"date"); $time =mysql_result($result,$i,"time"); $respawn =mysql_result($result,$i,"respawn"); $image =mysql_result($result,$i,"image"); $image2 =mysql_result($result,$i,"image2"); $image3 =mysql_result($result,$i,"image3"); $update =mysql_result($result,$i,"update"); switch (true) { case ($date > $currentdate): echo "<img onMouseOut=\"kill();\" onMouseOver=\"popup('<font color=\'#FFFFFF\'><b>$name - Level $level<br>($respawn)<br><br></font>$area<br><br><font color=\'#FF0000\'>Not Due Yet</font><br><br><font color=\'#FFFFFF\'>Due On $date <br> (Day-Month-Year)<br><br>At $time <br> (24 Hour Clock)<br><br>Updated by $update</font>');\" src=\"$image2\" alt=\"\" width=\"75\" height=\"75\">"; break; case ($now > $datentime): echo "<img onMouseOut=\"kill();\" onMouseOver=\"popup('<font color=\'#FFFFFF\'><b>$name - Level $level<br>($respawn)<br><br></font>$area<br><br><font color=\'#00FF33\'><b>Due Now!</b></font><br><br><font color=\'#FFFFFF\'>Started on $date <br> (Day-Month-Year)<br><br>At $time <br> (24 Hour Clock)<br><br>Updated by $update</font>');\" src=\"$image\" alt=\"\" width=\"75\" height=\"75\">"; break; default: echo "<img onMouseOut=\"kill();\" onMouseOver=\"popup('<font color=\'#FFFFFF\'><b>$name - Level $level<br>($respawn)<br><br></font>$area<br><br><font color=\'#FFFF00\'><font size=\'2\'>Due Today!</font></font><font color=\'#FFFFFF\'><br><br>At $time <br> (24 Hour Clock)<br><br>Updated by $update</font>');\" src=\"$image3\" alt=\"\" width=\"75\" height=\"75\">"; } ?> Ok what it is doing, the defult seems to work and $date > $currentdate seems to work however... when $now > $datentime it still displays the defult.. any ideas?
-
i did that, and the date time and defult both work but now strtotime($date) doesnt work o_O
-
just tried that thanks for the idea but sadly it still gave same problem it echos the one i have for if strtotime > date even when strtotime > date and time
-
ok i changed it to that and it got rid of the unexpected elseif error now it echos the first one for strtotime > $date even when strtotime > $date . $time any ideas?
-
if(strtotime('now') > strtotime("{$date}")) { echo "something when strtotime > than just the date"; } elseif(strtotime('now') > strtotime("{$date $time}")) { echo "something when strtotime > date and time"; } else { echo "defult for if strtotime < now"; } Can anyone see what is wrong with this? I am guessing it is getting confused because if strtotime > date it echos something but if strtotime > date and time it echos something else... any ideas? =\
-
thanks, that works.