denno020
Members-
Posts
761 -
Joined
-
Last visited
-
Days Won
3
Everything posted by denno020
-
Selecting members who's birthday is in the next month
denno020 replied to denno020's topic in PHP Coding Help
Ahk, very clever silkfire.. I would never have considered the whole -February being a short month- problem. Thankyou for your clarification . Denno -
Ok... So when I put 'database_id', I was kinda hoping you'd get the drift of what I was suggesting, and change the name to match whatever it is in your database. What is the name of the id field in your database? This is what you need to put where I suggested 'database_id'.. You also didn't assign anything to the php variable $id... You need to have $id = $_SESSION['id']; somewhere before your query.. Put it just below where you've got $firstname = ' '; Once you have made those changes, let me know how it works. Denno
-
Please post your whole php file so I can look through it. Also, be sure to post them between the php tags, by doing: [ p h p ] //your code goes here [ / p h p ] (without any of the spaces)
-
This is how your SQL statement should read SELECT firstname FROM `Members` WHERE database_id=$id database_id will be the id inside your database, obviously.. So you're checking those values for the value contained inside the session id variable, which you have saved into it's very own variable called $id. the $ sign before the name indicates it's a php variable also.. In case you didn't know . Try that and let me know how you go. Denno
-
you should have done $id = $_SESSION['id']; Then put $id in the query.. Denno
-
Selecting members who's birthday is in the next month
denno020 replied to denno020's topic in PHP Coding Help
I have managed to solve the problem myself . What I did was convert the date from the database into it's day-of-the-year equivalent, and then compared it to the day-of-the-year of the current date. This worked perfectly . Here it is: SELECT id, name, DOB FROM pp_members WHERE dayofyear(DOB) < dayofyear(curdate())+30 && dayofyear(DOB) > dayofyear(curdate()) ORDER BY dayofyear(DOB) ASC I'm quite happy with this result . Thanks for the help though. Denno -
Selecting members who's birthday is in the next month
denno020 replied to denno020's topic in PHP Coding Help
wow that is one confusing line; "first day of this month next month".. What does that convert into? I've been Googling and I've come up with this code that will select everyone who's birthday it is in the current month, however I don't want to show people who's birthdays have already passed, and I would like the birthdays from next month, if within 30 days from the current date, to be displayed.. This overlap of months/dates is where I'm falling short.. However I'm unsure if your code would achieve what I'm after? Here is the code I'm using at the moment.. SELECT id, name, DOB FROM pp_members WHERE monthname(DOB) = monthname(curdate()) ORDER BY DOB ASC Thanks Denno -
What you could try doing is assigning $_SESSION['id'] to a variable and then using that variable in the where clause. I have a feeling there is issues when it comes to accessing the session variable directly in the where clause of SQL... I think I've heard of this before.. Denno
-
I'm not familiar with the use of the curly braces around $_SESSION['id'].. do you have a specific reason for this? This is the line that the error is appearing on, so I would try removing the curly braces, leave the line reading like this: $result = mysql_query("SELECT firstname FROM `Members` WHERE id=$_SESSION['id']"); Denno
-
session_start() needs to be the very first thing on your page. Move it about session_id() and see what happens.. Denno
-
In my database I have a field for DOB for each of the records. This field is of mysql type 'date'. I would like to have a script to select only the members who's birthday it will be within the next month.. I'm very unsure as to how to approach the comparison of the current date and the date that is stored in the database... Anyone able to help me? Thanks Denno
-
Work out if current date (today) is a week before a given date
denno020 replied to denno020's topic in PHP Coding Help
So I literally write 'July 7 2011 - 1 week' for the string to time? Wow.. Thanks so much for the help ignace, I will implement it into my site right now . Thanks Denno -
You would make the action of your form point to your form processing script (which could be at the top of the form's page, or it could be a new php file), then once the data has been entered into the database (which you said you have already got working), you want to use 'header' to forward onto a new page, instead of loading the form again. header('Location: http://www.example.com/'); //Pulled from php.net Hope that helps. Denno
-
Do you mean you want the results of a form to be sent to your email address? You should look into a script called FormToMail. It is very easy to configure, all you have to do is open the script, enter your email where it says, and then give the form an action which points to the location of the script. It's heavily commented so you can follow it with ease. Hope that helps. Denno
-
(continuing from topic title) So if I set a date of July 7 2011 into my script, hard coded in, I would like the current date to be checked against the hard coded date, and return true if the current date is within a week leading up to the hard coded date. How could I go about doing this easily? I've been researching dates in php but I can't seem to work out the best way to achieve what I'm after. Cheers Denno
-
Your code works for me, but only if I put the full php tag '<?php' not just '<?'.. I didn't use the next_post_link() functions, I just made each of those variables equal to a string, so as to force the set or unset state. And echoed accordingly.. So just try changing the php tags before the ending curley braces. Denno
-
Thankyou very kindly . I will definitely implement this once I've got some spare time from uni work . Denno
-
I was wondering how I could consolidate the row id's in my tables? In some tables, I have row id's that go 1, 2, 3, etc, but then jump from say 7 to 10, and then to 14 etc.. This is due to deleting rows that were in between before.. Is there a way I can consolidate these rows so that they're all back in order from 1 to however many there are.. Thanks Denno
-
yeah it's stop stop the little shift. It's irritating me... More javascript aye lol. I shall look into that too . Thanks for your help dude. And even when I post this in the wrong sub-forum woops. Denno
-
Thanks mate. Much appreciated. I have already had a look at that site you provided and it looks like a winner, so will have a go at implementing it . Cheers Denno
-
I have auto margins for left and right for my wrapper to centre it in the page. When the page is longer than the browser window, obviously the vertical scroll will appear. However, when that happens, the wrapper will shift to the left so that it is still in the centre. Is there any way of avoiding this? Thanks Luke
-
No no I wasn't interpreting that as displaying the images on the front page.. I knew what you meant about loading them into the cache, but not actually displaying them when loaded. I would therefore make them the very last thing to load on the index page right? As they're not going to be displayed anyway.. Cheers Denno
-
Yeah I was thinking a sprite.. but that would obviously take a little bit of work to stitch all the photo's together and then appropriately move them into position for each person.. Loading the pictures on the frony page sounds interesting.. I could just load like the first 15-20, so part of the page that is in view will display straight away. And then depending on how fast someone starts scrolling down, they'll see the other photo's waiting to load or not.. So for that I will need to search Google for how to load images into cache using javascript? Thanks Denno
-
Well we're talking about the whole senior squad, so roughly 30-35 images? Could be upwards of 40+ though.. So I'm stuck with just having to optimize the crap out of each of the images? Thats ok, was hoping there might be a trick to have them load last or something or rather..
-
One of the pages on my football clubs website is going to have lots of player images on it. It's the players page, and it basically shows the photo's of all players (150x113 ~30KB jpg's), along with their number and player sponsor. I want all of the photos to appear on the page, I don't want to separate it up using pagination.. So is there anything else I could do to minimize the load time of the page? Each image is loaded itself, so there will be a lot of HTTP requests, but I don't think sprites will work in this situation.. Very keen to hear any ideas. Cheers Denno