Thread: PHP3 + MySQL

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    3
    Rep Power
    0
    I'm trying to design a form using PHP3 which will only print results should their be information in the appropriate column in MySQL. I thought the syntax was something like this, but to no avail.

    if ($row["column"] == [A-Za-z]){
    print ("This column is full")
    } else {
    print ("This column is empty")
    }

    Explanation: If there is text in the column, print "The column is full", otherwise, print "The column is empty".

    Any advise?
  2. #2
  3. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15
    You can check a empty row in different ways.

    probably you can isempty() function.
    eg:
    if (isempty($row["column"])){
    print ("This column is empty")
    }else{
    print ("This column is full")
    }


    ------------------
    SR -
    shiju.dreamcenter.net
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    3
    Rep Power
    0
    This is what a inserted:

    if (isempty($row["minor_a1"])){

    print ("</td></tr><tr><td align=right>Minor(s):&nbsp;</td><td>");
    print $row["minor_a1"];
    print (",&nbsp;");
    print $row["minor_a2"];

    } else {

    print ("");
    }

    However, the isempty command doesn't seem to be working. I can't seem to locate any documentation on isempty either to help me. Any other ideas?
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    10
    Rep Power
    0
    Just reverse the logic, and instead of using the isempty() function, just write the if statement with the call to the part of the array you are checking. If it doesn't exist, the if statement will come back false, and voila! you've got yourself your answer and without having to run an unecessary function call! *<(:-{)

    ------------------
    Let me know if this helps, Cryption

    [This message has been edited by Cryption (edited May 02, 2000).]
  8. #5
  9. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    The reason isempty() isn't working is because there isn't any such animal. The correct function is empty()
  10. #6
  11. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    3
    Rep Power
    0
    Thanks Rod k! That seems to have done it.

Similar Threads

  1. Mysql problem.
    By Nik in forum MySQL Help
    Replies: 54
    Last Post: December 21st, 2006, 06:02 PM
  2. Upgrade from access to mysql
    By karib1 in forum ASP Programming
    Replies: 7
    Last Post: December 16th, 2003, 12:35 PM
  3. Upgrade from access to mysql
    By karib1 in forum MySQL Help
    Replies: 1
    Last Post: December 16th, 2003, 12:27 AM
  4. problem: asp files, from access to mysql
    By karib1 in forum MySQL Help
    Replies: 1
    Last Post: November 26th, 2003, 03:16 AM

IMN logo majestic logo threadwatch logo seochat tools logo