Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Dec 2005
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Newbie need your help

    Newbie need your help
    Can you please tell me what's wrong with this code)


    $result = query("SELECT Bloom_Name FROM ihs WHERE Bloom_Name = $Bloom_Name);
    if (mysql_num_rows($result) >= 1) {
    $error="Cultivar Name Already Used, Please use another Name";
    echo $error;
    } else {
    $insert = $query="insert into ihs (Bloom_Name,Pod_Parent,Pollen_Parent,

  • #2
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,778
    Thanks
    19
    Thanked 155 Times in 146 Posts
    First of all, please
    PHP Code:
    use PHP tags 
    when you display PHP code in your forum post....

    Are you getting any error messages? Usually they help to pinpoint a problem....

    PHP Code:
    $query "SELECT Bloom_Name FROM ihs WHERE Bloom_Name='" $Bloom_Name "'";
    $result mysql_query($query);
    if (
    mysql_num_rows($result) >= 1
    {
      die(
    "Cultivar Name Already Used, Please use another Name");

    else 
    {
      
    $query "INSERT INTO ihs (Bloom_Name,Pod_Parent,Pollen_Parent) VALUES ('" $Bloom_Name "','value2','value3')";
      
    $result mysql_query($query);
      if (
    mysql_affected_rows() < 1
      {
        die(
    "The table row was not added");
      } 

    I recommned this site for learning PHP: http://us2.php.net/manual/en/index.php

    And this site for learning SQL: http://www.w3schools.com/sql/default.asp
    Last edited by chump2877; 02-13-2006 at 12:12 AM.
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!

  • #3
    Senior Coder
    Join Date
    Sep 2005
    Posts
    1,791
    Thanks
    5
    Thanked 36 Times in 35 Posts
    You probably want to put single-quotes around $Bloom_name

  • #4
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,778
    Thanks
    19
    Thanked 155 Times in 146 Posts
    my bad...
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •