Jump to content

TomFromKWD

Members
  • Posts

    37
  • Joined

  • Last visited

    Never

Everything posted by TomFromKWD

  1. Brilliant stuff cheers for all the support
  2. one final note I've just thought about after discussing it with the user is at what time will it recognise the date change to the new day Is it going to run off GMT, or the viewers time zone, or another time zone IE UCT,PCT etc?
  3. mysql_query ("SELECT *,DATE_FORMAT(displaydate,'%Y-%m-%d') FROM `2011-09` WHERE displaydate <= CURDATE() ORDER by day_id DESC") or die(mysql_error()); the above worked i just forgot to put my &getimages= on the front like a fool Thanks for all the support guys Youve been immense as always
  4. on that try weve gone back to it kicking out the original error and no die messgae (the or die is still in the code)
  5. its telling me "Unknown column 'thedate' in 'where clause'"
  6. it is there though, and without the date alterations im trying to make and just using the following alone works, but obviously is showing EVERYTHING in the table, including that set with a date for the future $getimages=mysql_query ("SELECT * FROM `2011-09` ORDER by day_id DESC");
  7. the error is as follows Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in "path"/2011-09.php on line 49 and unfortunately the issue persists after the above supplied code could it be to do with how I am storing the date in question in the database? and if it helps the full bit is now as follows: <?php include 'connection.php'; $getimages=mysql_query ("SELECT *,DATE_FORMAT(displaydate,'%Y %m %d') as thedate FROM `2011-09` WHERE thedate <= CURDATE() ORDER by day_id DESC"); while ($images=mysql_fetch_array($getimages)) { echo " " .$getimages['codeopen']. "" .$getimages['code']. "" .$getimages['codeclose']. ""; } ?>
  8. I am trying to get the SELECT query to take a date from a field in the database called displaydate and ensure it only shows entries that have a displaydate of the date today or earlier <?PHP mysql_query ("SELECT *,DATE_FORMAT(displaydate,'%Y-%m-%d' as thedate FROM `2011-09` WHERE DATE_SUB(CURDATE(),INTERVAL 31 DAY) ORDER by day_id DESC"); ?> the above code is just kicking out an error so I assume I've got lost somewhere but not sure where can someone please help me correct what I have wrong and explain WHY it is wrong
  9. Hi guys, I have a feeling the answer to this will be something incredibly simple I will be amazed I have failed to overlook but lets see. I have a database currently storing images as BLOB, it appears to be holding them fine, my upload page works fine to put images there etc The issue is coming when trying to display the images on an alternate page. I am using the code below, and it seems to recognize the field, however it is not displaying an image, it is displaying code. I have a feeling I need to add something to my headers to allow the page to show the images, but am not 100% sure. If someone could let me know what I am missing it would be great. Thanks in advance. <? include "config.php"; $query = mysql_query("Select * FROM app_images WHERE image_month='test' ") or die(mysql_error()); while ($row = mysql_fetch_array($query)) { echo " " .$row['image']. " <br /><br />";} ?>
  10. Hey guys I have a client who wants to upload images then have them display on his page... obviously that process is not an issue at all. The catch is he wants the image to change at midnight and display the next image in the sequence, then display it until midnight strikes, and then the next in the sequence is displayed. Is there any code type that will recognise a set time/date and display coressponding images in a database? I realise I made need to add a field for an ID number/date ID for the code to identify which image to display, but not sure what code will/wont work Can some one point me in the right direction would be much appreciated Thanks Tom
  11. do you have any form of auction ID in the database tables? You could use a NOT IN ie mysql_query("UPDATE offers SET buyer_status='Sorry, you did not win this auction' WHERE auctionID='$auctionID' AND buyer NOT IN ('$buyer')"); That would update everyone related with that auctionID who is not the "$buyer" with 'Sorrry, you did not win this auction' instead of 'auction ended, you won'.... in theory. That exact code its self wont work unless you have some form of ID you can call on to identify, and it may not be 100% perfect as its a while since I've used "NOT IN" and thats off the top of my head lol Im sure someone can touch it up, or confirm that I have added the NOT IN in the correct fasion Hope it helps at least, or points you in the right direction. Tom
  12. the coding will differ depending on your database structure do you have a database in place? if so what is the layout?
  13. Guys Im having a strange issue with my code I have a form to request a password to be sent to email incase forgotten The script seems to run as it should as in taking the info then redirecting to the messages page for confirmation no problem but its not sending the email Ive checked and double checked, and even re written the code from scratch and nothing seems to be playing ball in sending the email Can someone shed some none sleep deprived eyes over it and point out what will no doubt be an obvious error I just cant seem to see The Form: <form name="sendpw" method="post" action="sendpw.php"> <br> <table width="100%" border="0" class="tbl"> <tr> <td width="198"><div align="right">Username:</div></td> <td width="418"><input name="name" type="text" class="input" size="30"></td> </tr> <tr> <td><div align="right">Email: </div> </td> <td><input name="mail" type="text" class="input" size="30"></td> </tr> <tr> <td colspan="2"> <div align="center"> <input name="Submit" type="submit"> </div></td> </tr> </table> </form> The Script: <? include ('config.php'); $name=$_POST['name']; $em=$_POST['mail']; $query="SELECT pw FROM user WHERE uname='$name' AND email='$em'" or die (mysql_error()); $result= mysql_query($query); $row = mysql_fetch_assoc($result); $pass=$row['pw']; $to="$em"; $from="From: passwords@MBD.net"; $msg="Username: $name\r\n"; $msg .="Password: $pass\r\n"; $msg .="Please keep this password safe"; $subject="Your Login Password\r\n"; mail($to,$subject,$msg,$from); header( "Location:messages.php?msg=2" ); exit(); ?> config.php is just my database connection info, which is working fine as it runs all all my pages that access the database. Thanks Tom
  14. Thanks to all 3 of you! Ill give them a blast and see how I get on, they sound to be the right thing Im after Help appreciated
  15. is there any recomended, and prefferably free (yes Im a cheap skate ) , software program to create run and test mysql databases in a local offline scenario?
  16. Never mind guys I forgot my drop down area was actually a div too Just edited the drop down divs to be +1 on the z-index and they work fine
  17. I have a javascript drop down menu that when hovered shows extra options relating to the button hovered over. HOWEVER, I have a div on one of my pages, and the java script drop down is falling BEHIND the div Im a little stumped as I dont normally use java menus, but if someone can point me in the right direction its always appreciated. Heres a little example screen shot of what I'm talking about: (As you see the telephone and number are on the page itself, the java drop down is falling behind the div.) Im not sure what code will be relevant to you to assist me, so just tell me which bits you need and I'll post them Thanks in advance guys n gals! Tom
  18. you got the code working ok? I can give you a full example of what to change if you post me your existing code
  19. personally I add: ORDER BY rowname DESC LIMIT 1 to the SELECT * code for example if you have auto_increamental ID row called ID it would be ORDER BY ID DESC LIMIT 1 and then you can change to LIMIT 2, LIMIT 3 and so on depending on how many you want it to show
  20. I'd also add, If you are going to have a menu/nav bar do something along the lines of a "includes" folder. Have one single PHP file with the code for your menu/nav bar, then in each page you want the menu to display use a <? include ('includes folder name/menubar file name.php') ?> and then that way, if you need to make a change, you just have to edit the menu bar file, not every single page its actually on Saves time and effort to update as the site grows Edit: Obviously this can apply to more than just menu bars, anything you want displaying in multiple pages that may need editing in future could be saved as an include
  21. its laid out fine in PSpad, just seems to be a bit funny once I ctrl+C/V'd it part of the problem I spotted was I tried inserting <? } ?> like so at the end of the ..... <th align="left" scope="row"></th> <td height="200" colspan="2"><? $row_A_squad['bio'];?></td> </tr> </table> <? } ?> When I actually needed <? } } ?> As I was closing off 2 strings. I appreciate the help though, it was just one of those things where I couldnt see it until it was pointed out
  22. Ok so I have one page with a set of links created with table data: <a href="Aplayer.php?player='.$row['ID'].'">'.$row['fname'].' '.$row['lname'].'</a> That link displays fine as the first name and last name in the table as it should and also when clicked goes on to Aplayer.php?player=1/2/3etc as it should. However when it comes to loading the Aplayer.php with the appropriate ID action applied I get the following error: The codes for the Aplayer.php page is below, now I thought "unexpected $end" usually meant a '}' was missing, or incorrectly inserted in the code. I must however be wrong due to the fact Ive checked for extra/missing '}'s and all seems ok. Can someone skim through the following and point to me whats wrong, and a little explination would be nice where possible to ensure I dont make the same mistake in future. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="description" content="" /> <meta name="keywords" content="" /> <meta name="author" content="" /> <link rel="stylesheet" type="text/css" href="style.css" media="screen" /> <title>Yorkshire Leopards Cricket Club</title> </head> <body> <div id="wrapper"> <? include('includes/sidebar.php'); ?> <? include('includes/header.php'); ?> <? include('includes/nav.php'); ?> <div id="content"> <h2>Yorkshire Trust A<br> <br></h2> <? session_start(); include "includes/dbconnect.php"; //retrieve the main article if(isset($_GET['ID'])){ $_SESSION['ID']=$_GET['ID']; $getarticle="SELECT * FROM A_squad WHERE ID = ".$_GET['ID']." "; if(!$result = mysql_query($getarticle)){ echo mysql_error(); }else{ $num=mysql_num_rows($result); } ?> <table width="100%" border="0"> <? if(isset($num) && ($num > 0)){ while($row_article=mysql_fetch_assoc($result)){ ?> <tr> <th align="left" width="18%" scope="row">Name:</th> <td width="24%"><? $_SESSION['fname']=$row_A_squad['fname']; echo $_SESSION['fname'];?> <? $row_A_squad['lname'];?></td> <td width="58%" rowspan="6"><? $row_A_squad['img'];?></td> </tr> <tr> <th align="left" scope="row">Born:</th> <td><? $row_A_squad['born'];?></td> </tr> <tr> <th align="left" scope="row">Nicknames:</th> <td><? $row_A_squad['nickname'];?></td> </tr> <tr> <th align="left" scope="row">Batting Style:</th> <td><? $row_A_squad['bat_style'];?></td> </tr> <tr> <th align="left" scope="row">Bowling Style:</th> <td><? $row_A_squad['bowl_style'];?></td> </tr> <tr> <th align="left" scope="row">Bio:</th> <td> </td> </tr> <tr> <th align="left" scope="row"></th> <td height="200" colspan="2"><? $row_A_squad['bio'];?></td> </tr> </table> </div> <? include('includes/footer.php'); ?> </div> </body> </html> Thanks a bunch as always guys Tom
  23. That worked beautifully Silkfire, thanks a bunch! What I ended up using is <?=substr($row_articles['comments'], 0, 300);?>.... <a href="comments.php?aid=<?=$row_articles['artid'];?>&cid=<?=$row_articles['categoryID'];?>">Read More</a> that seems to be working well!
  24. Morning all, and Evening everyone else. Im using the following Query to display information from a table <? include "config.php"; $query1="Select *,DATE_FORMAT(date_posted,'%W,%d %b %Y') as thedate FROM article WHERE DATE_SUB(CURDATE(),INTERVAL 30 DAY) ORDER BY date_posted DESC LIMIT 1 "; $blogarticles = mysql_query($query1) or die(mysql_error()); $num = mysql_num_rows($blogarticles); ?> What I am wanting to find out, is as the blog post itself could be pages long at times, is the anyway that further down the page where I actually call the data up onto the page itself I can limit how much of it is displayed? Ive succesfully added a limit to how many records are shown with the "DES LIMIT 1", is there something I can add to my query, or further down in my displaying table (which I will code just below here) to limit the lines/characters on display until the full article is opened? Display table: <table width="75%" border="0" cellspacing="1" align="left"> <tr> <td> </td> </tr> <tr> <td> </td> </tr> <? if($num > 0){ while($row_articles = mysql_fetch_assoc($blogarticles)){ ?> <tr class="title"> <td><?=$row_articles['title'];?> </td> </tr> <tr> <td> </td> </tr> <tr class="tbody"> <td><?=$row_articles['comments'];?></td> </tr> <tr> <td> </td> </tr> <tr class="links"> <td>Date posted: <?=$row_articles['date_posted'];?> | <a href="comments.php?aid=<?=$row_articles['artid'];?>&cid=<?=$row_articles['categoryID'];?>">Comments(<? //echo $row_articles['artid']; //$thenum=row_articles['artid']; $getcomments = "SELECT * FROM article WHERE artchild='".$row_articles['artid']."'"; if(!$theResult=mysql_query($getcomments)){ echo mysql_error(); }else{ $num_comments=mysql_num_rows($theResult); echo $num_comments; } ?>) </a></td> </tr> <tr class="links"> <td> </td> </tr> <tr class="links"> <td> </td> </tr> <? } }else{ ?> <tr><td><p>There are no articles available at present</p></td></tr> <? } ?> <tr> </tr> </table> Just to clarify 'comments' is the table field that holds the blog data, it also holds comments on the blog, but the child ID is what differentiates them from one another. Thanks in advance for your help ladies & gents Tom
×
×
  • 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.