HuggieBear
Members-
Posts
1,899 -
Joined
-
Last visited
Everything posted by HuggieBear
-
Almost there... Probably best to have your functions page as just that, nothing else. Then include it in the rest of your pages. So your form calls validate.php which looks a little like this. [code] <?php include_once('functions.php'); $group = $_GET['group']; checkgroup($group); ?> [/code] Regards Rich
-
You should really be asking this in the Layout forum, not the PHP Help forum. Did the code I posted help at all? Regards Rich
-
Do you mean you want to add a year onto the reg_date column and see if it's in the past or not? Is that what you mean by 'active'? Regards Rich
-
How about providing us an error message and some code... Regards Rich
-
Do they want it to be a 'real-time' site? Regards Rich
-
What you're looking for is JavaScript. I used to use something similar that did the opposite. If somone loaded my page inside a frame, my page detected it was in the frame and broke out. Yours needs to check if it's in a frame, and if it isn't to frame itself. A google for [url=http://www.google.co.uk/search?q=Javascript+%2Bframes+%2Bbreakout]javascript +frames +brakeout[/url] may point you in the right direction, even if it's not quite what you want. I attach a zip file containing the following. frameset.htm header.htm nav..htm page 1.htm page 2.htm page 3.htm link.htm If you open page2.htm or page3.htm directly they will load the frameset and themselves into the main frame. Regards Rich [attachment deleted by admin]
-
It can be jone in Ajax, but it doesn't stop the query being resent, it just stops the page from being refreshed. Regards Rich
-
I've taken code directly from the tutorial on this site and wrapped it around your code, and I think I have it working. If, as I suspect, you want to select bulletins from multiple friends all at once, but only have one header for each friend with their bulletins listed beneath them (and still only limit to 5 per page) then let me know, as I have the working code for this. See [url=http://www.dizzie.co.uk/php/pages.php]here[/url] (I have a limit of 3 records per page). Regards Rich
-
Maybe I'm missing something, but I can't see any attempt at pagination in the code example of your first post. You've got all the query info, but no attempt at pagination. Are you expecting your first query (where you select the friends) to return more than one row? Regards Rich
-
Probably JavaScript, not PHP. Search Google, there must be hundreds of results. Regards Rich
-
Yes, it's possible and not too difficult, I use it to read share prices from Reuters. Look at the fopen() function in the PHP manual. Regards Rich
-
I have the following code which both sets and 'unsets' a cookie... If you call cookie.php?status=logout then you get the cookie unset, if you call it with cookie.php?status=login then the cookie gets set. [code=php:0] <?php // Cookie parameters $cname = "auth"; $cvalue = "yes"; $cpath = "/"; $cdomain = "xxxxxx.co.uk"; $cexpire = (isset($_GET['status'] == "logout") ? time()-3600 : time()+3600; // Ternary to see if we're setting or unsetting setcookie($cname, $cvalue, $cexpire, $cpath, $cdomain); // Now we've set the cookie, lets direct to a page that uses it. header("Location: index.php"); ?> [/code] And before anyone says anything, I'm aware that you could pass any value other than 'logout' as an argument to cookie and it would set the cookie. I just cobbled it together quickly to show how simple it is. Regards Rich
-
perezf... Just use the same code you had in your previous post that I just helped you with. All you need to do is set the cookie expire to sometime in the past... $cookie_expire = time()-1; As for a link, stick the cookie code in a seperate file with a header redirect at the bottom, and then link to it normally. Regards Rich
-
ok, lets look back at the original code.... a) Have you tried to echo $num to make sure it's not equal to zero, as this is a condition of you setting the cookie? b) Have you tried to echo $_SERVER['PHP_SELF'] to see if you get the expected result? I'd bet the problem is option b)... Try just putting your domain in there $cookie_domain = "mydomain.com" as $_SERVER['PHP_SELF'] gives the path and filename, not the domain. Regards Rich
-
Are you certain you have it correct... You missed out the parts I've included in [color=red]red[/color] below [b]$[color=red]_[/color]COOKIE[[color=red]'[/color]auth[color=red]'[/color]][/b] Both the underscore, and the single quotes should be there. Also when setting the expire, try without the quotes... [code=php:0]$cookie_expire = 0;[/code] Regards Rich
-
There's example code on the function pages within the php documentation that Jenk pointed you towards. Why don't you go and give it a try, write some code, and if it doesn't work, post what you have here... Here's links to the exact pages: [url=http://uk.php.net/manual/en/function.fopen.php]fopen[/url], [url=http://uk.php.net/manual/en/function.fwrite.php]fwrite[/url] and [url=http://uk.php.net/manual/en/function.fclose.php]fclose[/url]. Regards Rich
-
This would show the last one: [code=php:0] if(isset($_GET['ID'])) { $query = "SELECT * FROM Videos WHERE VideoID = $_GET['ID']"; } else { $query = "SELECT * FROM Videos WHERE VideoID = (SELECT max(VideoID) from Videos)"; } [/code] Or if you'd prefer to show a specific video, then specify it's id in the code. [code=php:0] $id = (isset($_GET['ID']) ? $_GET['ID'] : 1; // If you don't understand this code, check out the 'Ternary Operator' link below //code to query the database for the table $query = "SELECT * FROM Videos WHERE VideoID = $id"; $result = mysql_query($query) or die ("Query failed"); $numofrows = mysql_num_rows($result); [/code] Info on the Ternary Operator can be found [url=http://uk.php.net/manual/en/language.operators.comparison.php]here[/url] Regards Rich
-
You need a column in your content table called category_id or similar, and this will link to the category_id column in your new category table. Regards Rich
-
OK, check the version of PHP/GD you're using. GIF write support wasn't included as default in later versions, it was replaced by PNP, but some servers still have it. From the PHP Documentation: [color=red][i]Only supported in GD versions older than gd-1.6 and newer than gd-2.0.28. Read-only GIF support is available with PHP 4.3.0 and the bundled GD-library. Write support is avaliable since PHP 4.3.9 and PHP 5.0.1.[/i][/color] You can find this out my using phpinfo() Regards Rich
-
Try this SQL statement: [code] SELECT ipaddress, count(ipaddress) FROM users GROUP BY ipaddress [/code] Or spice it up a bit with this: [code] SELECT ipaddress AS "IP Address", count(ipaddress) AS "Entries" FROM users GROUP BY ipaddress ORDER BY "IP Address" [/code] The key thing to remember when using 'GROUP BY' is that you must be using a 'group' function. Something like count(), max(), min(), avg() etc. Not just normal columns. Regards Rich
-
Do you mean this is in your SQL statement, similar to this: [code=php:0] $sql = "INSERT INTO table (path) VALUES ('wisdom2.php?MAXIMID=<?php echo $row_menu['ID']; ?>')"; [/code] If so, then it's because of the single quotes around 'ID'. Have you tried to use htmlentities() on the string first of all, that works? That would insert: [code] wisdom2.php?MAXIMID=<?php echo $row_menu['ID']; ?> [/code] Or just escaping the single quotes by doubling them up, like so: [code=php:0] $sql = "INSERT INTO table (path) VALUES ('wisdom2.php?MAXIMID=<?php echo $row_menu[''ID'']; ?>')"; // notice two single quotes around ID [/code] Let me know how you get on. Rich
-
Thanks Ronald, I'll bear that in mind. Regards Rich
-
I got a parse error when I ran it. I corrected the spaces after <<<EOF and EOF at the same time I fixed the IF statement, so I didn't know which had fixed it. I didn't realise you didn't need the curley braces when coding an IF statement. Learn something new everyday. Rich
-
accessing a specific instance of a $_FILES array
HuggieBear replied to isaaccs's topic in PHP Coding Help
Perhaps you could post your code, I see nothing impossible about this request. Regards Rich -
What are you trying to do, open the file and then delete it? Regards Rich