Jump to content

ryanwood4

Members
  • Posts

    100
  • Joined

  • Last visited

Everything posted by ryanwood4

  1. Never used this before. How would that be implemented? Here's my code. I'm guessing it would go within the mysql_query? <?php $con = mysql_connect("localhost","XXX","XXX"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("XXX", $con); $result = mysql_query("SELECT * FROM `articles` WHERE `id` NOT LIKE '%$id%' and `category` NOT LIKE '%paddock%' ORDER BY `date` DESC LIMIT 0,10"); while($row = mysql_fetch_array($result)) { echo '<div class="menu"><div class="item">'; echo '<h1><a href="news/display/'.$row['id'].'">'.$row['title'].'</a></h1>'; echo '<img src="../../'.$row['image'].'"/>'; echo '<p>'.$row['body'].'</p>'; echo '</div></div>'; } mysql_close($con); ?>
  2. Hi, I can't figure out how to limit the word count fetched from the database. I simply want to show 10 words from the 'body' column. I'm using the below echo code to display the information. echo '<div class="menu"><div class="item">'; echo '<h1><a href="news/display/'.$row['id'].'">'.$row['title'].'</a></h1>'; echo '<img src="../'.$row['image'].'"/>'; echo '<p>'.$row['body'].'</p>'; echo '</div></div>'; Any help is appreciated. Thanks.
  3. Does anyone know of any scripts to output the meta data from an image? I've had a look around and I can't see a simple script which displays basic image meta data, such as title, tags, camera used, etc. Thanks.
  4. Thanks. I'll give that a go. However, that might work out the size, but how can I access and output all the data stored in the images properties, i.e. Title, description, tags, device make, model etc???
  5. Hi, I'm not 100% sure if this is HTML, PHP or Javascript, but my best guess is PHP. When you upload an image on Facebook, it automatically gathers the data about the image, i.e. size, device used (i.e. Canon, iPhone), title and description. It then outputs this on the page. Is there anyway to do this with PHP, instead of having to type all the information out again and upload that with the photo to a database? Cheers.
  6. I tried that, unsuccessfully though, not quite sure how to implement it correctly. Any help would be much appreciated.
  7. I'm using the fairly simple below code to output a list of the latest articles, but I'm wanting (not sure if it's possible) to display the articles from the current day in bold so users recognise that they are new and the older ones non-bold. I've tried a few things, but they're not giving the desired results. <?php $con = mysql_connect("localhost","xxx","xxx"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("xxx", $con); $result = mysql_query("SELECT * FROM `articles` WHERE `quotes` NOT LIKE '%yes%' ORDER BY `date` DESC limit 0,14"); echo "<table class='links' border='0' width='100%'>"; while($row = mysql_fetch_array($result)) { echo '<tr><td width="270" valign="top"><h4>» <a href="news/display/'.$row['id'].'">'.$row['title'].'</a></td><td width="40" valign="top"><span class="small">'.date("M d", strtotime($row['date'])).'</span></h4></td></tr>'; } mysql_close($con); ?> Cheers!
  8. Cheers, works great. I now know what I was doing wrong too. Thanks.
  9. Yep: ip | Varchar (20) It's in the same table as the comments: 'articlecomments'
  10. Hiya, I'm trying to track the IP address of users leaving comments, however I am struggling to integrate it into the code (below), several attempts have failed. $_POST['comment'] = str_replace("'", "\'", $_POST['comment']); $sql="INSERT INTO articlecomments (articleID, posterNickname, email, comment) VALUES ('$_GET[id]','$_POST[name]','$_POST[email]','$_POST[comment]')"; mysql_query($sql); Any help is, as always, greatly appreciated. Thanks in advance.
  11. The longish code is in the database under the row 'poll' - which is what I'm trying to echo - it shows up in the source, but it doesn't show up on the page. If you look at this page: http://www.thef1times.com/news/display/00001 - it doesn't show the poll at the bottom of the text (main article text), but if you check the source code, it does display the echoed code - however the code isn't doing what it would, if it was simply added to the page.
  12. Hi, How do you go about including the below code on a page? I have added it to the database, and I'm using an echo function to display it, but it doesn't seem to work, is there anything special you need to do to echo code? The code I need to echo: <?php include("poll/Poll.php"); echo Poll(1, "poll/template.tpl", "poll/data.xml"); ?> I've used <? echo $poll?> to echo it, but it doesn't show anything. Thanks (not sure if that made much sense, but it's hard to explain)
  13. Work's perfectly! Thanks.
  14. The format is (example): 2010-02-28 12:17:37
  15. Don't seem to be getting any results with that?
  16. That's a better way of putting it! That's exactly what I want to do.
  17. Well the script above displays results from the database immediately after they are added, however we want a delay of 10 minutes before results are displayed. Does that make sense?
  18. Hello, How would I delay results by 10 minutes, using the below script. Not sure what I need to add to delay the results. Each result has a datetime called date in the database. <?php $con = mysql_connect("localhost","xxx","xxx"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("xxx", $con); $result = mysql_query("SELECT * FROM members ORDER BY date DESC limit 0,1"); while($row = mysql_fetch_array($result)) { echo '<img class="scaled" src="'.$row['image'].'"/><br />'; echo '<h3><a href="display/'.$row['id'].'">'.$row['title'].'</a></h3>'; } mysql_close($con); ?> Any help is greatly appreciated. Thanks in advance.
  19. Yea, but i don't know how to delay that by a certain period of time.
  20. Is there anyway to delay results being shown by 10 minutes. For example, I'm using this fairly basic code below to display results, but I need it to not show results posted in the last 10 minutes - this gives editors some moderation time to vet the results. Is it possible? <?php $con = mysql_connect("xxx","xxx","xxx"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("xxx", $con); $result = mysql_query("SELECT * FROM members ORDER BY date DESC limit 6,12"); echo "<table class='links' border='0' width='100%'>"; while($row = mysql_fetch_array($result)) { echo '<tr><td width="270" valign="top"><h4>» <a href="display/'.$row['id'].'">'.$row['title'].'</a></td><td width="40" valign="top"><span class="small">'.date("M d", strtotime($row['date'])).'</span></h4></td></tr>'; } mysql_close($con); ?> The database holds information on the time articles were posted. Thanks.
  21. I'm using the code below to display images from a database, then using the echo function to display them on the page. However, I also have arrows either side of the photo's so you can click next to see the next image in the database or previous to see the previous. <?php $con = mysql_connect("xxx","xxx","xxx"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("xxx", $con); $photoID = $_GET['photoID']; $result = mysql_query("SELECT * FROM galleries WHERE photoID = '$photoID'"); while($row = mysql_fetch_array($result)) { $title = $row['photoTitle']; $image = $row['photoPath']; $body = $row['photoDescription']; $photoID = $row['photoID']; $credit = $row['photoCredit']; } mysql_close($con); ?> However, the echo function below causes a problem, for example if your on the last photo in the set, say id=51, and you press next it will reload the page, but because there isn't a photo with the id=52 it shows a blank page. <? echo $photoID+1?> How do you limit it, so that it either won't allow you to press next on the last image, or so it returns the first image in the set? Thanks, hope that made sense. Ryan
  22. Hiya, I'm trying to set a cookie to last a good 150 days or 3600 hours. But the script below doesn't seem to be adding the cookie correctly. Sometimes members are logged in for a few hours, sometimes a day. But never more than a few days. The part of the code which adds the cookie: // if login is ok then we add a cookie $_POST['email'] = stripslashes($_POST['email']); $hour = time() + 3600; setcookie(ID_my_site, $_POST['email'], $hour); setcookie(Key_my_site, $_POST['password'], $hour); Anyone know why it isn't working correctly? Thanks.
  23. That did the trick! Thank you very much.
  24. I'm trying to get a select box to show the result stored in a database as the default, but the value="<? echo $repeat?>"> function doesn't work. Example: User selects Repeat, saves there choice, then comes back to change it, it will show No-Repeat, rather than Repeat. <select name="repeat" size="1" id="repeat" value="<? echo $repeat?>"> <option value="no-repeat">No-Repeat</option> <option value="repeat">Repeat</option> <option value="repeat-x">Horizontally</option> <option value="repeat-y">Vertically</option> </select> Any help is greatly appreciated, it might be so simple, and if it is, I apologise. Thanks.
  25. Ok, I have figured it out, it was very simple. I just echoed the current URL and added +1.
×
×
  • 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.