scott532
-
Posts
14 -
Joined
-
Last visited
Never
Posts posted by scott532
-
-
Hello, I apologize in advance for being new to working with MySQL and databases in general...
I'm running MySQL 4.1.11
Table structure is:
salons(id, name, email, salon_name, address, city, state, zip, phone, website)
I hope this is sufficient info for help
I am trying to take out duplicate rows from my table.I now realize I should have used a unique index on all my user emails. What is the best way to deal with this situation? Should I create a new table with the unique rows, or should I delete all duplicate entries?
I found the duplicates with this:
SELECT email, count(*) AS duplicates
FROM salons
GROUP BY email
HAVING duplicates > 1
ORDER BY duplicates;
Where do I go from here?
Thanks,
Scott
-
Hi, I'm trying to get the POST info to mysql, and there should be a confirmation message... specified in the create_account function. But once I POST my info, I'm only getting the register_form function. I'm thinking there's a problem with my switch statement at the end. Can someone tell me what's wrong with it.
[code]<html>
<head>
<style type="text/css">
body {
font-family: 'Lucida Grande', Arial; font-size: 11px; color: #333;
background: url(img/bg_texture.jpg);
}
th { text-align: right ; font-size: 12px; border-bottom: 1px solid #999; }
input, select, textarea {
background: #EEE;
}
</style></head><?php
include_once "./common_db.inc";
function register_form()
{
global $PHP_SELF;
$link_id = db_connect();
mysql_select_db("sample_db");
mysql_close($link_id);
?>
<body>
<center>
<h3>Sign Up For A Free PRAVANA DVD!</h3>
</center>
<form method="post" action="<?php echo $PHP_SELF; ?>">
<input type="hidden" name="action">
<div align="center">
<center>
<table width="90%" cellpadding="6" border="1" bordercolor="purple" cellspacing="0" align="center">
<tr>
<th width="30%" nowrap>First Name:</th>
<td width="70%"><input type="text" name="fname" size="8" maxlength="20"></td>
</tr>
<tr>
<th width="30%" nowrap>Middle Initial:</th>
<td width="70%"><input type="text" name="minitial" size="1" maxlength="1"></td>
</tr>
<tr>
<th width="30%" nowrap>Last Name:</th>
<td width="70%"><input type="text" name="lname" size="10" maxlength="30"></td>
</tr>
<tr>
<th width="30%" nowrap>Salon Name:</th>
<td width="70%"><input type="text" name="salonname" size="20" maxlength="30"></td>
</tr>
<tr>
<th width="30%" nowrap>Salon Address: (<i>Example: 456 Main ST.</i>)</th>
<td width="70%"><input type="text" name="minitial" size="20" maxlength="60"></td>
</tr>
<tr>
<th width="30%" nowrap>State:</th>
<td width="70%"><select name="state">
<option value="">
Select State
</option>
<option value="AK">
Alaska(AK)
</option>
<option value="AL">
Alabama(AL)
</option>
<option value="AR">
Arkansas(AR)
</option>
<option value="AZ">
Arizona(AZ)
</option>
<option value="CA">
California(CA)
</option>
<option value="CO">
Colorado(CO)
</option>
<option value="CT">
Connecticut(CT)
</option>
<option value="DC">
District of Columbia(DC)
</option>
<option value="DE">
Delaware(DE)
</option>
<option value="FL">
Florida(FL)
</option>
<option value="GA">
Georgia(GA)
</option>
<option value="HI">
Hawaii(HI)
</option>
<option value="IA">
Iowa(IA)
</option>
<option value="ID">
Idaho(ID)
</option>
<option value="IL">
Illinois(IL)
</option>
<option value="IN">
Indiana(IN)
</option>
<option value="KS">
Kansas(KS)
</option>
<option value="KY">
Kentucky(KY)
</option>
<option value="LA">
Louisiana(LA)
</option>
<option value="MA">
Massachusetts(MA)
</option>
<option value="MD">
Maryland(MD)
</option>
<option value="ME">
Maine(ME)
</option>
<option value="MI">
Michigan(MI)
</option>
<option value="MN">
Minnesota(MN)
</option>
<option value="MO">
Missouri(MO)
</option>
<option value="MS">
Mississippi(MS)
</option>
<option value="MT">
Montana(MT)
</option>
<option value="NC">
North Carolina(NC)
</option>
<option value="ND">
North Dakota(ND)
</option>
<option value="NE">
Nebraska(NE)
</option>
<option value="NH">
New Hampshire(NH)
</option>
<option value="NJ">
New Jersey(NJ)
</option>
<option value="NM">
New Mexico(NM)
</option>
<option value="NV">
Nevada(NV)
</option>
<option value="NY">
New York(NY)
</option>
<option value="OH">
Ohio(OH)
</option>
<option value="OK">
Oklahoma(OK)
</option>
<option value="OR">
Oregon(OR)
</option>
<option value="PA">
Pennsylvania(PA)
</option>
<option value="RI">
Rhode Island(RI)
</option>
<option value="SC">
South Carolina(SC)
</option>
<option value="SD">
South Dakota(SD)
</option>
<option value="TN">
Tennessee(TN)
</option>
<option value="TX">
Texas(TX)
</option>
<option value="UT">
Utah(UT)
</option>
<option value="VA">
Virginia(VA)
</option>
<option value="VT">
Vermont(VT)
</option>
<option value="WA">
Washington(WA)
</option>
<option value="WI">
Wisconsin(WI)
</option>
<option value="WV">
West Virginia(WV)
</option>
<option value="WY">
Wyoming(WY)
</option>
<option value="">
-----
</option>
<option value="AS">
American Samoa(AS)
</option>
<option value="FM">
Federated States of Micronesia(FM)
</option>
<option value="GU">
Guam(GU)
</option>
<option value="MH">
Marshall Islands(MH)
</option>
<option value="MP">
Northern Mariana Islands(MP)
</option>
<option value="PW">
Palau(PW)
</option>
<option value="PR">
Puerto Rico(PR)
</option>
<option value="VI">
Virgin Islands(VI)
</option>
</select></td>
</tr>
<tr>
<th width="30%" nowrap>City:</th>
<td width="70%"><input type="text" name="city" size="20" maxlength="40"></td>
</tr>
<tr>
<th width="30%" nowrap>Zipcode:</th>
<td width="70%"><input type="text" name="zip" size="12" maxlength="15"></td>
</tr>
<tr>
<th width="30%" nowrap>Phone Number:</th>
<td width="70%">( <input type="text" name="areacode" size="3" maxlength="3"> )-<input type="text" name="phonep1" size="3" maxlength="3">-<input type="text" name="phonep2" size="4" maxlength="4"></td>
</tr>
<tr>
<th width="30%" nowrap>Email Address:</th>
<td width="70%"><input type="text" name="email" size="20" maxlength="45"></td>
</tr>
<tr>
<th width="30%" nowrap>Number of Stylists/Colorists:</th>
<td width="70%"><input type="text" name="numstylists" size="4" maxlength="5"></td>
</tr>
<tr>
<th width="30%" nowrap>Average Total Number of Hair Colors Done Each Day in The Salon:</th>
<td width="70%"><input type="text" name="avgcolors" size="4" maxlength="10"></td>
</tr>
<tr>
<th width="30%" nowrap>Hair Colors Currently Being Used in The Salon:</th>
<td width="70%">
<textarea name="haircolors" cols="25" rows="5">
</textarea></td>
</tr>
<tr>
<th width="30%" nowrap>Which Pravana products are you using in the salon?:</th>
<td width="70%">
<textarea name="products" cols="25" rows="5">
</textarea></td>
</tr>
<tr>
<th colspan="2" nowrap align="center"><input type="submit" value="Submit"> <input type="reset" value="Reset"></th>
</tr>
</table>
</center>
</div>
</form><?php
}
function create_account()
{
$fname = $_POST['fname'];
$minitial = $_POST['minitial'];
$lname = $_POST['lname'];
$salonname = $_POST['salonname'];
$address = $_POST['address'];
$state = $_POST['state'];
$city = $_POST['city'];
$zip = $_POST['zip'];
$areacode = $_POST['areacode'];
$phonep1 = $_POST['phonep1'];
$phonep2 = $_POST['phonep2'];
$email = $_POST['email'];
$numstylists = $_POST['numstylists'];
$avgcolors = $_POST['avgcolors'];
$haircolors = $_POST['haircolors'];
global $default_dbname;
if(empty($fname)) {
error_message("Please Enter Your First Name");
}
if(empty($lname)) {
error_message("Please Enter Your Last Name");
}
if(empty($salonname)) {
error_message("Please Enter The Name of Your Salon");
}
if(empty($address)) {
error_message("Please Enter Your Salon's Address");
}
if(empty($state)) {
error_message("Please Select a State");
}
if(empty($city)) {
error_message("Please Enter a City");
}
if(empty($zip)) {
error_message("Please Enter Your Zip Code");
}
if(empty($areacode)) {
error_message("Please include an Area Code with Your Phone Number");
}
if(empty($phonep1)) {
error_message("Please Enter a telephone number");
}
if(empty($phonep2)) {
error_message("Please Enter a telephone number");
}
if(empty($email)) {
error_message("Please Enter an email address");
}
if(empty($numstylists)) {
error_message("Please tell us how many stylists/colorists you have");
}
if(empty($avgcolors)) {
error_message("Please tell us the average total number of hair colors done each day in your salon");
}
if(empty($haircolors)) {
error_message("Please tell us what hair colors are currently being used in your salon");
}
$link_id = db_connect($default_dbname);
$query = "INSERT INTO freedvd VALUES('$fname', '$minitial', '$lname', '$salonname',
'$address', '$state', '$city', '$zip', '$areacode', '$phonep1', '$phonep2',
'$email', '$numstylists', '$avgcolors', '$haircolors')";
$result = mysql_query($query);
if(!$result){
error_message(sql_error());
}
?>
<center>
<h3>Thank You <?php echo $fname ?>. We will be mailing out our DVD to you, free of charge!</h3>
</center><?php
}
if (empty($_POST)){
$_POST['action'] = "";
}
switch($_POST['action']) {
case "register":
create_account();
break;
default:
register_form();
break;
}
?>
</body>
</html>
[/code] -
I'm getting this error:
Parse error: parse error, unexpected $ in /usr3/home/cuttingclub.com/htdocs/pravana/v2/php/dvd_signup.php on line 234
Please help
[code]<?php
include_once "./common_db.inc";
function register_form()
{
global $PHP_SELF;
$link_id = db_connect();
mysql_select_db("sample_db");
mysql_close($link_id);
?>
<style>
body {
font-family: 'Lucida Grande', Arial; font-size: 11px; color: #333;
background: url(img/bg_texture.jpg);
}
th { text-align: right ; font-size: 12px; border-bottom: 1px solid #999; }
input, select, textarea {
background: #EEE;
}
</style>
<center><h3>Sign Up For A Free PRAVANA DVD!</h3></center>
<form method="post" action="<?php echo $PHP_SELF ?>">
<input type="hidden" name="action">
<div align="center">
<center>
<table width="90%" cellpadding="6" border="1" bordercolor="purple" cellspacing="0" align="center">
<tr>
<th width="30%" nowrap>First Name:</th>
<td width="70%"><input type="text" name="fname" size="8" maxlength="20"></td>
</tr>
<tr>
<th width="30%" nowrap>Middle Initial:</th>
<td width="70%"><input type="text" name="minitial" size="1" maxlength="1"></td>
</tr>
<tr>
<th width="30%" nowrap>Last Name:</th>
<td width="70%"><input type="text" name="lname" size="10" maxlength="30"></td>
</tr>
<tr>
<th width="30%" nowrap>Salon Name:</th>
<td width="70%"><input type="text" name="salonname" size="20" maxlength="30"></td>
</tr>
<tr>
<th width="30%" nowrap>Salon Address: (<i>Example: 456 Main ST.</i>)</th>
<td width="70%"><input type="text" name="minitial" size="20" maxlength="60"></td>
</tr>
<tr>
<th width="30%" nowrap>State:</th>
<td width="70%"><select name="state">
<option value="">Select State</option>
<option value="AK">Alaska(AK)</option>
<option value="AL">Alabama(AL)</option>
<option value="AR">Arkansas(AR)</option>
<option value="AZ">Arizona(AZ)</option>
<option value="CA">California(CA)</option>
<option value="CO">Colorado(CO)</option>
<option value="CT">Connecticut(CT)</option>
<option value="DC">District of Columbia(DC)</option>
<option value="DE">Delaware(DE)</option>
<option value="FL">Florida(FL)</option>
<option value="GA">Georgia(GA)</option>
<option value="HI">Hawaii(HI)</option>
<option value="IA">Iowa(IA)</option>
<option value="ID">Idaho(ID)</option>
<option value="IL">Illinois(IL)</option>
<option value="IN">Indiana(IN)</option>
<option value="KS">Kansas(KS)</option>
<option value="KY">Kentucky(KY)</option>
<option value="LA">Louisiana(LA)</option>
<option value="MA">Massachusetts(MA)</option>
<option value="MD">Maryland(MD)</option>
<option value="ME">Maine(ME)</option>
<option value="MI">Michigan(MI)</option>
<option value="MN">Minnesota(MN)</option>
<option value="MO">Missouri(MO)</option>
<option value="MS">Mississippi(MS)</option>
<option value="MT">Montana(MT)</option>
<option value="NC">North Carolina(NC)</option>
<option value="ND">North Dakota(ND)</option>
<option value="NE">Nebraska(NE)</option>
<option value="NH">New Hampshire(NH)</option>
<option value="NJ">New Jersey(NJ)</option>
<option value="NM">New Mexico(NM)</option>
<option value="NV">Nevada(NV)</option>
<option value="NY">New York(NY)</option>
<option value="OH">Ohio(OH)</option>
<option value="OK">Oklahoma(OK)</option>
<option value="OR">Oregon(OR)</option>
<option value="PA">Pennsylvania(PA)</option>
<option value="RI">Rhode Island(RI)</option>
<option value="SC">South Carolina(SC)</option>
<option value="SD">South Dakota(SD)</option>
<option value="TN">Tennessee(TN)</option>
<option value="TX">Texas(TX)</option>
<option value="UT">Utah(UT)</option>
<option value="VA">Virginia(VA)</option>
<option value="VT">Vermont(VT)</option>
<option value="WA">Washington(WA)</option>
<option value="WI">Wisconsin(WI)</option>
<option value="WV">West Virginia(WV)</option>
<option value="WY">Wyoming(WY)</option>
<option value="">-----</option>
<option value="AS">American Samoa(AS)</option>
<option value="FM">Federated States of Micronesia(FM)</option>
<option value="GU">Guam(GU)</option>
<option value="MH">Marshall Islands(MH)</option>
<option value="MP">Northern Mariana Islands(MP)</option>
<option value="PW">Palau(PW)</option>
<option value="PR">Puerto Rico(PR)</option>
<option value="VI">Virgin Islands(VI)</option>
</select>
</td>
</tr>
<tr>
<th width="30%" nowrap>City:</th>
<td width="70%"><input type="text" name="city" size="20" maxlength="40"></td>
</tr>
<tr>
<th width="30%" nowrap>Zipcode:</th>
<td width="70%"><input type="text" name="zip" size="12" maxlength="15"></td>
</tr>
<tr>
<th width="30%" nowrap>Phone Number:</th>
<td width="70%">( <input type="text" name="areacode" size="3" maxlength="3"> )-<input type="text" name="phonep1" size="3" maxlength="3">-<input type="text" name="phonep2" size="4" maxlength="4"></td>
</tr>
<tr>
<th width="30%" nowrap>Email Address:</th>
<td width="70%"><input type="text" name="email" size="20" maxlength="45"></td>
</tr>
<tr>
<th width="30%" nowrap>Number of Stylists/Colorists:</th>
<td width="70%"><input type="text" name="numstylists" size="4" maxlength="5"></td>
</tr>
<tr>
<th width="30%" nowrap>Average Total Number of Hair Colors Done Each Day in The Salon:</th>
<td width="70%"><input type="text" name="avgcolors" size="4" maxlength="10"></td>
</tr>
<tr>
<th width="30%" nowrap>Hair Colors Currently Being Used in The Salon:</th>
<td width="70%"><textarea name="haircolors" cols="25" rows="5"></textarea></td>
</tr>
<tr>
<th width="30%" nowrap>Which Pravana products are you using in the salon?:</th>
<td width="70%"><textarea name="products" cols="25" rows="5"></textarea></td>
</tr>
</table>
</center>
</div>
</form>
<?php
}
function create_account()
{
$fname = $_POST['fname'];
$minitial = $_POST['minitial'];
$lname = $_POST['lname'];
$salonname = $_POST['salonname'];
$address = $_POST['address'];
$state = $_POST['state'];
$city = $_POST['city'];
$zip = $_POST['zip'];
$areacode = $_POST['areacode'];
$phonep1 = $_POST['phonep1'];
$phonep2 = $_POST['phonep2'];
$email = $_POST['email'];
$numstylists = $_POST['numstylists'];
$avgcolors = $_POST['avgcolors'];
$haircolors = $_POST['haircolors'];
global $default_dbname;
if(empty($fname)) {
error_message("Please Enter Your First Name");
if(empty($lname)) {
error_message("Please Enter Your Last Name");
if(empty($salonname)) {
error_message("Please Enter The Name of Your Salon");
if(empty($address)) {
error_message("Please Enter Your Salon's Address");
if(empty($state)) {
error_message("Please Select a State");
if(empty($city)) {
error_message("Please Enter a City");
if(empty($zip)) {
error_message("Please Enter Your Zip Code");
if(empty($areacode)) {
error_message("Please include an Area Code with Your Phone Number");
if(empty($phonep1)) {
error_message("Please Enter a telephone number");
if(empty($phonep2)) {
error_message("Please Enter a telephone number");
if(empty($email)) {
error_message("Please Enter an email address");
if(empty($numstylists)) {
error_message("Please tell us how many stylists/colorists you have");
if(empty($avgcolors)) {
error_message("Please tell us the average total number of hair colors done each day in your salon");
if(empty($haircolors)) {
error_message("Please tell us what hair colors are currently being used in your salon");
$link_id = db_connect($default_dbname);
$query = "INSERT INTO freedvd VALUES('$fname', '$minitial', '$lname', '$salonname',
'$address', '$state', '$city', '$zip', '$areacode', '$phonep1', '$phonep2',
'$email', '$numstylists', '$avgcolors', '$haircolors')";
if(!result){
error_message(sql_error());
}
?>
<center><h3>Thank You <?php echo $fname ?>. We will be mailing out our DVD to you, free of charge!</h3></center>
<?php
if (empty($_POST)){
$_POST['action'] = "";
}
switch($_POST['action']) {
case "dvd_signup":
create_account();
break;
default:
register_form();
break;
}
?>[/code] -
I don't know... I'm just reading a book that I guess was wrong. I got rid of the default value and set up the tables. Shouldnt it be starting at zero anyhow?
-
the command line says:
[b]ERROR 1067 (42000): Invalid default value for 'usernumber'[/b]
and i don't get whats wrong with the default '0'
[b]usernumber MEDIUMINT(10) DEFAULT '0' NOT NULL AUTO_INCREMENT,[/b] -
Hey wildteen... thanks for the sudo command it helped. what i ended up doing was this: [b]sudo chmod a=rwx /usr/local/...php.ini[/b] in order to write to the file. Then i restarted my comp before I noticed any error messaging showing up on the pages.
-
Hi, i'm a definate unix no0b so be easy on me ::).
Here's my problem. I'm in php.ini and it is read only. I can see [b]display_errors = Off[/b]. I need to turn it to on, but it won't let me write to this file.
I also went back and used the following command: [b]chmod g+w /usr/local/...php.ini[/b] and it responded saying [b]operation not permitted[/b]. Why is it not permitted?
Thanks,
-Scott -
Hi, I'm using php on my localhost. When I deliberately try to make an error connecting to my MySQL DB, all I get is a white page, no errors. How can I change the error reporting to be on (using Mac OS X)?
Thanks,
Scott -
Parse error: parse error, unexpected T_ELSE in /usr3/home/cuttingclub.com/htdocs/pravana/v2/php/mail_list/php_mail.php on line 122
[code]
if (strpos($_POST['to'],"@") >= 0) {
//send the mail
echo "<BR>To: $to<P>";
echo "Subject: $_POST[subject]<P>";
echo "Body: $body<P>";
echo "$from_header<P>";
echo "$add_header<P>";
if(!isset($add_header)){
if (mail($to, $_POST['subject'], $body)) {
echo "<h3>Your email has been sent</h3>";
} else {
echo "An error occured, and your email has not been sent";
}
} else if (mail($to, $_POST['subject'], $body, "$from_header"."$add_header")) {
echo "<h3>Your email has been sent</h3>";
} else {
echo "An error occured, and your email has not been sent";
}
} else {
echo "A bad email address was encountered";
}
} else { // Line 122
?>
[/code]
Please Help, Thank You -
Hi, I'm a beginner php user and I am trying to figure out how to access email addresses from a mysql table. I want to get that data and place it into a textarea and be able to send an email to those addresses. I also want to know if there are good ways to avoid those outgoing emails from being received by Spam catchers. Any suggestions on what types of things I should study before writing this program would be appreciated.
Thanks,
Scott -
Hi,
I want to take the usernames in a table and change them all into lowercase. Is there a way to do that aside from doing it by hand?
Thanks,
Scott G. -
Thanks Carth, i get it now.
-
Hey people,
I am trying to figure out what this means:
[code]$sql = sprintf("SELECT COUNT(*) AS test FROM %s WHERE email = '%s' OR login = '%s'", $this->table_name, $this->user_email, $this->user);
[/code]
I have searched through my PHP book (by Eric Rosebrock) and searched the MySQL docs, but I cannot figure out, specifically, what the following are:
[ol type=\'1\'][*]What is [code]AS Test[/code] referring to?[*]What is the purpose of [code]%s[/code]?[/ol]
If someone could explain these two questions I will be greatful.
Thanks- for putting up with a [i]newb[/i],
Scott G.
What is the best way to generate a site map?
in PHP Coding Help
Posted
Hi,
I would like to generate a site map. Do you know of a quick way to do it?
Thanks,
Scott