Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by almightyegg

  1. Hi guys! I have a logon script that I'm working on to try and get Facebook sign up/log in working. When registering it is now getting all the values I need which is great but it's chucking them into an awkward set of arrays... Array ( [algorithm] => HMAC-SHA256 [expires] => 1356426000 [issued_at] => 1356420441 [oauth_token] => AAAHTZCHpjGLMBAIBAtq5BOeMO4QSpmOQqq2UuinbqUgsZB4FeBICfXqUPXrVrvYVcPcnqyH9Lg9lQskzOhbZCKOUFOFxN61Fue0NSbeCzztygWTFLwR [registration] => Array ( [name] => William Masters [birthday] => 01/19/xxxx [location] => Array ( [name] => Bristol, United Kingdom [id] => 108700782494847 ) [gender] => male [email] => xxxxxx@googlemail.com [username] => xxxxxt@googlemail.com [password] => blahlbahalbah ) [registration_metadata] => Array ( [fields] => [{"name":"name"}, {"name":"birthday"}, {"name":"location"}, {"name":"gender"}, {"name":"email"}, {"name":"username","description":"Username","type":"text"}, {"name":"password"}] ) [user] => Array ( [country] => gb [locale] => en_GB ) [user_id] => 1617300026 ) So I now need to grab all these values and insert them in my database, how would I go about doing this?? I am very rusty with my PHP - used to be pretty sharp but haven't done it in a few years now Cheers
  2. I am trying to generate an alphabetical list of albums as such The Bachelor Best of Supertramp Dark side of the moon etc... As you can see, The Bachelor is first because I want it to remove the "The" so it alphabetises it by "Bachelor" So my question is how would I alphabetise it in a ORDER BY clause within a mysql_query() At I guess some sort of explode or implode but I don't know how I'd check if it has "The" at the beginning Thanks for help
  3. I think it's because you need to start the file with session_start() to enable the use of sessions
  4. I have made a message board running with PHP and MySQL and I've noticed that posts sometimes turn out like this: Hi...these are the details from the last letter that went out on Hallowe'en.... SOME NEW DETAILS FOR THIS HALF TERM! 1/ Music Hall tickets on sale: bring lota of chums – it’ll be a HOOOOT! This Sat 14th Nov, Hopton Village Hall, £5/£3, bring your own refreshment. 2/ New gig: BSE Xmas light switch-on WOOHOO!!! 19 Nov, Cadets be there 5.00 (sing 5.15-5.30), Seniors 5.30 (sing 5.45-6). Meet by stage.DRESS WARMLY WITH VS HOODIES AND CHRISTMAS DECORATIONS! 3/ 9th Dec, Cadets and Seniors IMPORTANT rehearsal Cathedral 4-5. Gig 7pm! 4/ Rehearsals for 18th Dec (“Of Stars and Angelsâ€, now at St Johns Church, tickets on sale): -We already had a rehearsal 12 Dec, but I've extended it both ways for both groups, SO 9.30-1.00 Seniors and Cadets, Sally Army. LMA PEOPLE it'd be great if you can make the beginning, then leave maybe 11.30 to give plenty of time to go on for Children of Eden...do advise me if this doesn't work. Tues 15th Dec Cadets 4.30-6.45, Seniors 5-7.30 AT ST JOHNS CHURCH!!! This will be the only time we get to put everyone together! -ON THE DAY I’d like everyone straight from school please, with packed tea, at St John’s. Any mums available to chaperone please? Watch out for costume list which will be issued shortly (an easy one, don’t panic!)… and BRING LOTS OF FRIENDS! I’m pretty excited about the new piece. Though obviously not biased! Love from Me and my Lovely Staff and Support Crew. ☺ ☺ ☺ Notice a lot of random ascii characters... It happens when I put it into the database and I'm not sure why...
  5. $fname=mysql_real_escape_string($_POST['firstname']); $lname =mysql_real_escape_string($_POST['lastname']); $telno=mysql_real_escape_string($_POST['telephone']); $level=mysql_real_escape_string($_POST['user_level']); shouldbe: $fname=mysql_real_escape_string($_POST['fname']); $lname =mysql_real_escape_string($_POST['lname']); $telno=mysql_real_escape_string($_POST['telno']); $level=mysql_real_escape_string($_POST['level']); Your form elements had different names
  6. Done it! It took a lot of trial and error but it's working here's what I used ($_POST[select] is an array based on the id of selected by checkbox posts to delete) <? include 'db.php'; $post = $_POST['select']; if($post == ''){ header("Location: forum.php"); }else{ $d = $post; $r = $post; while($r <> 0){ $yum = implode(",", $r); $sel = mysql_query("SELECT * FROM messages WHERE `rid` in ($yum)") or die(mysql_error()); if(mysql_num_rows($sel) == 0){ $r = 0; }else{ $r = array(); while($det = mysql_fetch_array($sel)){ $d[] = $det[messageid]; $r[] = $det[messageid]; } } } $delete = implode(",", $d); mysql_query("DELETE FROM `messages` WHERE `messageid` in ($delete)"); header("Location: forum.php"); } ?> Thanks for the help
  7. But surely the hierarchical string setup wouldn't work? if you have a system like mine how would you number them?? MAIN MESSAGE - 1 reply 1 - 2 reply to reply 1(reply 3) - 3 reply to reply(reply 6) - 4 reply 2 - 2 reply to reply 2(reply5) - 3 another reply to reply 2(reply4) - 3 Like this?? If so then you still have to find if they're replies to that thread as there are other numbers the same, so I'd still have the while problem
  8. The idea that involved the never ending loops would be something like this: get the id of the deleted post. call this $id get any posts with rid = $id while out these posts call their ids $id2 find any posts with $id2 as rid while out these posts call their ids $id3 etc.. and once you have them all delete problem is, it could have any number of replies so there's no definite way working out how many needed... Is there a way this can be done in a function? If somebody can point me in the right direction that'd be great
  9. but I can't see how it would work and how I would code it to delete them?
  10. I don't think a hierarchy system would work in this case... it would still require many many loops and it's not practical, unless you can explain how it could be used? I could be thinking of it incorrectly
  11. This could be a very simple thing which I'm just missing but here it goes... I'm making a threaded message board. Posts work like this: MAIN MESSAGE reply 1 reply to reply 1(reply 3) reply to reply(reply 6) reply 2 reply to reply 2(reply5) another reply to reply 2(reply4) The way this is set out in my database is ALL in one table, `messages`. The columns that are required for this to work are messageid - unique id of the post pid - the id of the MAIN MESSAGE (if it is a main message it's 0) rid - the id of the post it is directly replying to, so in the example above reply 1 would have the same pid and rid as it's main message is also the one it's directly replying to. reply5's rid would be the id of reply2 and so forth. I hope that all makes sense... My brainteaser is that when somebody deletes a message I want it to delete all the replies underneath it... so if I were to delete reply 1 it would delete reply 3 and 6 also. I have been toying with some codes but it always ends out that I need a never ending set of while loops.... eg while{ while{ while{ etc. for ever }}} Any ideas of better ways to set this up or ideas to solve the problem would be greatly appreciated Thanks
  12. http://www.dynamicdrive.com - they'll probably have that there
  13. http://lordoftheabyss.com/comm/compose.php Try it :-/ I dunno what's wrong with it
  14. I've used this exact code before yet it refuses to work. Here's my javascript: <body onLoad="document.form1.contact.focus()"> here's the form: <form action="send.php" method="POST" name="form1"> <table border="0"> <tr><td width="100"><b>To</b></td><td><input type="text" id="tokenize" name="contact" /></td></tr> <!--this is the form element I'm trying to focus on... but ti doesn't work. Perhaps it's because it has other javascript working on it too? though I didn't think that'd effect it--> <tr><td> </td><td></td></tr> <tr><td><b>Subject</b></td><td><input type="text" name="subject"></td></tr> <tr><td> </td><td></td></tr> <tr><td><b>Message</b></td><td></td></tr></table> <center> <input type=button value='Bold' onclick="aaatml(1);"><input type=button value='Italics' onclick="aaatml(2);"><input type=button value='Underline' onclick="aaatml(3);"><input type=button value='Strikethrough' onclick="aaatml(6);"><input type=button value='Link' onclick="aaatml(4);"><input type=button value='Image' onclick="aaatml(5);"> <br> <textarea id="colorBox" name="desc" style="width: 450px; height: 190px;"></textarea><br> </center> <input type="submit" value="Send"> </form>
  15. <li class="total">['. $num_1_star['rating'].'</li> makes no sense try: <li class="total">$num_1_star</li>
  16. Oh yeah, it is also being inserted into the db through a textarea, if that makes any difference?
  17. Should it not just be $num_1_star without the rating thing, or am I missing soemthing
  18. My information is stored in MySQL database. An example of such data would be: "Here is a line of writing, here is another and here is a line break" This is stored correctly, but when echoing it out it would display: "Here is a line of writing, here is another and here is a line break" Question is how can I get this display correctly?
  19. My code is this: $url = "/comm/message.php?id=$newid"; header('Location: $url'); Yet it redirects to: http://www.mysite.com/my_directory/$url How would I get it to process the $url correctly? thanks
  20. I want to select a certain line (<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">) from all of my files that contain in and rewrite it with <!--[if IE]> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <![endif]--> I would also like to locate the <head> tag and place a line linking a js file just after it... a) is this actually possible with PHP? b) could somebody point me in the right direction to do this thanks
  21. How foolish of me :S I feel like a right n00b now! Ha Cheers
  22. Problem is, I have 4 updates like this: if($farm > 0){ $upfarm = mysql_query("UPDATE land SET type = 'Farm' WHERE userid = '{$mem['id']}' and type = 'none' LIMIT 0, $farm") or die(mysql_error()); } if($water > 0){ $upwater = mysql_query("UPDATE land SET type = 'Water' WHERE userid = '{$mem['id']}' and type = 'none' LIMIT $farm, $water") or die(mysql_error()); } if($train > 0){ $uptrain = mysql_query("UPDATE land SET type = 'Train' WHERE userid = '{$mem['id']}' and type = 'none' LIMIT $three, $train") or die(mysql_error()); } if($casino > 0){ $upcasino = mysql_query("UPDATE land SET type = 'Casino' WHERE userid = '{$mem['id']}' and type = 'none' LIMIT $four, $casino") or die(mysql_error()); } I need to start from certain rows so I don't rewrite over the rows I've onlky just updated
  23. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1' at line 1 my code is simply this: $upfarm = mysql_query("UPDATE land SET type = 'Farm' WHERE userid = '{$mem['id']}' and type = 'none' LIMIT 0, $farm") or die(mysql_error()); in this case $farm = 1 Is there a problem with using the LIMIT in updates?
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.