Jump to content

per1os

New Members
  • Posts

    3,095
  • Joined

  • Last visited

Everything posted by per1os

  1. <?php $olderror_reporting =error_reporting(0); $URL = "http://www.rssfeedreader.com/rss3/rss.php?url=http%3A%2F%2Frss.pcworld.com%2Frss%2Flatestnews.rss&newpage=&chead=1&atl=&desc=1&owncss=&eleminate=&auth=&dts=1&width=700&max=5&tlen=0&rnd=1&bt=1&bs=Solid&nmb=&ntb=&naf=&nst=&nwd=0&nht=0&dlen=0&lstyle=-1&lc=%231C1972&bg=%23F4F4F4&bc=%23F4F4F4&spc=&ims=&tc=%231C1972&ts=13&tfont=Trebuchet+MS,+Verdana,+Arial&rf=".$HTTP_SERVER_VARS['SERVER_NAME'].$HTTP_SERVER_VARS['PHP_SELF']."&phpout=1"; $rssFeed = file_get_contents($URL); $rssSplit = split('"<a', $rssFeed); $i=0; foreach ($rssSplit as $link) { if ($i != 0) { list($data) = split("</a>", $link); list(,$title) = split('">', $data); $link = '<a ' . $link . '</a>'; $rssFeed = str_replace($link, $title, $rssFeed); } $i++; } print $rssFeed; // display the contents error_reporting($olderror_reporting); ?> As a side note $HTTP_* has been depreciated. See http://us2.php.net/manual/en/reserved.variables.php
  2. $query_rs_refs = "UPDATE fg_user SET refsneeded=".echo $row_rs_rewards['referralpoints']; should be $query_rs_refs = "UPDATE fg_user SET refsneeded=". $row_rs_rewards['referralpoints'];
  3. Yea, I am actually in the midst of re-doing the design to be a ton better, I will post that one for ideas once it is done. Thanks for the feedback Barand, that is actually part of the reason why I am re-doing it. I found that it needs to be more complicated =)
  4. <?php $rssFeed = file_get_contents($URL); $rssSplit = split('"<a', $rssFeed); $i=0; foreach ($rssSplit as $link) { if ($i != 0) { list($data) = split("</a>", $link); list(,$title) = split('">', $data); $link = '<a ' . $link . '</a>'; $rssFeed = str_replace($link, $title, $rssFeed); } $i++; } print $rssFeed; // display the contents ?>
  5. Just a quick note, if you are handling templates etc that contain html, the strip_tags is probably not what you want, it will remove all HTML tags from a string. Just an FYI =)
  6. I was informed by a higher power that the <?= is being depreciated I would do this: <?php $page="1"; ?> <a href="fav.php?page=<?php print $page; ?>">I like it!</a>
  7. Alright man, here is a place to start, hope this helps <?php session_start(); if (isset($_POST['submit'])) { foreach ($_POST as $key => $val) $_SESSION[$key] = $val; // store incase they want to edit. print '<form action="index.php" method="POST"><input type="text" name="tst" value="'.$_SESSION['tst'].'" /> <input type="submit" name="verify" value="Verify" /></form>'; }elseif (isset($_POST['verify'])) { // sql query here print 'Data entered into DB'; }else { print '<form action="index.php" method="POST"><input type="text" name="tst" value="'.$_SESSION['tst'].'" /> <input type="submit" name="submit" value="Submit" /></form>'; } ?>
  8. Can you copy and paste an example feed. It sounds like some simple parsing needs to be done. If I had something to work with I would be more than happy to give it a shot.
  9. <?php $test = "hello"; // Variable positions is key. $abc = $test; // do not know why you are quoting it $xyz = $abc; // should be what it is. echo $xyz; // Could be done like this also: $test = "hello"; // Variable positions is key. $abc = "$test"; // shown as quoted, must be double to do the $ $xyz = $abc; // should be what it is. echo $xyz; ?> If you want it to be like how you have it you may need to look into reference/pointers. I never got the hang of pointers, but I am sure that is what you want if you want the variable $abc to change after declaration.
  10. <?php //unequipped items ------------------------------------------------------------------- $uneq="SELECT * from km_items where owner='$player' and status='u'"; $uneq2=mysql_query($uneq) or die("Could not get user stats"); //$uneq3=mysql_fetch_array($uneq2); -- I do not know why this was there? $shown_items = array(); while($uneq3=mysql_fetch_array($uneq2)) { if (!empty($uneq3['id']) && !in_array($uneq3['itempic'], $shown_items)) { echo "<a href=equip.php?itemid=$uneq3[id]><img src='$uneq3[itempic]' "; $shown_items[] = $uneq3['itempic']; } } print "</table> "; } } ?> If you can give me a database structure, that can help, because chances are the problem is in the query.
  11. Can you provide an example of the data being retrieved and the end result you want?
  12. Great place to start: http://us2.php.net/manual/en/ref.session.php
  13. What is the question?
  14. Just a note on the DISTINCT modifier, it generally does not work on * it needs to be a specific column, because doing a distinct on * makes it so every single column must match to not display it. IE: SELECT DISTINCT(lname), userid, pass ... would work like it should. On that note: http://us2.php.net/manual/en/function.in-array.php !in_array($uneq3['itempic']) ---- What are you checking for here? You need at least 2 parameters, an array and a needle. //unequipped items ------------------------------------------------------------------- $uneq="SELECT DISTINCT * from km_items where owner='$player' and status='u'"; $uneq2=mysql_query($uneq) or die("Could not get user stats"); $uneq3=mysql_fetch_array($uneq2); $shown_items = array(); while($uneq3=mysql_fetch_array($uneq2)) { if (!empty($uneq3['id']) && !in_array($uneq3['itempic'], $shown_items)) { echo "<a href=equip.php?itemid=$uneq3[id]><img src='$uneq3[itempic]' "; $shown_items[] = $uneq3['itempic']; } } print "</table> "; } } See if that works.
  15. That is exactly correct. Try this: <?php $sql = "SELECT SUM(views) AS Views FROM Photos WHERE UserID = '{$username}'"; $query = mysql_query($sql) OR die(mysql_error()); $view = mysql_fetch_array($query); $view = $view[0]; echo "There have been " . $view . " Photos viewed."; ?>
  16. <body onLoad="poponload();"> </body> </html> Try that and an FYI this is considered JavaScript help, not PHP.
  17. <?php if (isset($_GET['uname']) && isset($_GET['miles'])) { $page = $_GET['miles'] . "ml" . $_GET['uname'] ".php"; } ?> That should get you the desired result.
  18. The only way is to use GET or POST data unless they have a database in common. Another option is an API, but that is the extent that I know of, maybe AJAX could be of use here?
  19. I think you are just giving him all privileges for that current database. You need him to have all privileges via MySQL main portion.
  20. while(($row = mysql_fetch_array($result))) { $info[$count++]=array($count=>array('line1'=>$row["first_name"], 'line2'=>$row["last_name"], 'line3'=>$row["product"], 'line4'=>"\$".$row["date"])); }
  21. Hi All, I am trying to re-build a function of mine to allow for more customization but I have hit a road block in a sense on which would be better. Here is my current function: <?php function fetchArr2($dataArr, $type='select') { // Should only be SELECT if (checkType($type) > 1) { return error(LANG_DB_ERR_WRONGTYPE); } if (ereg($dataArr, "Resource")) { $result = $dataArr; return mysql_fetch_assoc($result); } if (!is_array($dataArr)) { return error(LANG_DB_ERR_DATAARR); } //array("columns" => "userid, username, email", "table" => "users", "where" => "username='frost'"); $sql = "SELECT " . $dataArr['columns'] . " FROM " . replaceTable($dataArr['table']) . " WHERE " . $dataArr['where'] . " " . $dataArr['orderby'] . " " . $dataArr['limit']; $result = query($sql) or error("SQL Error: " . mysql_error(); return mysql_fetch_assoc($result); } ?> The question is how I am passing the data into this to be built the function in action would look like such <?php $newArray = fetchArr2(array("columns" => "userid, username, email", "table" => "users", "where" => "username='frost'"), 1); ?> I am wondering if there is a better way to go about this. The goal here is to be able to have it all dynamic, meaning the table users is actually test_users which is replaced inside the function, but I could change it to be my_users and not have a problem. Any ideas or opinions on that? Appreciate it.
  22. What you can do instead, is return all records into an array. When running the loop check the in_array() value and see if there is already a record. The only downside to that is the new inserts won't be checked unless you add those to the array also.
  23. Some code would be helpful.
  24. If a variable isset (meaning it has been defined) than it returns true. If that variable has not been set or defined it returns false. <?php $cat = "fly"; if (isset($cat)) { print $cat . " has been set"; } if (isset($someVar)) { print $someVar . " has also been set"; }else { print "someVar was not set!!!"; } ?> Works for array indexes also, which is what you are doing with session, checking if an index of an array has been set/defined.
  25. Maybe, but sometimes MySQL can be un-predictable. This way it is always unique no matter what without any surprises. And an FYI, posting some code WILL help us to help you fix your problem.
×
×
  • 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.