Search found 13 matches

by eludlow
Sat Jan 24, 2004 4:20 am
Forum: PHP - Code
Topic: Cookie problems - won't set with an expiry argument
Replies: 2
Views: 238

Oops, solved it already myself!

Thanks anyway,
Ed
by eludlow
Sat Jan 24, 2004 3:58 am
Forum: PHP - Code
Topic: Cookie problems - won't set with an expiry argument
Replies: 2
Views: 238

Cookie problems - won't set with an expiry argument

I have a problem with cookies, such that the cookie won't set if the expiry argument is included, either in the date() form or mktime(). If I simply put setcookie("name", "value"); then it's set fine, but that's no good for me :( Can anyone suggest why this is so? Thanks, Ed Ludlow
by eludlow
Fri Jan 23, 2004 4:25 pm
Forum: PHP - Code
Topic: Cookies
Replies: 8
Views: 1347

I can't see anything in cookies folder, but surely....

setcookie('test','test',time()+120);

should set one fine, if the array method above working?!

Ed
by eludlow
Fri Jan 23, 2004 4:09 pm
Forum: PHP - Code
Topic: Cookies
Replies: 8
Views: 1347

OK, found out this works. <?php // set the cookies setcookie("cookie[three]", "cookiethree"); setcookie("cookie[two]", "cookietwo"); setcookie("cookie[one]", "cookieone"); // after the page reloads, print them out if (isset($_COOKIE['cookie...
by eludlow
Fri Jan 23, 2004 4:03 pm
Forum: PHP - Code
Topic: Cookies
Replies: 8
Views: 1347

Thanks, but it simply doesn't want to set a cookie.

isset($_COOKIE['.... simply isn't producing anything.

What could be wrong?

E
by eludlow
Fri Jan 23, 2004 3:31 pm
Forum: PHP - Code
Topic: Cookies
Replies: 8
Views: 1347

Cookies

Am experimenting with cookies for the first time, and they're not working lol! File 1: <?php setcookie("test", "testValue", time()+120); echo ("Cookie set"); ?> And file 2: <?php echo $_COOKIE['test']; ?> I think it's setting the cookie ok, but I don't see why it's not ...
by eludlow
Fri Jan 23, 2004 1:58 pm
Forum: PHP - Code
Topic: Loops and mySQL
Replies: 2
Views: 479

Cheers mate - one of the guys on another forum helped me solve it earlier today.

Your break down of the "pagination" is bloody good though, thank you!

Ed
by eludlow
Fri Jan 23, 2004 10:10 am
Forum: PHP - Code
Topic: [SOLVED] SQL - what's up with this?
Replies: 4
Views: 453

Brillaint - thank you VERY much. Virtual pint for you me thinks :)

Ed
by eludlow
Fri Jan 23, 2004 9:46 am
Forum: PHP - Code
Topic: [SOLVED] SQL - what's up with this?
Replies: 4
Views: 453

That's brilliant, thank you very much.

One little thing....

Is it easy to edit it so that once the last lot of rows have been shown (ie the page that will contain the first (ie eldest) row in the table), that page won't contain a "next page" link?

Once again, thanks for your help,
Ed
by eludlow
Fri Jan 23, 2004 8:17 am
Forum: PHP - Code
Topic: [SOLVED] SQL - what's up with this?
Replies: 4
Views: 453

[SOLVED] SQL - what's up with this?

<?php $connection = mysql_connect ('localhost', 'ed', 'password') or die(mysql_error()); mysql_db_query ("x-appeal", $connection); $q = "SELECT date,newsitem,id FROM xanews ORDER BY id DESC, LIMIT 0,5"; $q_temp = "SELECT id FROM xanews"; if(mysql_num_rows($q) != 0) { $i...
by eludlow
Fri Jan 23, 2004 6:02 am
Forum: PHP - Code
Topic: Loops and mySQL
Replies: 2
Views: 479

Loops and mySQL

I hate writing loops, and I've been trying to work this one out for a while now. I know it's smurf simple to write, and I should be able to do it, but brain often shuts down while writing loops, so I'm calling on you good people for help!

Bascially, I've an SQL table, each row having a unique "id" field, a simple integer. The first row in the table is 1, and when each new row is added, that number gets incremented. That's all fine and working.

What I want to produce is a simple php script that will write the latest five rows in the table to the screen, and then produce the rest of the rows on another page - a sort of archive.

How would you go about producing:
1) the loop to print JUST the first five
and
2) the loop to write all the rows after the first five.

Many thanks,
Ed Ludlow
by eludlow
Thu Jan 22, 2004 4:01 pm
Forum: PHP - Code
Topic: Adding to SQL DB
Replies: 2
Views: 277

Sorted it - MANY thanks.

Ed
by eludlow
Thu Jan 22, 2004 3:48 pm
Forum: PHP - Code
Topic: Adding to SQL DB
Replies: 2
Views: 277

Adding to SQL DB

I've got a VERY simply script with which I wish to add some data to a DB. As far as I can see, it should work - any ideas why it's not?! <?php $connection = mysql_connect ("myhost", "ed", "mypassword"); $date = date("F j, Y"); $confirmednewtoadd = $_POST['conf...