Jump to content

Andrew777

Members
  • Posts

    30
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

Andrew777's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Requinix: I will check on the error reporting to see if that helps thanks. Boompa: I have looked at the Tumblr api and it's beyond my scope i guess, cause i don't get it. xenLiam: I still get nothing on my page even though my code is still the same as you show in your screen shot... This sucks, i may have to hire someone just to do this.....
  2. Thanks for your response Requinix. I tried to do the same (below) but still get nothing returned back showing up on the page... Can you tell why my code below still isn't doing anything? <?php $request_url = "http://alexishoustonmusic.tumblr.com/api/read?start=0&num=1&type=text"; $xml = simplexml_load_file($request_url); $post = $xml->posts->post->{"regular-body"}; echo "<h1>".$post."</h1>"; ?>
  3. Am i the only person who doesn't get any replies to my question? 50 Views and no one knows how to solve this issue?
  4. Can some please help me figure out why this isn't working? Just trying to show a page on my site show photo posts from a tumblr account. So I found this code to pull the XML data and then echo it on my page... Here is the code but I'm just getting nothing... <?php $request_url = "http://alexishoustonmusic.tumblr.com/api/read?start=0&num=1&type=text"; $xml = simplexml_load_file($request_url); $post = $xml->posts->post->{‘regular-body’}; echo '<h1>'.$post.'</h1>'; ?> I see there is a similar post here but that person didn't say how he fixed his problem... I'm stumped... Thanks.
  5. Thought my code didn't get posted in the first message, but basically how do you keep your form variables from disappearing when the user doesn't answer captcha correctly??? Thanks for any help!
  6. Hello, I was hoping someone could give me some advice on how to fix this problem.. I am trying to implement PHP Securimage captcha on one of my sites. The thing is I have a Form (Page 1) and I am trying to carry my form variables (several) to the Captcha page (Page 2). And then when the user answers the captcha properly the php code on that page sends me the form data. The Form works fine if I keep captcha on the same page (I know how to do that), but I have a reason to separate the two. And what happens is I think i can get the variables over to the next page, but if someone doesn't answer the Captcha properly and the page RELOADS to show the "wrong captcha" message, I lose my form variables from the previous page... So Form Page -> Captcha Page -> Sends Email. I lose the carried over variables when the wrong captcha is entered and the user has to redo the captcha. Captcha page has the following setup just showing one variable for brevity sake... Form Page: <form method="post" action="contact-captcha.php"> <input name="fullname" id="fullname" size="30" maxlength="40"> <input type="submit" value="Submit Info"> </form> Captcha (contact-captcha.php) Page: <?php session_start(); $fullname=$_REQUEST['fullname']; if(isset($_REQUEST['sub'])) { include_once $_SERVER['DOCUMENT_ROOT'] . '/securimage/securimage.php'; $securimage = new Securimage(); if ($securimage->check($_POST['captcha_code']) == false) { $fullname = $_SESSION['fullname']; $msg1="-> Sorry, Wrong Verification Code Entered"; } else { $fullname = $_SESSION['fullname']; $mailmsg = '<table width="500px" border="0" align="center" cellpadding="0" cellspacing="0"> <tr><td></td>'.$fullname.'</tr></table>' etc.... } } ?> <body> <form name="form1" method="post" action="" onSubmit="return validate(this);"> <?php if(isset($msg1)) { echo "<br /><br /><span class='error'>".$msg1."</span><br /><br />"; } else { echo '<br /><br />';} ?> <img id="captcha" src="http://www.mysite.com/securimage/securimage_show.php" alt="CAPTCHA Image" /> <a href="#" onclick="document.getElementById('captcha').src = '/securimage/securimage_show.php?' + Math.random(); return false"><img src="images/reload.png" border="0" /></a> <br><br> Enter code: <input class="fields" type="text" name="captcha_code" size="15" maxlength="6" /> <input name="sub" id="sub" type="submit" value="Submit Info"> </form> </body>
  7. Never mind, I figured it out by using: "SELECT DISTINCT(blog_id) AS blog_id, MAX((auto_id) as auto_id .....etc...... GROUP BY blog_id ORDER BY auto_id DESC" That gave me the result set I was looking for.
  8. Thanks for your response. I'm just wondering if it's absolutely necessary to have two tables? I can understand having two fields "original_postdate", and "mostrecent_postdate".... But is there no way to do the select statement so that it groups them by id and then displays the order by most recent post date within one table?
  9. "creata.physics", I removed the auto_id out of the order completely, but my thread list still comes up ordered by the date_time of the original starting thread post. So the Select statement groups the threads but still only shows them on the page by the original threads date_time. It doesn't push the thread with the a newer reply to the top of the display list. In response to "kney", yes any new post has the new posting date, so a reply will have the new post's date_time. No need to repeat the original threads date_time in the new post, since the reply will not need to use that date_time.
  10. Hi Guys, I should know how to do this but for some reason my code isn't working or I just am missing something... I am setting up a simple forum and posts are stored in one table with the following fields: auto_id -------- primary, auto_increment start -------- stores a 0 or 1, to show that the post is the first in the thread. (1 for the starting post, 0 for other posts in the thread) blog_id ---------- the threads id number, posts that are repllies to the starting post have the same blog_id number. bid ---------- forum title title ----------- post title post_by --------- user's profile name mem_id ---------user's member id date_time --------- the date and time querydate --------- unix timestamp visible ------------ to disable visibility of a specific post My Problem is that I can list posts in certain forum but when someone creates another post in an older thread, I want that thread to show up at the top of the list of threads, but my code isn't doing it.... Example: A) Who bought the new iPhone 4S? Started by: John - Date: February 1, 2011 What did you think of the Green Lantern Movie? Started by: Mary - Date: January 1, 2011 **then if someone adds a post to "Going to see Transformers tonight." that thread should show up above the "Who bought new iPhone 4S?" thread, just basically like any forum page... B) What did you think of the Green Lantern Movie? (New Post Added on: March 1, 2011 by Scott) Started by: Mary - Date: January 1, 2011 Who bought the new iPhone 4S? Started by: John - Date: February 1, 2011 Here is my while loop code so far: $sqlf="SELECT * FROM blogs WHERE bid='$brd' AND visible='yes' GROUP BY blog_id ORDER BY querydate DESC, auto_id DESC "; $rsf=mysql_query($sqlf); ..... Some HTML and CSS while($rowf=mysql_fetch_array($rsf)) { ..... Some more HTML/CSS and displaying the variables for the rows of threads. } Thanks for any help...
  11. Buddski, YOU ROCK!!! I think it's working now... I really appreciate it. Thank you!
  12. Hi Guys, This is a new post based on my last post for the same but I've revamped the code a little from the last post since I couldn't get it to work even with the suggestions, so my new code is below... Basically I have an updates table (updates_all) and a subscriptions table (subscriptions) and in the updates table items are entered for multiple users with querydate which increases based on the unix timestamp of the update. The Subscriptions table holds the data for users who are subscribed to other user's profiles. My issue is to show a logged in user his subscriptions and when a user he is subscribed to has a new update that user shows up on top of the list of his users. With the code below, i've been able to list the contents of the updates table, filter out the profiles which he is not subscribed to, and order the results by the most recent querydate. My question now is how do I run the while loop so it filters out all but one result per/member name?? Results output below the code... $sql_findsubs = "SELECT * FROM updates_all ORDER BY auto_id DESC"; $rs_findsubs = mysql_query($sql_findsubs); $subscripPID = array(); $sql="SELECT * FROM subscriptions WHERE memberid='$id' "; $rs=mysql_query($sql); while($row=mysql_fetch_array($rs)) { $subscripPID[] =$row['profileid']; } while($rowfs = mysql_fetch_assoc($rs_findsubs)) { $id = $rowfs['id']; if (in_array($id, $subscripPID)) { echo $rowfs['auto_id'].' - '.$rowfs['querydate'].'.......'.$rowfs['member']; echo '<br>'; } } RESULTS: So if John is subscribed to Bob, Mary, Jim and Andy, I want to only show the four rows below, not all the other entries because those have a smaller querydate for those members. AutoID - Querydate - Name 130 - 1109092040.......Bob <-------- I want to show this one only for Bob 129 - 1109092039.......Bob 128 - 1109091935.......Bob 98 - 1106162306.......Mary <-------I want to show this one only for Mary 97 - 1106162254.......Mary 96 - 1106162215.......Jim <-------I want to show this one only for Jim 90 - 1105062043.......Bob 89 - 1105052200.......Andy <------I want to show this one only for Andy 88 - 1105052154.......Bob 87 - 1105052154.......Bob 86 - 1105052038.......Bob 80 - 1105052034.......Andy 79 - 1105052032.......Andy 73 - 1105052023.......Bob 72 - 1105052018.......Andy 60 - 1103192354.......Bob 4 - 1103172045.......Bob Any help is greatly appreciated... Thanks.
  13. Hi Buddski, Thanks for your help. Your modification (I made a couple of tweeks) seems to somewhat help BUT now it's giving me rows based on the first querydate entered per/member in that table, not the most recent row with the higher querydate entered per/member.... So if "Bob" is in the "updates_all" table like so. 9 - Bob .......1103181620 (most recent) 2 - Bob .......1103181619 1 - Bob .......1103172045 (first, oldest) The result will return Row "1", not row "9".. Here is the code as it is now.... $id = $_SESSION['memberid']; $subscripPID = array(); $sql_findsubs = "SELECT * FROM subscriptions WHERE memberid='$id' "; $rs_findsubs = mysql_query($sql_findsubs); while($rowfs = mysql_fetch_array($rs_findsubs)) { $subscripPID[] =$rowfs['profileid']; echo $rowfs['profileid']; //This line is irrelevant. echo '<br>'; } echo '<br>'; $sql_ups = "SELECT MAX(`querydate`), `member`, `id`, `auto_id`, `querydate` FROM `updates_all` WHERE `id` IN (".join(',',$subscripPID).") GROUP BY `id` ORDER BY `querydate` DESC"; $rs_ups = mysql_query($sql_ups); while ($row=mysql_fetch_array($rs_ups)) { echo $row['auto_id'].'.....'.$row['member'].'('.$row['id'].')'.' - '.$row['querydate']; echo "<br>"; } Thanks for any more help....
  14. If I run it with your modification from your post (as in the code below) the second loop doesn't show any results at all.... btw, I took out the "//commented out" lines... $subscripPID = array(); $sql_findsubs = "SELECT * FROM subscriptions "; $rs_findsubs = mysql_query($sql_findsubs); while($rowfs = mysql_fetch_array($rs_findsubs)) { $subscripPID[] =$rowfs['profileid']; echo $rowfs['profileid']; echo '<br>'; } echo '<br>'; $sql="SELECT * FROM updates_all WHERE id='$subscripPID' ORDER BY querydate DESC LIMIT 1"; $rs=mysql_query($sql); while($row=mysql_fetch_array($rs)) { echo $row['member'].'<br>'; echo '<hr>'; echo $row['member'].' - '; echo $row['id']; echo ' '.$row['date_time'].' | '.$row['querydate']; echo '<br />'; } I tried some modifications (code below), and I got the output to show the members a person is subscribed to, and I can get the select statement to get the most recent row/per member based on the 'querydate' BUT I can't get the order that is output to put the member with the most recent update on top. I realized that the output is being effected by the order of the initial while loop that gathers the member ID's from the subscriptions table, so the order they were added to that table is being put into the array, which I am using to to find and Output my final list of members, so the sorting by most recent querydate doesn't work, uggggh!!!. (hope that makes sense :-) Any help figuring that out would be appreciated.... $subscripPID = array(); $sql_findsubs = "SELECT * FROM subscriptions WHERE memberid='$id' ORDER BY auto_id DESC"; //SO THE PROBLEM IS IN THE ORDER HERE $rs_findsubs = mysql_query($sql_findsubs); while($rowfs = mysql_fetch_array($rs_findsubs)) { $subscripPID[] =$rowfs['profileid']; echo $rowfs['profileid']; echo '<br>'; } echo '<br>'; $sql_ups = "SELECT * FROM `updates_all` GROUP BY member ORDER BY querydate ASC "; $rs_ups = mysql_query($sql_ups); while($rowups = mysql_fetch_array($rs_ups)) { $id = $rowups['id']; if (in_array($id, $subscripPID)) { $sql = " SELECT * FROM updates_all WHERE id='$id' ORDER BY querydate DESC LIMIT 1 "; $rs = mysql_query($sql); while($row=mysql_fetch_array($rs)) { echo $row['member']; echo "....."; echo $row['querydate']; echo "<br>"; } } }
  15. Thanks Nethox, but I tried the "LIMIT 1" yesterday and for some reason I get no results on the page when I add that to the Select statement. I have no idea why that happens.
×
×
  • 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.