Page 1 of 5 123 ... Last
  • Jump to page:
    #1
  1. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Error


    Nothing to say but I bet all of you see what's wrong out there.

    Looking forward to Part 3 now.
  2. #2
  3. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    HTML errors in the article


    Unfortunately, the article is full of HTML errors like these:
    <br>
    &lthtml>
    <br>
    <br>
    This may only be visible in Netscape(?).
  4. #3
  5. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: HTML errors in the article


    It's okay with MSIE. I just checked it out.
    <br>
    Maybe, DevShed's editors are using IE.
    <br>
    <br>
    I wish this comments would notify the editor via email! &lt => &lt;
    <br>
    <br>
    However, this article is great enough to stand the HTML error.
    <br>
    <br>
    Jaewoong
  6. #4
  7. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Good tutorial


    Even though this is easy to pick up, I'm glad to see this kind of tutorial on php. I've been looking for something like this. I wonder how deep the php 101 is going to go.
  8. #5
  9. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Php 101


    Thanks for an excellent article on PHP!

    It is simple yet powerful.
  10. #6
  11. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    php101


    good, but could have been longer

  12. #7
  13. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Good beginnings


    I'm sending this article to friends who are just starting to use PHP. I've been using it for a few months, and had never thought of using the <tt>$submit</tt> var.
    <br>
    <br>
    However, I was a bit disappointed by the explanation of the <tt>===</tt> symbol. Although I understand what it does by reading the text, I didn't really see how it was applicable in the example.
    <br>
    <br>
    Looking forward to part 3!
  14. #8
  15. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    If "whatever" = "nothing"?


    I have a problem, I am setting up a simple job opportunity section for a radio station. I am using a mySQL database. I have no problem getting the searches to work and field to display. My problem is that when there are no jobs to display, I want to display a default "check back soon" message. I have tried everything I can think of, but still cannot get it to display the message if there are no jobs. I am pasting some of the code below and will highlight with ***** the place I am working on. Thanks to any brains that can help me.


    <?

    # setup SQL statement
    $SQL = " SELECT * FROM Opportunities WHERE Paid = 'yes'";

    # execute SQL statement
    $retid = mysql_db_query($db, $SQL, $cid);

    # Get num of rows
    $numrows = mysql_numrows($retid);

    # check for errors
    if (!$retid) { echo( mysql_error()); }
    else {

    # display results
    while ($row = mysql_fetch_array($retid))
    {

    $title = $row["Title"];
    $pay = $row["Pay_Rate"];
    $desc = $row["Description"];
    $skills = $row["Skills"];

    ***********************************
    (what's below doesn't work, please help!

    if ($title != "")
    { echo ("<font face=arial size=2><b>DEFAULT MESSAGE HERE!</b></font>"); }

    ***********************************

    if ($title > "")
    { echo ("<table cellpadding=0 cellspacing=0 border=0>
    <tr><td valign=top align=right>
    <font face=arial size=2><b>Title:&nbsp;&nbsp;</b></font>
    </td><td valign=top>
    <font face=arial size=3><b>$title</b></font>
    </td></tr> \n"); }

    if ($pay > "")
    { echo ("<tr><td valign=top align=right>
    <font face=arial size=2><b>Pay:&nbsp;&nbsp;</b></font>
    </td><td valign=top>
    <font face=arial size=2>$pay</font>
    </td></tr> \n"); }

    etc. etc..

    Thanks,
    Mike
  16. #9
  17. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: If


    This may seem too simple, but I don't know if I know what you're asking:

    if (!empty($title)) {
    print "Title:&nbsp;&nbsp; $title <BR>\n";
    }
    if (!empty($pay)) {
    print "Pay:&nbsp;&nbsp; $pay <BR>\n");
    }
  18. #10
  19. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: If


    Thanks, but that isn't it. I have got it to work if it is not empty, the problem comes when there are no jobs. I can do what you did with *** if ($title > "") { echo... *** and it works perfectly, however if there are no jobs in the database, I can't make it display a default "Sorry nothing available" type message. I thought of ***if ($title = "") { echo... *** , (meaning equal to nothing) but it didn't work. I have also tried a multitude of other "not equal to" type language, but it still will not display the message.
    <br>
    <br>
    I am wondering if there is some syntax that I either don't have or do have previously in the script that could be nullifying this function somehow.
    <br>
    <br>
    Mike
  20. #11
  21. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: If


    Ok, ok, ok....

    you said: if ($title = "")

    that would always be true!

    you should say: if ($title == "")

    You need to display more of your program. Go back a couple steps. You are getting the data from a mySQL database. something like this:

    $sql = "SELECT * FROM tablename";
    $result = mysql_query($sql);
    if ($result && $num = mysql_num_rows($result)) {
    // display your results
    }
    else {
    // display your error message of none to see
    }
  22. #12
  23. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: If


    I may have said that a little too quick in the last message.

    Let me clarify. Use the function mysql_num_rows() to see if there are results or not. Here is another way to accomplish the same thing:

    $sql = "SELECT * FROM tablename"; $result = mysql_query($sql); if ($result) { if (mysql_num_rows($result) > 0) { // display your results } else { // display your error message of none to see } } else { // could not query the database for some reason or another. }
  24. #13
  25. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: If


    Yes, that worked. I am extremely grateful for your help. I had tried about everything, and of course the answer was actually quite simple to implement as usual.

    Mike
  26. #14
  27. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    This is great stuff!


    I have read several php books and felt that I was still missing a few basics. This is filling in those gaps.

    Thanks!!!!
    Mel
  28. #15
  29. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: HTML errors in the article


    Someone fixed the HTML errors. Thanks for that.
Page 1 of 5 123 ... Last
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo