Jump to content

[SOLVED] Php parse not working


DrTrans

Recommended Posts

$connect = mysql_connect("localhost","damgears_evil","****");
    mysql_select_db("damgears_evil", $connect);
        $result = mysql_query("SELECT * FROM sales WHERE key = '$key'");
        if (mysql_num_rows($result)== FALSE)
        {
            echo "Error: Contact Affliction Lexington.";
            mysql_close($connect);
        }
        else
        {
           
	   $queryb = mysql_query("INSERT INTO titles VALUES ('','$fname','$lname','$key','$slname','$skey','$date','$striped','$region')");
		mysql_close($connect);
        echo "$title";
	}

 

basically what i want to do here is if there are no records in the sales table for that key . then echo" Error" . if there is a key that matchs.. insert record.

 

Please help.

Link to comment
Share on other sites

the connection works and so does the select:

 

I replaced the code with this

 

if($title){
  
    
    
 echo "$title";
 $connect = mysql_connect("localhost","damgears_evil","damgears");
     mysql_select_db("damgears_evil");
    // $queryb = mysql_query("INSERT INTO titles VALUES (fname, lname, key, sname, skey, date, title, region) VALUES ('$fname','$lname','$key','$slname','$skey','$date','$title','$region')");
     $queryb = mysql_query("INSERT INTO titles VALUES ('','$fname','$lname','$key','$slname','$skey','$date','$striped','$region')");
      mysql_close($connect);
   } else 
   echo"Problem.. Check Database";

 

And it inserts the information just fine into the "titles" table.

 

However like i said, Im wanting to check to make sure the " Sale" has happened before it inserts into the "titles" table. by using that SELECT * FROM sales WHERE key = '$key'

 

In my sales table i have

 

fname

lname

key

date

region

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.