denno020
Members-
Posts
761 -
Joined
-
Last visited
-
Days Won
3
Everything posted by denno020
-
How can I run php code that is stored in a database? I have my pages created by grabbing the contents of a pageBody mySQL table cell, but some pages require further php to be able to display correctly. For example, I have a players page, which will list all players, and some information about them. The players and information is all saved in a players table in my database (separate to the pages table where pageBody is stored). I use simple php to grab all the players and format all of their information so it can be displayed on the page. This is the flow of information that I would like: User clicks on players page browser loads content page (this is a template page), and grabs the pageid from $_GET browser then reads pages table in database to get the pageBody associated with the pageid The pageBody will contain more php, which will run the players script to retrieve the list, and display Doing it the above way will make it much easier to extend the website to include more types of pages that has to run additional php scripts. The only way I can think of this working is by doing this: user clicks on players page browser loads content page, grabs pageid from $_GET browser checks the pageid for the one associated with players (hard coded into the php script) browser then loads the players.php script instead of going to the database This above way means that I will need to edit the index.php page everytime I add a new list type (example, coaches, volunteers etc). Anyone have any suggestions? I know my question is long, but I was finding it hard to explain it in an easy to understand way, but I'm still not sure if I have :S. Cheers Denno
-
I'm trying to create a content page which will have a div in the top left corner of a wrapper, which I've floated to the left, so as to have text 'wrap' around it. However, I also want a div in the top right corner, but I'm not sure how to go about doing this? I've tried adding a div directly after the first one thats in the left corner, and then floating that to the right, however that doesn't appear to work. I've attached a picture of what I'm talking about. The black box is the wrapper. The red box is the div floated to the left. The green is the div that I want to appear in the top right hand corner, and the blue is the box that I would like the text to fit in. As you can see, when it gets to be below the height of the divs, it should then expand to use the whole width of the wrapper. How would I be able to achieve this? Cheers Denno [attachment deleted by admin]
-
You need to provide your php, as this is what will put the information into the database. You will also need to set the values of the checkboxes into an array. Something that I found out this week myself. When you process the form, you can check through the checkboxes array to see if it's set or not, and then append the value to a checkboxes string, which is then put into the datase. Denno
-
Table content went out of alignment after apply php code
denno020 replied to genzedu777's topic in PHP Coding Help
I would imagine it's something to do with CSS more than the code. Unless there are heaps of spaces printed or tab characters. Have you checked the source of the page in the browser to see if this is the case? You could try setting the table cell widths to a specific number and see if that helps.. Denno -
Did you look at the comments for some of the workarounds for PHP versions less than 5.3? I actually have 5.3 installed on my WAMP set up, but I still get the same error that you're getting. It's very weird.. Let us know if any of the work arounds do the trick for you Denno
-
Table content went out of alignment after apply php code
denno020 replied to genzedu777's topic in PHP Coding Help
So this is revised code with PHP added? Can we see the code (HTML) you had before when it was working? Denno -
You could set some hidden input boxes in the form as the x and y values, and then use these values to see how many iterations need to be done. If each of the text boxes are incrementally named, then you should be able to work out how many there are, and go through getting the values for them all: Example: X=3, Y=5 (15 text fields are printed) hidden_input_X = X ( = 3) hidden_input_Y = Y ( = 5) each text fields name will be: number1, number2, number3.......number15 Form will look like this: (each number represents a text field) 1 | 2 | 3 4 | 5 | 6 7 | 8 | 9 10 | 11 | 12 13 | 14 | 15 (Form is submitted) $X = $_POST['hidden_input_X'] $Y = $_POST['hidden_input_Y'] (use for loop to go through every row in each column, or each column in every row - there will be a for loop inside a for loop) int $tracker = 1; for(int i = 0 ; i < $X ; i++){ for(int j = 0 ; j < $Y ; j++){ $total += $_POST['number'.$tracker]; $tracker++; } } echo $total; The only problem that I have above is whether the variable $tracker can be used in the way I have used it :S... How does that sound? Denno
-
To verify all of the fields have been entered, you can either use javascript, which will check all of the fields before the form is sent, or you can use PHP, which will require the form to be submitted, and then the fields are checked at the server, and a new page is rendered with appropriate error messages. To calculate the sum of the fields, would be pretty easy. Just submit the form to a php script (or the same page itself, just have an if statement at the top of the page to check if data has been POSTed), and then grab the contents of each table cell (which I'm assuming has text fields in there), and add them up. Grab them from $_POST['eac_fields_name'], and add them into a variable called $total. Echo $total or do whatever you want with the total. Denno
-
Give each checkbox a different name. Append a number to the end of the name, and then you will have the status of every checkbox sent to the script. I still don't understand where the colours are going to change? Will be it before the form is submitted (before the add button is pressed). Will it be as soon as the focus shifts away from the paid field? Or does it happen in a results type page that shows the user what they have entered? Denno
-
Yeah you would pair them when you build your echo string. If you dont want to show the date when showing who likes the item, then you just iterate and show every 2nd item in the array that is created when the string is exploded . Denno
-
i want send scheduled email. plz help me how can iwrite code in php
denno020 replied to mani0328's topic in PHP Coding Help
Woah calm down.. thorpe answered you.. Server schedule with a windows platform, or Cron on the linux... -
Your second question, did you want that to happen in real time? So as soon as the field is answered, it changes colour? This is done very simply using javascript.. Otherwise, I'm not sure what font is to be made green/red. I can't see any 'paid' fields in the form in the code you posted.. Denno
-
Playing with the code, it does appear that only the last option selected will be sent through POST, as you said. I can't see anyway to be able to loop through the options selected, unless of course you use some javascript to see which options are selected, and then use javascript to POST those selections to the script.. I would suggest you swap over to using checkboxes instead.. It would make your form much more understandable and easier to fill out too I would imagine (no keyboard combos are necessary) Denno
-
it'll be like user1|date1|user2|date2|user3|date3 But as the date will always be added directly after the user, you know that they go in pairs. So the 1st and 2nd go together, 3rd and 4th, and even the 19th and 20th etc.. Make sense? Denno
-
You could just have the date appended to the username in the one field.. You'll have to make it a text or even a longtext though. Use a seperator, like |, which you can use with the php function that explodes a string into an array using whatever symbol as the delimiter.. So keep your count in it's own INT type field, and then put the username/date into it's own TEXT or LNGTEXT type field. Doubt this is the beat way, but it should mean that your database table won't get extremely large if there are many people liking things.. Denno
-
i want send scheduled email. plz help me how can iwrite code in php
denno020 replied to mani0328's topic in PHP Coding Help
I have just read today about cron jobs.. Look into that. It will allow you to run a php script at a time interval. Your php script can have all the of mail sending things that you want . Denno -
Query the database, selecting the varchar field that you want to update. Put that into a variable. Append your new data to the end of that variable (using .= ). Then re-write the database with the new variable (which is the same as what was in there before, with the appended data added). Hope that helps Denno
-
can I grab all of the form code too? I would like to do some testing myself Denno
-
I guess what you could do to start debugging your program: Echo the post variable for all of the select menus. See what is inside of them. Then further from that, change what you're selecting and then sending to the script (see if it's always the last one picked). This might then be a limitation of the select menu, in which case you might have to switch to checkboxes.. I don't know myself whether there is going to be a limitation on it or not, but it's worth a try. So just start echoing as many variables as you think appropriate to see just what is happening, don't worry about inserting into your database yet, just play with the echoing. Once it's echoing the correct results, then it will insert into the database fine too. Denno
-
What php code do you have a the moment for getting the form input? I'm thinking you could just use a while loop to go through all the options and see if they're set or not? (checking $_POST)... But can I see your php code . Denno
-
CMS using template from a mysql database
denno020 replied to bigjoe11a's topic in Third Party Scripts
This is the best PHP site that I've found. If you're not getting your answer, then maybe you're not asking the right question. You're not going to find help by insulting the forum. Denno -
CMS using template from a mysql database
denno020 replied to bigjoe11a's topic in Third Party Scripts
That doesn't help at all. With a CMS, what you do is create your page (as a php page), style it using all of your html as normal. You can get away with only creating one .php file, and have the content loaded into that php file from the database. The pages are effectively created dynamically, and loaded into your temple php file. If you don't already know how to do it, then you need to look into a free solution of wordpress or drupal, or you need to pay someone to do it. I don't think anyone will spend time to explain step by step how to do it in a forum like reply. Well I wouldn't anyway.. I'll help you gix problems as you come across them, but I won't tell you how to start, how to expand, and how to finish it.. Denno -
CMS using template from a mysql database
denno020 replied to bigjoe11a's topic in Third Party Scripts
I don't understand what you want? Can you explain it better? Denno -
Wasn't just me buddy, kenrbnsn said that you needed it. I merely explained why . Denno
-
As kenrbnsn said above, you will need to add session_start() to every page that will want to access the session variables. It's a little confusing, I know I was when I first started using them, but by addying session_start(), all you're really saying is 'extend the current session into this file too'. It would be great if there was a session_extend() function or something similar, so that the names make it super easy to understand what's going on, but there isn't, so we have to stick with session_start(). I guess another way you could look at it is start the session acces for this file. So it's not starting a completely new sessions, it's merely starting the connection between the current session, and the file from where it is called.. Hope that helps. Denno