[PHP-DB] arrays and email
I'm working on an application that will allow someone to view all attendees for a specific webinar that my company is hosting. I want to allow the user to send one group email to all participants scheduled for that particular webinar. After I connect to my database my code looks like this: ? $sql = select * from webusers where webdate=\$webdate\; $result = mysql_query($sql) or die(couldn't generate a list of the users); while ($row = mysql_fetch_row($result)) { $real_name = $row[1]; $email = $row[12]; $list[] = $email; } echo form method=\post\ action=\doemailattendees.php\\n; echo table width=\100%\ border=0 cellspacing=0 cellpadding=0 class=\orange4\\n; echo tr\n; echo td valign=\top\pbTo:/b/p/td\n; echo td valign=\top\p\n; foreach ($list as $value) { print $value, ; $to = $value; } echo /p/td\n; echo /tr\n; echo /table\n; echo table width=\100%\ border=0 cellspacing=0 cellpadding=0\n; echo tr\n; echo td valign=\top\pbSubject:/b/p/td\n; echo td valign=\top\pinput type=\text\ name=\subject\/p/td\n; echo /tr\n; echo tr\n; echo td valign=\top\pbMessage:/b/p/td\n; echo td valign=\top\textarea name=\message\/textarea/td\n; echo /tr\n; echo tr\n; echo td colspan=2 valign=\top\input type=\submit\ value=\submit\/td\n; echo /tr\n; echo /table\n; echo /form\n; ? The $to, $subject, $message variables then get sent to a page that actually mails the message. The problem I'm having is that it's only being sent to the last person in the array. I understand why this is happening but don't know enough about arrays to find a solution. As my code shows I ambitiously tried setting $to to the entire array but that doesn't work. If anyone would be kind enough to help me out I'd greatly appreciate it. Thank you. Kevin www.worktiviti.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] rewriting the $server_name variable with php?
Is there anyway to rewrite the $server_name variable with php? This is kind of an ambitious post for I think I already know the answer. My company has just changed our corporate identity and we want our old url to point to the new one, http://www.worktiviti.com. This isn't a problem, we've changed the DNS entries and everything is fine except for the fact that my boss doesn't want people to see the old url. He wants the url to reflect the new company name, worktiviti. I've talked to our hosting company and they said they would look into editing the httpd.conf file but it doesn't seem likely that they would change the config file for one customer. I know that you can change the url through the mod_rewrite module with Apache but I am not that familiar with apache nor do I have access to the config file. If anyway has any suggestions as to how php could help me out I'd appreciate it. Thanks in advance, Kevin -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] overwriting new information in a table
I'm working on an application that will allow resellers to log into the site and see their potential buyers. When they log in they see their potential buyers and by clicking a link they will get more detailed information about their contacts. They will also have a link to update their clients listings. As of now I have this set up like this... A person logs in and sees their contacts. If they click the update link they are takent to a page that lists their contact information. I've put the respected variables in the value attributes of the input tags. I want to make this process as easy as possible. I dont' want them to have to update every field if they just want to change a contact's phone number. Here's the problem...when they click the button to send the changes they still see their old information. I know that this is because I've set the value to their old variables. Does anyone know a way to get their old input in as the variable value and to still be able to see their new information on the next page. I also want this information to overwrite any existing record based on the potential contact's id. The sql section of the code I have looks like this: $sql = INSERT INTO $table_name (id, contactid, fname, lname, title, cnl, address1, address2, city, state, postcode, country, phone, cell, fax, emailnl, smanager, percomplete, nfud, exrevenue, wl, cwl) VALUES (\\, \$contactid\, \$fname\, \$lname\, \$title\, \$cnl\, \$address1\, \$address2\, \$city\, \$state\, \$postcode\, \$country\, \$phone\, \$cell\, \$fax\, \$emailnl\, \$smanager\, \$percomplete\, \$nfud\, \$exrevenue\, \$wl\, \$cwl\) ; $result = @mysql_query($sql,$connection) or die(Couldn't execute query.); I know this doesn't overwrite each entry. I've also tried something like this: $sql = mysql_query(update my_contacts set fname=$fname, lname=$lname where id=$id); Whenever I would try to run that query I would get an error back saying I couldn't execute that query. If anyone has any ideas I would be more than grateful. Thanks for your time. I'm new to the php/mysql world so if I didn't provide enough relevant code let me know. Thanks. Kevin -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Using variables within a SELECT statement
I'm working on an application that selects a user's userid if their password and login match. If the login and password match I want my variable $cir to run its own select statement and return its corresponding contactid...for this example we'll say that value = 5. I then want to plug in $cir into my select statement that will show the user the list of his/her contacts and only theirs. This seems to be the select statement that's giving my problems. $query = select * from my_contacts where contactid=$cir; Whenever I run my script I get an error saying that I have a problem with my sql syntax. I know that the problem is with the variable becuase it runs fine with a value in it. I've tried writing the $cir as '$cir' and '\$cir' but nothing seems to work. Can anyone help. Thanks in advance Kevin -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] resource id #2, #3, #4......
I've come across yet another problem. I have a table set up that houses four things, a person's real name, username, pass, and id. The id is used to join another table which houses that persons contacts. I've been validating the user and pass by comparing the number of rows that the sql statement returns. Once the user submits their user/pass they're sent to the validation page where the user and pass are compared and if they're valid another sql statement takes place: $ci = select contactid from users where username='$username' and password='$password'; $cir = mysql_query($ci)or die(Couldn't execute); echo(htmlheadMETA HTTP-EQUIV=\refresh\ CONTENT=\0;url=db.php\/head/html); I've registered the variables $username, $password, $cir and if the user is validated they're sent to the contacts page. On the contacts page I'm trying to select which contacts to show based on the contact id. This is what the code looks like on the page where the contacts are going to be displayed... mysql_connect(localhost) or die(couldn't connect); mysql_select_db(act) or die(couldn't connect to the database); $ci = select contactid from users where username='$username' and password='$password'; $cir = mysql_query($ci) or die(Couldn't execute); $query = select * from my_contacts where contactid='$cir'; $result = mysql_query($query) or die( mysql_error() ); When I try to print $cir to see if anything's getting passed I keep getting something that reads resource id #2. If I were rename the variables in the $ci, $cir, and $query lines, run the code, and try to print $cir again I'd get resource id #3 and so on. Does anyone know what this means and how I can work around it. Thanks for your time. Kevin -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Newbie help with cookies/sessions
I'm new to the PHP and Mysql world and I hope I have an problem that can be answered quickly. It seems simple but who knows. Whenever I try to use cookies or start a session I get the following error: Warning: open(/Temp\sess_ba759cb3d78fadb70745ca480f1d8661, O_RDWR) failed: m (2) in Unknown on line 0 Warning: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/Temp) in Unknown on line 0 I tried checking the session.save_path setting the php.ini but I'm not sure if this has to saved to a specific directory or just a valid directory. Any help would be greatly appreciated. Thank you. Kevin -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]