Hello all,
So, I've successfully set up the columns and added the first few rows of test data into my database using phpMyAdmin on my web host. Now, the next step is to have the PHP properly set up to connect to the database. I've used the mysql_connect() and mysql_close() at the beginning and the end with the login credentials needed for my database entry- now, which method do I use to specify the table name? I see a pg_connect() for Postgre SQL (whatever that is). Then I need to know what PHP function do I use to write an SQL query inside of.
Again, this is for my page at World Review Group.
Code PHP:
Thank you very much for your guidance. It keeps me going.Code:<?php /*This is the scripting section for the e-mail collection box.*/ $email = " "; $connection = mysql_connect("worldreviewgroupcom.fatcowmysql.com" , "username" , "password"); $dbconn = pg_connect("dbname=emailcollection"); if (!$connection){ die('Could not connect: ' . mysql_error()); } function showWindowAndValidate() { echo'<div id="activeemailbox"><input type="checkbox" value="Yes, I would like to join the mailing list."><p>Enter the characters you see below.</p></div>' . generateRandom() . ; } if (isset($_POST["go"]){ $email = $_POST["go"]; if (isItAValidEmail($email)){ showWindowAndValidate(); //call a function to write the user to database } else { invalidEntry(); } else { invalidEntry(); } /*test the e-mail address submission for valid entry */ function Boolean isItAValidEmail($email){ if(!filter_var($email, FILTER_VALIDATE_EMAIL)) { return false; } else { return true; } } function invalidEntry() { return echo'<div id="activeemailbox"><p id="error">You didn\'t enter a valid email, silly!</p><input type="submit" value="Go Back" onclick="goBack()"></div>'; } function generateRandom() { } function goBack() { header(); } mysql_close($connection); //end e-mail box scripting section ?>



Reply With Quote





Bookmarks