SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard dethfire's Avatar
    Join Date
    Aug 2000
    Posts
    2,477
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    data not going into database

    PHP Code:
    $conn mysql_connect("..."".....""....")
            or die(
    "Could not connect: " mysql_error());
            
    mysql_select_db("testpf"
            or die(
    mysql_error()); 

    if (!
    $conn) {
    echo 
    "Could not make a connection";
    exit;
    }

    $strSQL "INSERT INTO 'gal_photos' ('category','location','comment') VALUES('".$category."','".$location."','".$comment."')";

    $go mysql_query($conn$strSQL);
    echo 
    "<br><b><font color='green'>Submission successful</font></b>";
    echo 
    $strSQL
    No errors and I get the submission successful echo, however no data going into the database, any ideas?
    Last edited by dethfire; Jul 23, 2003 at 21:50.
    Free Science Homework Help
    http://www.physicsforums.com

  2. #2
    SitePoint Enthusiast rev909's Avatar
    Join Date
    Mar 2002
    Location
    Romania
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    According to the MySQL manual this is the correct syntax for mysql_query:

    resource mysql_query ( string query [, resource link_identifier [, int result_mode]] )

    So, the first argument is the query string. In your case:

    PHP Code:
    $go mysql_query($strSQL$conn); 
    It's not really mandatory to use the connection identifier if you only use one connection per script. So you can just use:
    PHP Code:
    $go mysql_query($strSQL); 

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2003
    Location
    Ljubljana, Slovenia
    Posts
    83
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try

    PHP Code:
    $go mysql_query($sql) or die("error in SQL statement"); 
    bye

    Armando


Bookmarks

Posting Permissions

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