Jump to content

NewcastleFan

Members
  • Posts

    64
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

NewcastleFan's Achievements

Member

Member (2/5)

0

Reputation

  1. Hmmm ok thanks for the help guys! i'll look into it some more and see how else I can get this working
  2. Flash I've been told is a big no for SEO and website development.
  3. Would this be possible to be 3d? forgot to mention that in the fist post. It would have to look real like a video not just like a static image falling into another static image.
  4. I'm not sure if this is possible but im looking to get an object say a ball, and drop it into a pool of water at the bottom of of the page and for the water to splash upwards and freeze (like watching a video of it). Is this possible not using flash? This is for a web project on a browser so I'm not sure if it is possible using html5, css, jquery? If it is possible does anyone know of any examples that use or do this sort of thing it that I could look at? Thanks!
  5. Hey all, I'm trying a little project to help improve my php and mysql knowledge. I'm struggling with email validation and security. I'm looking to check if an email is valid or not before I add the ability to add it into a database. What I have so far: <?php $errormsg =""; if (isset($_POST['adduser'])){ $email = mysql_real_escape_string($_POST['email']); $pword = mysql_real_escape_string($_POST['pword']); $pword2 = mysql_real_escape_string($_POST['pword2']); if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { if ($email == "") { $errormsg ="Error, You must fill in the email box."; } else if ($pword == "") { $errormsg ="Error, You must fill in the password box."; } else if ($pword2 == "") { $errormsg ="Error, You must fill in the repeat password box."; } else if ($pword != $pword2) { $errormsg ="Error, Your passwords don't match!"; } else { $errormsg = "Success!"; } } else { $errormsg = "Invalid email format, please use a valid email address."; } } ?> This always outputs the error message "Error, You must fill in the email box" now, however without the Filter_Validate_email it outputs success when all boxes are filled in. Anyone got any help on a ) whats going wrong and b ) any other security features I can add? Thanks!
  6. Hey everyone, I'm trying to select multiple rows from one table, depending on the ID given from another table. I've got it half working with the code below, however it echo's out each blog multiple times depending on how many different tags are assigned to it, how would I go about so it displays multiple tag's on one copy of the blog post? $sqlCommand = "SELECT blogid, blogtitle, content, blogtime, category, blogseourl, author FROM blog ORDER BY blogtime DESC"; $query = mysqli_query($myConnection, $sqlCommand) or die (mysqli_error()); $blogDisplay = ''; while ($row = mysqli_fetch_array($query)) { $blogid = $row["blogid"]; $blogtitle = $row["blogtitle"]; $content = $row["content"]; $blogtime = $row["blogtime"]; $category = $row["category"]; $blogseourl = $row["blogseourl"]; $author = $row["author"]; $contentshort = substr($content, 0, 250); $sqlCommand2 = "SELECT tag FROM blogtags WHERE blogid='$blogid'"; $query2 = mysqli_query($myConnection, $sqlCommand2) or die (mysqli_error()); while ($row = mysqli_fetch_array($query2)) { $tag = $row['tag']; $blogDisplay .= '<h1><a href="/blog/'. $blogseourl .'"> ' . $blogtitle . ' </a></h1> ' . $contentshort . '... <a href="/blog/'. $blogseourl .'">Read More...</a><br /><br /> ' . $author . ' posted on ' . $blogtime . ' | Category: ' . $category . ' | Tags: ' . $tag . ' | <a href="/blog/'. $blogseourl .'#disqus_thread"></a>'; } } mysqli_free_result($query); So everything is working correctly apart from it echoing multiple $blogDisplay's for each tag. Anyone got any ideas?
  7. Was hoping I wouldn't have to create another table So I need another table like: BlogID ¦ Tag 1 ¦ testtag1 1 ¦ testtag2 1 ¦ test 2 ¦ testtag2 2 ¦ test 2 ¦ testtag1 To then re-write everything to pull from both tables? I thought it would of been a lot simpler to just use one table and the implode and explode functions
  8. That would work if I only had one tag for each post correct? The tag column has the option of multiple values e.g; "testtag1, testtag2". So if I only used the "LIKE '$pageid'" it will only filter items if they are the exact match so I couldn't have a tag page for testtag1 and a separate page for testtag2 it would have to be a page for both testtag1 and testtag2.
  9. Hey guys, not sure if anyone will be able to help with this but I have a small issue with a select filter I'm trying to use. I'm trying to select posts with the correct tag's to display a list of the posts in the page. I've got it working to a certain extent with the code below, however I have this small issue: If I click the link that says "testtag1" it will filter the posts and only show the posts with testtag1. But If I have a shortened link say the tag is called just "test" it will bring up anything with test in it, so posts with testtag1, testtag2, test will appear. is there a way to refine the LIKE filter in mysql to stop this? if (!$_GET['tagseourl']) { $pageid = ''; } else { $pageid = $_GET['tagseourl']; } $sqlCommand = "SELECT blogid, blogtitle, content, blogtime, category, blogseourl, tag, author FROM blog WHERE tag LIKE '%$pageid%'"; $query = mysqli_query($myConnection, $sqlCommand) or die (mysqli_error()); $blogDisplay = ''; while ($row = mysqli_fetch_array($query)) { $blogid = $row["blogid"]; $blogtitle = $row["blogtitle"]; $content = $row["content"]; $blogtime = $row["blogtime"]; $category = $row["category"]; $blogseourl = $row["blogseourl"]; $tag = $row["tag"]; $author = $row["author"]; $contentshort = substr($content, 0, 250); $blogDisplay .= '<h1><a href="/blog/'. $blogseourl .'"> ' . $blogtitle . ' </a></h1> ' . $contentshort . '... <a href="/blog/'. $blogseourl .'">Read More...</a><br /><br /> ' . $author . ' posted on ' . $blogtime . ' | Category: ' . $category . ' | Tags: ' . $tag . ' | <a href="/blog/'. $blogseourl .'#disqus_thread"></a>'; } mysqli_free_result($query); The field tag in the database looks like this: ID ¦ tags 1 ¦ testtag1, testtag2, testtag3 2 ¦ test. testtag1 3 ¦ testtag2, testtag3 etc.
  10. Not sure how its working now but this is what worked no idea why if anyone else is stuck: $sqlCommand = "SELECT tag FROM tags"; $query2 = mysqli_query($myConnection, $sqlCommand) or die (mysqli_error()); $tagoptions=""; $posttag = explode(',', str_replace(' ', '', $posttag)); while ($row = mysqli_fetch_array($query2)) { $tag = $row["tag"]; if (in_array($tag, $posttag)) { $checked = "checked"; } else { $checked = ""; } $tagoptions.="<input type='checkbox' name='checkboxname[]' value='$tag' $checked>".$tag.'<br>'; }
  11. Yes, unfortunately all of them are $posttag in my script. No idea where this is going wrong.
  12. $tagoptions was echoed yes, it output the correct list of check boxes but none were selected. $posttag was pulled from the database column posttag which is a text field, and had the value of "tag1, tag2" so the check boxes for tag1 and tag2 should be selected.
  13. Thanks for the reply, this still unfortunately does nothing I've tried to take it back to basics and remove the database calls just to figure out how to get this to work: <?php $posttag = "tag1, tag2"; $posttag = explode(',', str_replace(' ', '', $posttag)); $tag = "tag1, tag2, tag3"; if (in_array($tag, $posttag)) { $checked = "checked"; } else { $checked = ""; } } echo $posttag; ?> <br> <input type='checkbox' name='checkboxname[1]' value='tag1' <?php echo $checked ?>>Tag1<br> <input type='checkbox' name='checkboxname[2]' value='tag2' <?php echo $checked ?>>Tag2<br> <input type='checkbox' name='checkboxname[3]' value='tag3' <?php echo $checked ?>>Tag3<br> However this now isn't even working ha, just returns a blank screen
  14. That doesn't seem to do anything, no boxes are checked no matter the value of $posttag. Not sure if I've explained it correctly I'm not the greatest at explaining sorry. $posttag would come through with a value of "tag1, tag2" $tag would come through in an array with my while loop "tag1" "tag2" "tag3"
  15. The posttag is opened up in the array here? $string = $posttag; $array = explode(',', $string); if ($string == $array) { $checked = "checked"; } else { $checked = ""; } I've used explode to separate them but then I'm not sure how to get from that point to checking to check the box?
×
×
  • 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.