I have a page that executes 2 separate SQL queries.
For example - if a user submits his email address through a form - I query the db to check for duplicates and then returns a value.
Then if the user isn't in the DB - I run an Insert query. Currently, for each separate query, I am writing out --
db_name = "DB";
$table_name = "mail_list";
$connection = @mysql_connect("localhost", "ptest", "ptest1")
or die("Couldn't connect.");
$db = mysql_select_db($db_name, $connection)
or die("Couldn't select database.");
Can I use the variables from the first query to create both statements rather than have to write them out each time? I'm guessing mysql_pconnect is used in this case?
thanks
Mark
For example - if a user submits his email address through a form - I query the db to check for duplicates and then returns a value.
Then if the user isn't in the DB - I run an Insert query. Currently, for each separate query, I am writing out --
db_name = "DB";
$table_name = "mail_list";
$connection = @mysql_connect("localhost", "ptest", "ptest1")
or die("Couldn't connect.");
$db = mysql_select_db($db_name, $connection)
or die("Couldn't select database.");
Can I use the variables from the first query to create both statements rather than have to write them out each time? I'm guessing mysql_pconnect is used in this case?
thanks
Mark