Jump to content

simcoweb

Members
  • Posts

    1,104
  • Joined

  • Last visited

Everything posted by simcoweb

  1. Summary: * ad posters can create one ad per every 7 days * their email address is the user id i'm working off of to determine if they've already submitted an ad * say they try to submit an ad 3 days after submitting a previous ad * I want a message to say 'You can not post an ad until Saturday... blah blah'. I need to find the date they submitted their current ad which is no problem since it's inserted into the database when they created the ad. Now, it's 3 days later and they want to submit another. I need to determine if it's been 7 days or not and, if not, display an error and, if so, let it go through. Here's what I have but it doesn't work (or why else would I be posting... eh? lol) <?php $date1 = '11/25/06'; $date2 = "now"; $start = strtotime($date1); $end = strtotime($date2); $days = ($date2 - $date1) / (60*60*24); $diff = number_format($days); echo $diff; ?> This is not 100% accurate to how it would actually be written but it's my working model to get the math right. The logic here line by line is: 1. get the date from the current db entry 2. get today's date 3. calculate the time stamp for the date of their ad posting 4. calculate the time stamp for today 5. calculate the difference 6. print the difference Obviously something is not right as it returns -0 as the value. Help anyone?
  2. When I Google 'mephit' I get stuff about furry animals about 4 feet tall. Nothing about a PHP Editor Not sure what you mean by validate the code. Does it do some sort of debugging? Or syntax checking?
  3. corbin, ok...so many of the terms are similar but just preceded with mssql. This shouldn't be too hard to 'adapt' to using this... I hope! I went to the PHP manual page and researched it also. The queries will be pretty straightforward stuff. Basically it's a shopping cart that using points as a currency instead of money. Problem is ALL the class files in this cart are written for MySQL queries. What i'm hoping is that I will be able to simply go through them and convert them to MSSQL queries since the requests are similar. Maybe i'm dreaming here?
  4. I have a client that insists we use their MS SQL database for some programming we're doing. Since i've only worked with MySQL and PHP I don't have any reference, disastrous pitfalls to avoid, hardships to be aware of, etc. in doing so. Looking for a bit of guidance here and any experiences. Thanks!
  5. Has this code been modified at all recently? Or is that its original state?
  6. I'm working on a classified ads system and the client wants the ability for ad posters to insert up to 3 images into the ad. I'd like to have this consolidated into one registration form where there would be 3 fields for the photo uploads. I've done a few scripts with single image uploads but no multiples. I'm assuming i'd have to repeat various aspects of the code for image1, image2, image3. Or, is there some way or example of how this would work that someone could post or point me to?
  7. Please show us the code in the 'processscript.php' file.
  8. Not sure what you're trying to do. You want a radio button to hold a value? Or are you trying to figure out a way to automatically select which radio button is chosen? Your example has one radio button. Radio's are an 'either/or' choice selection. Please clarify your question
  9. I think what i'm getting to is HOW do you determine that you want to show A particular video? In other words, are you just wishing to show a specific video on the page? Or is this something that a visitor would select to see? Do you want a random video to show up on the home page? What we need to determine here is WHY that particular video. And WHAT happens prior to the video being shown. Does someone come to your site, see a button that says Videos, takes them to a page that shows ALL of them? Or just one? Where does this video come into play?
  10. If you want to play a specific video then you would need to have a link/url that points to it. Like this: <a href="playvideo.php?video_id=24">Play This Video</a> Now, how you get that id # in there is the trick. First, you must provide a list or something where these people can choose from to watch videos. Is that right? In other words, are you providing some type of selection list that they would click on to view videos? If not, then what does this actually mean:
  11. Shazaam! Worked like a charm. Thanks! I had the stripslashes outside the quotes which basically just echoed it instead of stripping the slashes. Learn more each day
  12. I have the results from a query set up like this: <?php while ($row = mysql_fetch_array($results)) { echo "<table align='center' border='1' cellpadding='4' cellspacing='0' style='border-collapse: collapse' width='600' bordercolorlight='#CCCCCC' bordercolordark='#CCCCCC'> <tr> <td colspan='2' bgcolor='#E0E1E8'><font face='Verdana'>Each step for $date trades is outlined below. Follow each step precisely.</font></td> </tr> <tr> <td width='8%'><b><font face='Verdana' size='2'>Step One:</font></b></td> <td width='92%' style='font-family: Verdana; color: #333333; font-size: 10pt'>" . $row['step1'] . "</td> </tr> <tr> <td width='8%'><b><font face='Verdana' size='2'>Step Two:</font></b></td> <td width='92%' style='font-family: Verdana; color: #333333; font-size: 10pt'>" . $row['step2'] . "</td> </tr> <tr> <td width='8%'><b><font face='Verdana' size='2'>Step Three:</font></b></td> <td width='92%' style='font-family: Verdana; color: #333333; font-size: 10pt'>" . $row['step3'] . "</td> </tr> <tr> <td width='8%'><b><font face='Verdana' size='2'>Step Four:</font></b></td> <td width='92%' style='font-family: Verdana; color: #333333; font-size: 10pt'>" . $row['step4'] . "</td> </tr> <tr> <td width='8%'><b><font face='Verdana' size='2'>Details: </font></b></td> <td width='92%' style='font-family: Verdana; color: #333333; font-size: 10pt'>" . $row['details'] . "</td> </tr> </table><br>\n"; } ?> I need to strip the backslashes out of the results. Not sure of the proper method and syntax. Any help/guidance would be appreciated. Thanks!
  13. Actually you'd put the table name there, not the database name. Database contains tables tables contain fields fields contain data When you do a query you select data from fields within tables. You do, however, have to connect to the database. That requires code like this: <?php $conn = mysql_connect('hostnamehere', 'usernamehere', 'passwordhere') or die(mysql_error()); $db = mysql_select_db('databasenamehere') or die(mysql_error()); ?> This should be above the query code and, obviously, you'd replace those parameters with the actual info for your database. For the 'what' where it says 'Action', yes..you'd replace that with the field you want to identify with. That is what the query will pull from in order to produce the results. You don't HAVE to have the 'WHERE' clause in there. You can simply pull all the videos if you wish by deleting it. BUT, if you have hundreds of vids to display then the page would be a mile long. You'd need some pagination to make it work right.
  14. Looks like you're using Joomla. Is that it? Ok, well... here's the scoop. You can do a query that summons the info from that field but it has to have an 'identifier' in order to do so. Usually that's some sort of unique field like an auto-incrementing 'id' field. So, for every video you enter a 'counter' moves up a notch. If you want to display all videos in a category, for example, then you'd write something like this <?php $sql = "SELECT * FROM videos WHERE category='Action'"; $results = mysql_query($sql) or die(mysql_error()); $echo "<table width='500' border='0' align='center'>"; while ($row = mysql_fetch_array($results)) { echo "<tr><td>" . $row['title'] . "</td><td>" . $row['description'] . "</td><td><a href='http://www.yoursite.com/linktovideo.php?video_id=" . $row['video_id'] . " '>View Video</a></td></tr>"; } echo "</table><br>\n"; ?> That would summon all the videos in that category and place them into a table with each video occupying a different row. The example of the URL is what I think you're looking for. You populate it by doing the query, fetching the array, then populating that spot in the URL with the field used for the id.
  15. Let's start from a solid beginning so we can get this answered. First, show me the code you use to insert the video(s) id(s) and related info into your database. I'm assuming you're using a form to add these. Once we determine how you get it in there then we can determine how you can get it out of there.
  16. Just make the Clan_id the primary and auto-increment. That way you can use the Clan_id in all types of queries since it's guaranteed to be unique.
  17. You can't make a name 'auto-increment'. That refers to integers (numbers). Make sure your auto-incremented ID field is set to INT.
  18. You don't need to set it as unique if you're going to validate it in the code. You're already checking that with the 'if' statement. Also, get in the habit of using double quotes for your echo statements. That way you can have other characters in the text. Single quotes restricts you.
  19. Let's experiment and get rid of some things that aren't absolutely needed. Try this: $sql = "SELECT * FROM bhdsingle WHERE clan_name='$clan_name' "; $result= mysql_query($sql, $connection) or die(mysql_error()); if (mysql_num_rows($result) > 0 ) { echo "Sorry, that clan name is already registered here at PST. Please choose another clan name."; include("bhdsingle_join_form.html"); } else { $sql = mysql_query("INSERT INTO bhdsingle (clan_name, logo, message, email, aim, yahoo, msn, signup_date) VALUES('$clan_name', '$logo', '$message', '$email', '$aim', '$yahoo', '$msn', 'now())'") or die (mysql_error()); echo "Congratulations on registering your new clan for the BHD Singles Ladder!"; } As a footnote, IF your database fields and params aren't set up properly then the code won't work as laid out.
  20. Ok, then try this: $sql = "SELECT * FROM bhdsingle WHERE clan_name='$clan_name' "; $result= mysql_query($sql, $connection) or die(mysql_error()); if (mysql_num_rows($result) > 0 ) { echo 'Sorry, that clan name is already registered here at PST. Please choose another clan name.'; include('bhdsingle_join_form.html'); exit; } else { $sql = mysql_query("INSERT INTO bhdsingle (clan_name, logo, message, email, aim, yahoo, msn, signup_date) VALUES('$clan_name', '$logo', '$message', '$email', '$aim', '$yahoo', '$msn', now())") or die (mysql_error()); $clan_id = mysql_insert_id(); echo 'Congratulations on registering your new clan for the BHD Singles Ladder!'; }
  21. $query = "SELECT date, subject, news, time FROM news_all ORDER BY date LIMIT 5";
  22. Just for fun change the last part to this: $sql = "SELECT clan_name FROM bhdsingle WHERE clan_name='$clan_name' "; $result= mysql_query($sql, $connection) or die(mysql_error()); if (mysql_num_rows($result) > 0 ) { echo 'Sorry, that clan name is already registered here at PST. Please choose another clan name.'; } include('bhdsingle_join_form.html'); } else { $sql = mysql_query("INSERT INTO bhdsingle (clan_name, logo, message, email, aim, yahoo, msn, signup_date) VALUES('$clan_name', '$logo', '$message', '$email', '$aim', '$yahoo', '$msn', now())") or die (mysql_error()); $clan_id = mysql_insert_id(); echo 'Congratulations on registering your new clan for the BHD Singles Ladder!'; }
  23. I think after all your posts that what you are after is how do you get the video id number onto your link so when someone clicks on it the movie opens. Is that basically it?
  24. Try installing one of the 'suite' packages like XAMP or WAMP. I have XAMP installed with Apache/PHP5.x no problem
  25. I'd point you to many of the fine tutorials here at PHPFreaks as well as others you can learn the basics from for free all around the web. Plus, there's always the official PHP site at www.php.net There's some great mini-tutorials and basics on both PHP and MySQL here: http://www.w3schools.com/php/default.asp
×
×
  • 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.