Forum: PHP Jun 5th, 2009 |
| Replies: 3 Views: 416 Thanks to all for replying, I set the variables to private and although I can debug them i.e. print_r, and see them, I cannot change them, which I guess is the meaning of them being private!
... |
Forum: PHP Jun 3rd, 2009 |
| Replies: 3 Views: 416 Hi all, hopefully my question is simple as I'm fairly new to OOP coding. I've found an RSS Parser on the internet (which is open source and I can adapt it to however I please yada yada). I want to... |
Forum: PHP Apr 25th, 2009 |
| Replies: 4 Views: 900 Not a problem pal, everyone's here to help! Mark this thread as solved, and happy PHP coding!
Until next time,
Anthony |
Forum: PHP Apr 24th, 2009 |
| Replies: 4 Views: 900 Hi Andrew, if you wanted them all into one string variable, you could do this:
// Bind the posted array of checkbox elements to a variable.
$service_needed = $_POST['service_needed'];
// We... |
Forum: PHP Feb 25th, 2009 |
| Replies: 2 Views: 492 Hi guys, this is a brainteaser for me and I'm wondering if you could help. Lets say I'm looping through these results from MySQL, and the result set is as follows:
ID------Name
4------ Anthony... |
Forum: PHP Feb 6th, 2009 |
| Replies: 12 Views: 5,069 Hi Andymut, do you have any sample code for the community to look at? I'm still trying to grasp exactly what you're trying to do.
Anthony |
Forum: PHP Feb 3rd, 2009 |
| Replies: 3 Views: 355 Hi there,
I think the problem is the syntax in those conditional statements. In PHP, one equals sign sets a variable, but in this case you're wanting to compare two variables. This is done by two... |
Forum: PHP Feb 3rd, 2009 |
| Replies: 3 Views: 513 Sorry, I half read this post but is this what you're looking for?
// Creating the array.
$selected = array(4, 3, 9);
// Join the array elements into a string, seperated by commas.
$result =... |
Forum: PHP Jan 30th, 2009 |
| Replies: 4 Views: 740 Thanks for all the help. Case solved! |
Forum: PHP Jan 28th, 2009 |
| Replies: 4 Views: 740 So just to clarify, it's not the login process that it is protecting, it's the database side of things i.e. if the cracker was able to get access to the database, right? |
Forum: PHP Jan 28th, 2009 |
| Replies: 4 Views: 740 Hi everyone and thanks for reading.
Up until yesterday I was unaware of this technique, and have always just ran a user's password through md5 and stored the result to the database. From what I've... |
Forum: PHP Jan 4th, 2009 |
| Replies: 12 Views: 5,069 Don't worry about it. In university it took me about 6 months to drill which one is which into my head!
The way you've described is perfect. Only process it if the validation on all the fields... |
Forum: PHP Jan 3rd, 2009 |
| Replies: 12 Views: 5,069 Understanding the concept is half the battle, the other half is getting the code to work!
Yep, that's right. It holds the checkbox array elements all processed into a single string, so that's... |
Forum: PHP Jan 2nd, 2009 |
| Replies: 12 Views: 5,069 Hi kanaku,
It's not bad practice, in fact, in some cases it's better and more efficient to keep seperate SQL tables. That method is one way of doing it, and the method I described is another. I... |
Forum: PHP Jan 2nd, 2009 |
| Replies: 12 Views: 5,069 Hi Smurf_UK,
The first thing I should note is that when you post an array of html checkboxes, they'll appear as an array of checkboxes when PHP gets a hold of them. So the first thing you could do... |
Forum: PHP Jan 1st, 2009 |
| Replies: 3 Views: 335 Correctly posted above!
Another way would be to do the following:
// Sets $stringData to contain $myname.
$stringData = $myname;
// Takes whatever is in $stringData and adds a semi-colon... |
Forum: PHP Nov 25th, 2008 |
| Replies: 2 Views: 472 Hopefully this should get you started. I've commented the code to make understanding easier, let me know if you've any questions; I'm here to help!
<?php
session_start();
if... |
Forum: PHP Nov 1st, 2008 |
| Replies: 13 Views: 1,929 Time:
$time = "0900 - 1730";
// If there is one occurence of the needle in the value, then explode the array.
// If there is not, set it to an empty array.
if (substr_count($time, " - ") ==... |
Forum: PHP Nov 1st, 2008 |
| Replies: 13 Views: 1,929 Something like this perhaps?
preg_match("/^[0-9]{4} - [0-9]{4}$/", $time) |
Forum: PHP Nov 1st, 2008 |
| Replies: 13 Views: 1,929 Perhaps I've misunderstood the question, and the two previous posters used regular expressions but I would normally test a date with something like the following:
function is_date($value) {
... |
Forum: PHP Nov 1st, 2008 |
| Replies: 6 Views: 685 Generally when you want to automate a PHP script, be it big or small you run it in a CRON job, so that's what I'd recommend but I'm curious to see what any other peoples input will be! |
Forum: PHP Oct 29th, 2008 |
| Replies: 2 Views: 608 Hi humbug,
Thank you for going to so much effort to help me with my problem. My work schedule's pretty packed for the next few days but hopefully I'll get round to looking at this over the... |
Forum: PHP Oct 28th, 2008 |
| Replies: 2 Views: 608 Hi everyone and thanks for reading.
I started a project a while ago and am stuck on how to proceed processing this form. It's a very simple form but I'm still at a mental roadblock regarding how... |
Forum: PHP Oct 16th, 2008 |
| Replies: 4 Views: 711 Thanks very much for clearing that up!
Anthony |
Forum: PHP Oct 15th, 2008 |
| Replies: 4 Views: 711 Hi scru,
Thanks for replying! I understand how the overall function operates but I'm unsure about how the two callback functions work.
Can you explain a bit more indepth to what this... |
Forum: PHP Oct 14th, 2008 |
| Replies: 4 Views: 711 Hey everyone. I was reading the documentation for this function and I can't understand what the example is doing, and how it's working. Can someone explain to me what these functions are doing?
... |
Forum: PHP Oct 7th, 2008 |
| Replies: 23 Views: 2,223 Hi guys, Sorry for the time it took me to get started on this again, I've just started a new job and had to get my affairs in order!
R0bb0b, that worked great by declaring it as global!
I've... |
Forum: PHP Oct 5th, 2008 |
| Replies: 5 Views: 711 I've figured out that addslashes() is a PHP command to escape slashes altogether, and that is why the slashes remain in the database. The mysql_real_escape_string() command is a MySQL command to... |
Forum: PHP Oct 5th, 2008 |
| Replies: 5 Views: 711 Guys I just have one more question. I made the following script (this is a watered down version just to show you generally what's happening):
if (get_magic_quotes_gpc()) {
$name =... |
Forum: PHP Oct 4th, 2008 |
| Replies: 5 Views: 711 Thanks to the both of you for your tips and advice. I've now concluded that sanitizing the data with real_escape_string on the way in is essential, and stripping the slashes is needed on the way out.... |
Forum: PHP Oct 4th, 2008 |
| Replies: 5 Views: 711 Hi everyone and thanks for reading,
Now that I've been getting my hands dirty with PHP a lot more, I've been starting to freelance and I'm wanting to make sure I have the right systematic approach... |
Forum: PHP Oct 1st, 2008 |
| Replies: 23 Views: 2,223 Well to be honest it's not the end of the world because I can just include the code from the function inside the foreach loop and it works fine. How odd though!
My next task is... now that I've an... |
Forum: PHP Oct 1st, 2008 |
| Replies: 23 Views: 2,223 It's the lines about the array, it doesn't like the line where I'm updating the array, how odd that it works on page but not from an include!! Do I need to pass the array also or something? |
Forum: PHP Oct 1st, 2008 |
| Replies: 23 Views: 2,223 Ok I took the script apart and passed the key and value variables, and simple echo'ed them out, which works. I'm going to add an if statement at a time and see where it breaks!
It's like playing... |
Forum: PHP Oct 1st, 2008 |
| Replies: 23 Views: 2,223 Just tried to comment the require_once, and then put the function onto the page. Still doesn't work. Is it because the $key => $value variables are only accessible from inside the foreach loop, and... |
Forum: PHP Oct 1st, 2008 |
| Replies: 23 Views: 2,223 Hey Xan, proud of me for that big function?! haha.
Yeah I looked at your advice there, I'm getting no response into this array, it remains blank. I've attached my code so you can see if it's... |
Forum: PHP Oct 1st, 2008 |
| Replies: 23 Views: 2,223 Hey! I've been hard at work and I've definitely made progress! This is what I came up with:
foreach ($_POST as $key => $value) {
$$key = addslashes(trim($value));
if... |
Forum: PHP Oct 1st, 2008 |
| Replies: 23 Views: 2,223 Hey R0bb0b,
Thats a really clever idea but I don't think it'd work for me. The counter is counting rows rather than individual text boxes. It's for a purchase order form you see, so one row... |
Forum: PHP Oct 1st, 2008 |
| Replies: 23 Views: 2,223 Hi Xan,
Firstly let me thank you for all the help so far, you're a real inspiration to the other posters!
I'll tell you where I'm tripping up, I did as you said about the foreach loop including... |
Forum: PHP Oct 1st, 2008 |
| Replies: 5 Views: 575 Yep your right, thats returning false for me. The function is working perfectly now, thanks very much for all your help. I've added to your rep and this is marked as solved!
Anthony |