Jump to content

scarhand

Members
  • Posts

    382
  • Joined

  • Last visited

Everything posted by scarhand

  1. wasnt sure if this belonged in php help or mysql help so im posting it in both im trying to display results from my database by date and group them together by day. this is what the mysql table looks like: title | date test title 4 | 2008-01-11 05:14:56 test title 3 | 2008-01-11 05:14:56 test title 2 | 2008-01-10 05:14:56 test title 1 | 2008-01-10 05:14:56 and i want the results to look like this: january 11, 2008 test title 4 test title 3 january 10, 2008 test title 2 test title 1 i have been messing around with this for a while and cant get it to work the way i want it to. you can probably do this in 1 mysql statement but heres the coding i have so far: Code: <?php $sql1 = mysql_query("SELECT * FROM videos GROUP BY date"); $sql2 = mysql_query("SELECT * FROM videos ORDER BY date DESC"); $count = mysql_num_rows($sql1); if ($count == 0) { echo 'There are no videos to display'; } else { while ($row = mysql_fetch_array($sql1)) { $date = date("M j, Y", strtotime($row['date'])); echo "$date<br><br>"; while ($row = mysql_fetch_array($sql2)) { $title = $row['title']; echo "$title<br>"; } } } ?> any help is greatly appreciated
  2. im trying to display results from my database by date and group them together by day. this is what the mysql table looks like: title | date test title 4 | 2008-01-11 05:14:56 test title 3 | 2008-01-11 05:14:56 test title 2 | 2008-01-10 05:14:56 test title 1 | 2008-01-10 05:14:56 and i want the results to look like this: january 11, 2008 test title 4 test title 3 january 10, 2008 test title 2 test title 1 i have been messing around with this for a while and cant get it to work the way i want it to. you can probably do this in 1 mysql statement but heres the coding i have so far: <?php $sql1 = mysql_query("SELECT * FROM videos GROUP BY date"); $sql2 = mysql_query("SELECT * FROM videos ORDER BY date DESC"); $count = mysql_num_rows($sql1); if ($count == 0) { echo 'There are no videos to display'; } else { while ($row = mysql_fetch_array($sql1)) { $date = date("M j, Y", strtotime($row['date'])); echo "$date<br><br>"; while ($row = mysql_fetch_array($sql2)) { $title = $row['title']; echo "$title<br>"; } } } ?> any help is greatly appreciated
  3. ive been searching how to do this for a couple hours now i searched these forums and google and am not having much luck could someone point me in the right direction here?
  4. i cant have it inside the TD and i want it to overlay over multiple TD's as if its literally floating over the table
  5. im trying to get an image to display over the top-right side of a table heres my code: <img src="myphoto.gif" style="float: right; position: relative; top: 10px; right: 10px;"> <table width="100%" border="1"> <tr> <td width="100%"> this is the table the image should be displaying inside of the top-right corner </td> </tr> </table the problem is, it seems that the float is causing it to still recognize the image as being beside it, so the image only goes into the table 10px and the table's width gets cut off where the image would normally start any help would greatly be appreciated.
  6. you can get the source code here: http://diondesign.net/products.php thanks for the help
  7. well lets say that $row['name'] is = 'username' im trying to get the variable to become $orig_username
  8. <?php while ($row = mysql_fetch_array($sql)) { $orig_{$row["name"]} = $row["value"]; } echo "orig_name = $orig_name"; any help is appreciated
  9. ok i fixed everything except for user enumeration
  10. hey agentsteal i reset the password so you may have got kicked off, the pass is now admin123 i just made it so that you can not shout the exact same thing 2 times in a row to prevent some spam working on the stuff agentsteal posted now
  11. it autorefreshes every 2 seconds but in IE and firefox it does not "blink" the admin password is "phpfreak" please dont change it once i get all the bugs fixed i will post the source code for you guys to check out
  12. Is AJAX behind all this or php? javascript does basic validation php checks again before inserting into db
  13. fixed the blank message and name being posted and its supposed to wrap after a user-specifed length of characters so that no horizontal scrolling needs to happen
  14. i wrote a shoutbox a while ago that had lots of flaws i rewrote most of the code and added advanced validation please test it out: http://diondesign.net/sbxr/ i will PM the admin password to the first few people who post willing to help thank you for your time
  15. nevermind i figured it out <?php if (!eregi("^#*([a-fA-F0-9]{6})$", $maintxtcolor))
  16. for some reason this isnt working <?php if (!eregi("^[#]*(\.[a-z0-9]{6})$", $maintxtcolor)) { $errormsg = "An invalid main text color was entered"; }
  17. well the shoutbox uses ajax and has tons of messages posted every hour i figured doing that might speed it up a little
  18. im trying to delete oldest row when a new one is inserted, but apparently this does not work: DELETE FROM shoutbox WHERE id=(SELECT MIN(id) from shoutbox)
  19. lets say i have a table like this: name | age | sex mike | 22 | male mitch | 21 | male joan | 17 | female john | 33 | male and i want to select, count, and order all these results by sex (descending) without using any php variables to do so and after they are selected, i am going to be putting them in an html table that will look like this: sex | count male | 3 female | 1 i have no idea where to get started...i can do the php on my own but i dont have any clue what to use for the select statement...im sure it will have to include SELECT, COUNT, WHERE, and GROUP BY but honestly im not sure. any help would greatly be appreciated.
  20. i figured it out, there was an "NOT IN" syntax all along....wow...i feel dumb. here is my solution: "SELECT * FROM stories WHERE id NOT IN (SELECT storyid FROM stories_read WHERE readerid='$myid')"
  21. im trying to select stories that have not been read... i have a table called "stories" and a table called "stories_read" i tried this, but it does not work. i am not sure what the syntax for "NOT IN" is, i tried "!IN" but that does not work heres what ive got: the $myid variable is already declared as an integer "SELECT * FROM stories WHERE id !IN (SELECT storyid FROM stories_read) AND readerid='$myid'" might give you a better idea of what im trying to do here. "readerid" is in the stories_read table.
  22. looking for a select statement that can replace this: <?php $sql = mysql_query("SELECT * FROM topics"); while ($row = mysql_fetch_array($sql)) { $id = $row['id']; $readcount = mysql_num_rows(mysql_query("SELECT * FROM readtopics where topicid='$id'")); if ($readcount != 0) { echo "this topic has been read"; { } ?> any help would be greatly appreciated
  23. why isnt this working? when i press the submit button it tries to go to the new page but it seems like it just keeps loading something over and over and over the $myid variable is an integer like 23, or whatever. <?php if (!empty($_FILES['file']['tmp_name'])) { while ($row = mysql_fetch_array(mysql_query("SELECT * FROM users WHERE id='$myid'"))) { $oldphoto = $row['myphoto']; echo $oldphoto; } } ?>
  24. alright i created an image upload form everything works perfect, except that after a new image is uploaded (to replace the old one), it still shows the old one. i have added this before any html code is output: <?php header("Cache-control: private, no-cache"); header("Expires: Mon, 26 Jun 1997 05:00:00 GMT"); header("Pragma: no-cache"); ?> and that hasnt fixed anything. i can only see the new image if i manually refresh the page. any help?
×
×
  • 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.