Jump to content

aeafisme23

Members
  • Posts

    121
  • Joined

  • Last visited

    Never

Everything posted by aeafisme23

  1. hehe i forgive your quick post and appreciate your nice way of saying i was'nt off that much but i couldnt hit a baseball if my life depended on it!!! Jk, thanks so much can't wait to find out if this works(sure it does)
  2. My code below is pulling from a database and it's just listing the elements as a loop right now, below my code i will paste my sad attempt at putting it into a <select><option></select> but i dont know how to correctly put the data in there any suggestions? <?php //Setup connection to the database $connect = mysql_pconnect("localhost", "user", "pw") or die(mysql_error()); //Connect to the database mysql_select_db("x_x", $connect) or die(mysql_error()); // Perform an SQL query on the Address table $sql_address = mysql_query("SELECT dma_id, station_id from station_list order by dma_id") or die (mysql_error()); // Define the colours for the alternating rows $colour_odd = "#FFFFFF"; $colour_even = "#FFFFFF"; $row_count = 0; //To keep track of row number // Fetch the array of records and Loop through them while($results = mysql_fetch_array($sql_address)){ // Decide which colours to alternate for the rows If Remainder of $row_count divided by 2 == 0. $row_color = (($row_count % 2) == 0) ? $colour_even : $colour_odd; //Echo the table row and table data that needs to be looped Check All With selected: over until the end of the recordset echo ' <tr bgcolor="' . $row_color . '"> <td width=250 valign=top><p class=\"small\">' .$results['dma_id'] . ' <a href=view_records.php?station=' .$results['station_id'] . '>' .$results['station_id'] . '</a><br></p></td> </tr>'; // Increment the row count $row_count++; } // Free the MySQL resource mysql_free_result($sql_address); ?> My attempt at making it a drop down box. I am pretty sure im off base on most of it but just looking for some insight <?php //Setup connection to the database $connect = mysql_pconnect("localhost", "x", "x") or die(mysql_error()); //Connect to the database mysql_select_db("x", $connect) or die(mysql_error()); // Perform an SQL query on the Address table $sql_address = mysql_query("SELECT dma_id, station_id from station_list order by dma_id") or die (mysql_error()); // Fetch the array of records and Loop through them while($results = mysql_fetch_array($sql_address)){ // Decide which colours to alternate for the rows If Remainder of $row_count divided by 2 == 0. //Echo the table row and table data that needs to be looped Check All With selected: over until the end of the recordset echo ' <tr bgcolor="' . $row_color . '"> <td width=250 valign=top> <p class=\"small\"> <form><select name="dmalist"> <option value=''>- Select -</option> <option value="view_records.php?station=' .$results['station_id'] . '> formSelected( $HTTP_POST_VARS[ "dma_id" ], [ "station_id" ] ); </option> </select></form> </p> </td> </tr>'; // Increment the row count $row_count++; } // Free the MySQL resource mysql_free_result($sql_address); ?>
  3. Sorry you were right, duh of course you were Ya so i's look like j's on a mac and for whatever reason the station_id was station_jd......... yup i feel dumb...er than i am, so ya it works thank you for letting me know my prob!!!!
  4. Sometimes i take people too literal and was wondering what scenario of these you were possibly referring to Are you suggesting that the original code below: $sql_address = mysql_query("SELECT station_id, station_address, station_phone, station_ownership, network_affiliate, station_launch_date from station_info where station_id = '".$station."' order by station_launch_date") be changed to : $sql_address = mysql_query("SELECT `station_id`, `station_address`, `station_phone`, `station_ownership`, `network_affiliate`, `station_launch_date` from `station_info` where `station_id` = `".$station."` order by `station_launch_date`") or changed to (`".$station."`) $sql_address = mysql_query("SELECT station_id, station_address, station_phone, station_ownership, network_affiliate, station_launch_date from station_info where station_id = `".$station."` order by station_launch_date") The answer to your question is , yes the field station_id is in every table (8 all together) and all of them are lower case and all have been spelled correctly as i just did re-check them.
  5. I have never bragged about my basic skills of php but i have an error that says: Unknown column 'station_id' in 'field list' I have done some research on the forums and google and the only conclusion i can come to is that my Select statements need to have ' or not have " (quotes/single quotes). I am unsure of whether or not my Select statements are right in that sense, i did however to get it to pull some of the information but after so many it just stopped pulling results. Secondly, i know this code can be cleaned up ALOT and was just wondering if there is any insight of logic to do this? I haven't began to format so i know the html is sloppy right now but im more concerned on functionality right now. Much help is appreciated See complete code below: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <title>Untitled Document</title> </head> <body><?php //DO NOT remove these two lines, if you do, the retrieve file will NOT work! $station = $_GET['station']; ?> <table width="950" cellpadding="0" cellspacing="0" border="0"> <tr> <td width="150" valign="top"> <table width="150" cellpadding="0" cellspacing="0" border="0"> <tr> <td width="100"><B>Stations</B><br> <a href="view_records.php?station=KBCI">KBCI</a><br> <a href="view_records.php?station=KCBS">KCBS</a><br> <a href="view_records.php?station=KCNC">KCNC</a><br> <a href="view_records.php?station=KCTV">KCTV</a><br> <a href="view_records.php?station=KDKA">KDKA</a><br> </td> </tr> </table> </td> <td width="800" valign="top"><h1>Station Management System</h1><h2><?php echo $station; ?></h2><br /> <table width="800" cellpadding="0" cellspacing="0" border="0"> <?php // CONTRACT STATUS //Setup connection to the database $connect = mysql_pconnect("localhost", "user", "pass") or die(mysql_error()); //Connect to the database mysql_select_db("dbname", $connect) or die(mysql_error()); // Perform an SQL query on the Address table $sql_address = mysql_query("SELECT station_id, status, notes from contract_status where station_id = '".$station."'") or die (mysql_error()); // Define the colours for the alternating rows $colour_odd = "#FDFDEA"; $colour_even = "#E0E0C7"; $row_count = 0; //To keep track of row number // Fetch the array of records and Loop through them while($results = mysql_fetch_array($sql_address)){ // Decide which colours to alternate for the rows If Remainder of $row_count divided by 2 == 0. $row_color = (($row_count % 2) == 0) ? $colour_even : $colour_odd; //Echo the table row and table data that needs to be looped Check All With selected: over until the end of the recordset echo ' <tr bgcolor="' . $row_color . '"> <td width=100 valign=top><p>Contract Status<br>Station: ' .$results['station_id'] . '</p></td> <td width=300 valign=top><p><br>Contract Status: ' .$results['status'] . '</p></td> <td width=400 valign=top><p><br>Contract Notes: ' .$results['notes'] . '</p></td> </tr>'; // Increment the row count $row_count++; } // Free the MySQL resource mysql_free_result($sql_address); // Close the database connection mysql_close($connect); ?> </table> <br /> <table width="800" cellpadding="0" cellspacing="0" border="0"> <?php // Station Information //Setup connection to the database $connect = mysql_pconnect("localhost", "user", "pass") or die(mysql_error()); //Connect to the database mysql_select_db("dbname", $connect) or die(mysql_error()); // Perform an SQL query on the Address table $sql_address = mysql_query("SELECT station_id, station_address, station_phone, station_ownership, network_affiliate, station_launch_date from station_info where station_id = '".$station."' order by station_launch_date") or die (mysql_error()); // Define the colours for the alternating rows $colour_odd = "#FDFDEA"; $colour_even = "#E0E0C7"; $row_count = 0; //To keep track of row number // Fetch the array of records and Loop through them while($results = mysql_fetch_array($sql_address)){ // Decide which colours to alternate for the rows If Remainder of $row_count divided by 2 == 0. $row_color = (($row_count % 2) == 0) ? $colour_even : $colour_odd; //Echo the table row and table data that needs to be looped Check All With selected: over until the end of the recordset echo ' <tr bgcolor="' . $row_color . '"> <td width=100 valign=top><p>Station Information<br>Station: ' .$results['station_id'] . '</p></td> <td width=200 valign=top><p><br>Station Address: ' .$results['station_address'] . '</p></td> <td width=150 valign=top><p><br>Station Phone #: ' .$results['station_phone'] . '</p></td> <td width=100 valign=top><p><br>Ownership: ' .$results['station_ownership'] . '</p></td> <td width=100 valign=top><p><br>Network Affiliate: ' .$results['network_affiliate'] . '</p></td> <td width=150 valign=top><p><br>Launch Date: ' .$results['station_launch_date'] . '</p></td> </tr>'; // Increment the row count $row_count++; } // Free the MySQL resource mysql_free_result($sql_address); // Close the database connection mysql_close($connect); ?> <br /> </table> <table width="800" cellpadding="0" cellspacing="0" border="0"> <?php // Contact Log //Setup connection to the database $connect = mysql_pconnect("localhost", "user", "pass") or die(mysql_error()); //Connect to the database mysql_select_db("dbname", $connect) or die(mysql_error()); // Perform an SQL query on the Address table $sql_address = mysql_query("SELECT station_id, contact_date, contact_person, contact_kv, contact_notes from contact_log where station_id = '".$station."' order by contact_date") or die (mysql_error()); // Define the colours for the alternating rows $colour_odd = "#FDFDEA"; $colour_even = "#E0E0C7"; $row_count = 0; //To keep track of row number // Fetch the array of records and Loop through them while($results = mysql_fetch_array($sql_address)){ // Decide which colours to alternate for the rows If Remainder of $row_count divided by 2 == 0. $row_color = (($row_count % 2) == 0) ? $colour_even : $colour_odd; //Echo the table row and table data that needs to be looped Check All With selected: over until the end of the recordset echo ' <tr bgcolor="' . $row_color . '"> <td width=100 valign=top><p>Contact Log<br>Station: ' .$results['station_id'] . '</p></td> <td width=100 valign=top><p><br>Contact Date: ' .$results['contact_date'] . '</p></td> <td width=150 valign=top><p><br>Person Contacted: ' .$results['contact_person'] . '</p></td> <td width=150 valign=top><p><br>KinderVision Contact: ' .$results['contact_kv'] . '</p></td> <td width=300 valign=top><p><br>Contact Notes: ' .$results['contact_notes'] . '</p></td> </tr>'; // Increment the row count $row_count++; } // Free the MySQL resource mysql_free_result($sql_address); // Close the database connection mysql_close($connect); ?> <br /> </table> <table width="800" cellpadding="0" cellspacing="0" border="0"> <?php // Station Personnel //Setup connection to the database $connect = mysql_pconnect("localhost", "user", "pass") or die(mysql_error()); //Connect to the database mysql_select_db("dbname", $connect) or die(mysql_error()); // Perform an SQL query on the Address table $sql_address = mysql_query("SELECT station_id, general_manager, news_director, director_sales, community_affairs, kv_contact, email, phone, email2, phone2 from station_personnel where station_id = '".$station."' order by kv_contact") or die (mysql_error()); // Define the colours for the alternating rows $colour_odd = "#FDFDEA"; $colour_even = "#E0E0C7"; $row_count = 0; //To keep track of row number // Fetch the array of records and Loop through them while($results = mysql_fetch_array($sql_address)){ // Decide which colours to alternate for the rows If Remainder of $row_count divided by 2 == 0. $row_color = (($row_count % 2) == 0) ? $colour_even : $colour_odd; //Echo the table row and table data that needs to be looped Check All With selected: over until the end of the recordset echo ' <tr bgcolor="' . $row_color . '"> <td width=100 valign=top><p>Station Personnel<br>Station: ' .$results['station_id'] . '</p></td> <td width=100 valign=top><p><br>General Manager: ' .$results['general_manager'] . '</p></td> <td width=100 valign=top><p><br>News Director: ' .$results['news_director'] . '</p></td> <td width=75 valign=top><p><br>Director of Sales: ' .$results['director_sales'] . '</p></td> <td width=75 valign=top><p><br>Community Affairs: ' .$results['community_affairs'] . '</p></td> <td width=50 valign=top><p><br>KinderVision Contact: ' .$results['kv_contact'] . '</p></td> <td width=150 valign=top><p><br>Email: ' .$results['email'] . ' Phone: ' .$results['phone'] . '</p></td> <td width=150 valign=top><p><br>Email2: ' .$results['email2'] . ' Phone2: ' .$results['phone2'] . '</p></td> </tr>'; // Increment the row count $row_count++; } // Free the MySQL resource mysql_free_result($sql_address); // Close the database connection mysql_close($connect); ?> </html>
  6. Awesome thanks, one quick question though, what do i do about this section: foreach($keywords as $k => $v) $keywords[$k] = (int)$v; $codes = implode(",", $keywords); Is it something i should just eliminate or keep in? I was thinking that somehow i had to define the (int) to text so when it does show my results and what i looked for it will not check for an integer and return an integer value but it will return a text value. Does this make sense ?
  7. This is a snippet of code from the search page (http://www.thegreatestsave.org/sms/view_records_contact_log.php) i created. In the search box you can enter any value you wish because it pulls all the results regardless just put in A if you want and it will say it's looking for 0 since the code is looking for an integer, if you put in an integer such as 3 it will say it's looking for 3 so i know the mechanics are working but not to the specifics i need. Please do not delete the records as it is working I have rigged it to pull results by erasing part of this: $searchcode_query = "SELECT * FROM contact_log WHERE station_id = '".$codes."'"; to $searchcode_query = "SELECT * FROM contact_log "; I understand my problem lies within the station_id = '".$codes . This script is being modified from another project i did using AREACODES such as 220 , 574 , etc. So the next line of code that i believe is the problem is the defining of $codes as it is converting or looking for an integer value (a number like 220), so when i put in text like (WUSA) it will say it searched for 0 'zero' because it's looking for an integer. foreach($keywords as $k => $v) $keywords[$k] = (int)$v; $codes = implode(",", $keywords); I am trying to figure out how i can modify this code to look for text and not an integer and still keep my code structure if at all possible. Any help would greatly be appreciated. Below is just more code in case you need it. if there is more code you need let me know Thanks again. // connect to the mysql database server. $connect = mysql_connect($dbhost, $dbusername, $dbuserpass) or die("Unable to connect to SQL server..<br />".mysql_error()); $selectDB = mysql_select_db($dbname) or die("Unable to select database.<br />".mysql_error()); //trim whitespace from variable $searchcode = preg_replace('/\s+/', ' ', trim($_GET['search'])); //seperate multiple keywords into array space delimited $keywords = array_diff(explode(" ", $searchcode), array("")); if( !empty($searchcode) ) { foreach($keywords as $k => $v) $keywords[$k] = (int)$v; $codes = implode(",", $keywords); $searchcode_query = "SELECT * FROM contact_log"; //Store the results in a variable or die if query fails $result = mysql_query($searchcode_query) or die("Error executing MySQL query<br />".mysql_error()); $count = mysql_num_rows($result); }
  8. I decided it might be more beneficial than waiting for someone to ask for more code so here is the complete page of code for viewing the record. <?php //Get variables from config.php to connect to mysql server require 'config.php'; // connect to the mysql database server. $connect = mysql_connect($dbhost, $dbusername, $dbuserpass) or die("Unable to connect to SQL server..<br />".mysql_error()); $selectDB = mysql_select_db($dbname) or die("Unable to select database.<br />".mysql_error()); //trim whitespace from variable $searchcode = preg_replace('/\s+/', ' ', trim($_GET['search'])); //seperate multiple keywords into array space delimited $keywords = array_diff(explode(" ", $searchcode), array("")); if( !empty($searchcode) ) { foreach($keywords as $k => $v) $keywords[$k] = (int)$v; $codes = implode(",", $keywords); $searchcode_query = "SELECT * FROM contact_log"; //Store the results in a variable or die if query fails $result = mysql_query($searchcode_query) or die("Error executing MySQL query<br />".mysql_error()); $count = mysql_num_rows($result); } /** html code **/ echo "<center><h1>Admin View / Delete Contact Log</h1><br><center><b>Other Admin Options Include: <a href=\"add_record_contact_log.php\">add a record</a> | <a href=\"view_records_contact_log.php\">view a record</a></b><br> <br>Please put in an Stations Call Letters in all caps (KCNC, KFMB, WUSA, etc) to filter your search and the proceed to delete or to come back to other admin options.</center><br></center>"; //If users doesn't enter anything into search box tell them to. if( empty($searchcode) ){ echo "<html><head>"; echo "<title>Admin View / Delete Records</title>"; echo "</head>"; echo "<body onLoad=\"self.focus();document.searchform.search.focus()\">"; echo "<center>"; echo "<br /><form name=\"searchform\" method=\"GET\" action=\"view_records_contact_log.php\">"; echo "<input type=\"text\" name=\"search\" size=\"20\" TABINDEX=\"1\" />"; echo " <input type=\"submit\" value=\"Search\" />"; echo "</form>"; } else { if( $count == 0 ){ echo "<center>Your query returned no results from the database, redirect.</center>"; } else { echo "<center><b>Admin - View Records for Contact Log: ".$codes."</b></center><br>"; $row_count = 0; // Define the colours for the alternating rows $colour_odd = "#FDFDEA"; $colour_even = "#E0E0C7"; // If Remainder of $row_count divided by 2 == 0. $row_color = (($row_count % 2) == 0) ? $colour_even : $colour_odd; while( $row = mysql_fetch_array($result) ) { //table background color = row_color variable echo "<center><table width=\"800\" cellpadding=\"0\" cellspacing=\"2\">"; echo "<tr>"; echo "<td width=\"50\" valign=\"top\">".$row['station_id']."</td>"; echo "<td width=\"100\" valign=\"top\">".$row['contact_date']."</td>"; echo "<td width=\"150\" valign=\"top\">".$row['contact_person']."</td>"; echo "<td width=\"150\" valign=\"top\">".$row['contact_kv']."</td>"; echo "<td width=\"300\" valign=\"top\">".$row['contact_notes']."</td>"; echo "<td width=\"50\" valign=\"top\"><a href=\"delete_record_contact_log.php?id=".$row['id']."\">Delete</a></td>"; echo "</tr></table></center>"; $row_count++; } } } if( isset($result) ) { mysql_free_result($result); mysql_close($connect); } ?>
  9. Aaron, This is how i loop the database results. I plugged in some of your database fields to give you a better understanding. You can also change the color of the alternating rows or just change them both to white (#FFFFFF). Also when the results are being echo'd out you can change the structure of the table for example: <td><p class=info>' .$results['firstname'] . '<br> ' .$results['address'] . ' ' . $results['address2'] . '</p></td> Hope this helps if not hope you find what you are looking for. </p></td> <?php //Setup connection to the database $connect = mysql_pconnect("localhost", "yourusername", "yourpassword") or die(mysql_error()); //Connect to the database mysql_select_db("yourdatabasename", $connect) or die(mysql_error()); // Perform an SQL query on the Address table $sql_address = mysql_query("SELECT firstname, midname, lastname, address, address2, town, county, postcode, telephone, mobile, contactname1, contactnumber1") or die (mysql_error()); // Define the colours for the alternating rows $colour_odd = "#FDFDEA"; $colour_even = "#E0E0C7"; $row_count = 0; //To keep track of row number // Fetch the array of records and Loop through them while($results = mysql_fetch_array($sql_address)) { // Decide which colours to alternate for the rows // If Remainder of $row_count divided by 2 == 0. $row_color = (($row_count % 2) == 0) ? $colour_even : $colour_odd; /* Echo the table row and table data that needs to be looped Check All / Uncheck All */ //With selected: over until the end of the recordset echo ' <tr bgcolor="' . $row_color . '"> <td><p class=info>' .$results['firstname'] . '</p></td> <td><p class=info>' .$results['midname'] . '</p></td> <td><p class=info>' .$results['lastname'] . '</p></td> <td><p class=info>' .$results['address'] . '</p></td> <td><p class=info>' .$results['address2'] . ' ' . $results['town'] . '</p></td> <td><p class=info>' .$results['county'] . '</p></td> </tr>'; // Increment the row count $row_count++; } // Free the MySQL resource mysql_free_result($sql_address); // Close the database connection mysql_close($connect); ?>
  10. This is a snippet of code from the search page i created. I have rigged it to pull results by erasing part of this $searchcode_query = "SELECT * FROM contact_log WHERE station_id = '".$codes."'"; to $searchcode_query = "SELECT * FROM contact_log "; I understand my problem lies within the station_id = '".$codes . This script is being modified from another project i did using AREACODES such as 220 , 574 , etc. So the next line of code that i believe is the problem is the defining of $codes as it is converting or looking for an integer value (a number like 220), so when i put in text like (WUSA) it will say it searched for 0 'zero' because it's looking for an integer. foreach($keywords as $k => $v) $keywords[$k] = (int)$v; $codes = implode(",", $keywords); I am trying to figure out how i can modify this code to look for text and not an integer and still keep my code structure if at all possible. Any help would greatly be appreciated. Below is just more code in case you need it. if there is more code you need let me know Thanks again. // connect to the mysql database server. $connect = mysql_connect($dbhost, $dbusername, $dbuserpass) or die("Unable to connect to SQL server..<br />".mysql_error()); $selectDB = mysql_select_db($dbname) or die("Unable to select database.<br />".mysql_error()); //trim whitespace from variable $searchcode = preg_replace('/\s+/', ' ', trim($_GET['search'])); //seperate multiple keywords into array space delimited $keywords = array_diff(explode(" ", $searchcode), array("")); if( !empty($searchcode) ) { foreach($keywords as $k => $v) $keywords[$k] = (int)$v; $codes = implode(",", $keywords); $searchcode_query = "SELECT * FROM contact_log"; //Store the results in a variable or die if query fails $result = mysql_query($searchcode_query) or die("Error executing MySQL query<br />".mysql_error()); $count = mysql_num_rows($result); }
  11. Thanks rev, it's done!!! woo hoo only 80 posts later a new record hehe. Thanks again everyone
  12. any reason why the subject isnt going through, those 2 things you mentioned made those problems go away!
  13. Ok so i ended up following alot of php.net manual and alot of your advice and i would like to repost code, i am getting a few bugs such as the to address is not sending but the bcc is, the subject is not sending either, and i cant post the message even when i declare the names as variables in the form (just posted 1 as an example) (in the email it just says it like the code looks and shows the dollar sign $ followed by fromName .... $fromAddress etc..). Any help would be greatly appreciated! CODE: <?php // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $to = 'rdsfafdf3@gmail.com'; $Subject = 'Test: Remind me what again?'; $headers .= 'To: Randy A <radsdfafnd3@gmail.com>, Randy B <rbasdfafxdon.org>' . "\r\n"; $headers .= 'From: The Reminder <reminder@example.com>' . "\r\n"; //$headers .= 'Cc: ranxxybxxnett23@gmfdsfil.com' . "\r\n"; $headers .= 'Bcc: rdfddsndtt@kinfdson.org' . "\r\n"; $message = 'You received a message from $fromName their information is $fromPhone, $fromEmail, $fromAddress, and $nMessage'; ?> <form method="post" action="<?php echo($PHP_SELF) ?>"> <center><table width=\"700\" cellpadding=\"0\" cellspacing=\"0\"> <tbody> <tr> <td><p class="bodyfont">Name*:</p></td> <td><input type="text" name="<?php echo $fromName; ?>" size="20" /></td> <td><p class="bodyfont">Phone:</p></td> <td><input type="text" name="fromPhone" size="25" /></td> </tr> <tr> <td><p class="bodyfont">Email*:</p></td> <td><input type="text" name="fromEmail" size="20" /></td> <td><p class="bodyfont">Address:</p></td> <td><input type="text" name="fromAddress" size="30" /></td> </tr> <tr> <td colspan="4"><br><p class="bodyfont">Message*:</p></td> </tr> <tr> <td colspan="4"><p class="bodyfont"><textarea rows="8" name="Message" cols="60" class="input"></textarea></p></td> </tr> <tr> <td colspan="4" class="right1"><center><input type="submit" name="submit" value="Submit"><input type="reset" value="Reset" /></center><br> <p class="bodyfont">*Required Fields Include (Name, Email, and Message)</p></td> </tr> </tbody> </table></center> </form> <?php if(isset($_POST['submit'])) { if(mail($to, $subject, $message, $headers)) echo 'Message Sent Successfully'; else echo 'Message Failed to send, please try again later'; } ?>
  14. very helpful again, i take it that i will be declaring variable for header? because you put that will contain the cc, reply-to?
  15. thanks the little guy, i believe your right ill upload and find out!
  16. What exactly should i be looking for on php.net, i have been there a few times but usually always find sites that are a bit more descriptive helpful.
  17. I tried searching the forums and did not find too much that i felt would help me. Here is the code that I got from a website that "works" just like it should but when i add into the form a couple more fields it does not do anything. Also i want to add a BCC if possible if not then i need a CC at the least. Thanks so much for taking a look! works: <?php $Subject = "test email"; $toEmail = "ranxxxxetett23@gmail.com"; if($submit) { mail($fromEmail, $Subject, $nMessage."\nFrom: ".$fromName."<".$fromEmail.">"); } ?> <html> <head> <title>Mail Tutorial</title> </head> <body bgcolor="#FFFFFF"> <form method="post" action="<?php echo($PHP_SELF) ?>"> Your E-mail: <input type="text" name="fromEmail" size="25"> <br> Your Name: <input type="text" name="fromName" size="25"> <br> Your Message: <br> <textarea cols="50" rows="5" name="nMessage">Your Message Here...</textarea> <br> <input type="submit" value="Submit"> <?php if(submit) { $resultMail = mail($toEmail, $Subject, $nMessage); if($resultMail) { print "Your e-mail has been sent."; } else { print "Your e-mail has not been sent."; } } ?> does not work: <?php $Subject = "test email"; $toEmail = "rxxxxxttt23@gmail.com"; if($submit) { mail($fromEmail, $Subject, $fromPhone, $fromAddress, $nMessage."\nFrom: ".$fromName."<".$fromEmail.">"); } ?> <form method="post" action="<?php echo($PHP_SELF) ?>"> <center><table width=\"700\" cellpadding=\"0\" cellspacing=\"0\"> <tbody> <tr> <td><p class="bodyfont">Name*:</p></td> <td><input type="text" name="fromName" size="20" /></td> <td><p class="bodyfont">Phone:</p></td> <td><input type="text" name="fromPhone" size="25" /></td> </tr> <tr> <td><p class="bodyfont">Email*:</p></td> <td><input type="text" name="fromEmail" size="20" /></td> <td><p class="bodyfont">Address:</p></td> <td><input type="text" name="fromAddress" size="30" /></td> </tr> <tr> <td colspan="4"><br><p class="bodyfont">Message*:</p></td> </tr> <tr> <td colspan="4"><p class="bodyfont"><textarea rows="8" name="nMessage" cols="60" class="input"></textarea></p></td> </tr> <tr> <td colspan="4" class="right1"><center><input type="submit" value="Submit" /><input type="reset" value="Reset" /></center><br> <p class="bodyfont">*Required Fields Include (Name, Email, and Message)</p></td> </tr> </tbody> </table></center> </form>
  18. I have found a script ive been trying to modify to get results to show pagination. The database has been created and filled. Im having a little troubles getting this to work any ideas? I then now have issues with 2 lines found at 65/66 and 88: $this->all_rows = mysql_num_rows($tmp_result); mysql_free_result($tmp_result); and $this->num_rows = mysql_num_rows($this->result); My browser however displays warning things like: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in etc.... The script is the following 2 pages called (example.php which shows the results and my_pagina_class.php that makes it tick) my_pagina_class.php : <?php /************************************************************************ MyPagina ver. 1.01 Use this class to handle MySQL record sets and get page navigation links Copyright (C) 2005 - Olaf Lederer This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA _________________________________________________________________________ available at http://www.finalwebsites.com/ Comments & suggestions: http://www.finalwebsites.com/contact.php Updates & bugfixes ver. 1.01 - There was a small bug inside the page_info() method while showing the last page (set). The error (last record) is fixed. There is also a small update in the method set_page(), the check is now with $_REQUEST values in place of $_GET values. *************************************************************************/ require($_SERVER['DOCUMENT_ROOT']."/form/db_config.php"); error_reporting(E_ALL); // only for testing class MyPagina { var $sql; var $result; var $get_var = QS_VAR; var $rows_on_page = NUM_ROWS; var $str_forward = STR_FWD; var $str_backward = STR_BWD; var $all_rows; var $num_rows; var $page; var $number_pages; // constructor function MyPagina() { $this->connect_db(); } // sets the current page number function set_page() { $this->page = (isset($_REQUEST[$this->get_var]) && $_REQUEST[$this->get_var] != "") ? $_REQUEST[$this->get_var] : 0; return $this->page; } // gets the total number of records function get_total_rows() { $tmp_result = mysql_query($this->sql); $this->all_rows = mysql_num_rows($tmp_result); mysql_free_result($tmp_result); return $this->all_rows; } // database connection function connect_db() { $conn_str = mysql_connect(DB_SERVER, DB_USER, DB_PASSWORD); mysql_select_db(DB_NAME, $conn_str); } // get the totale number of result pages function get_num_pages() { $this->number_pages = ceil($this->get_total_rows() / $this->rows_on_page); return $this->number_pages; } // returns the records for the current page function get_page_result() { $start = $this->set_page() * $this->rows_on_page; $page_sql = sprintf("%s LIMIT %s, %s", $this->sql, $start, $this->rows_on_page); $this->result = mysql_query($page_sql); return $this->result; } // get the number of rows on the current page function get_page_num_rows() { $this->num_rows = mysql_num_rows($this->result); return $this->num_rows; } // free the database result function free_page_result() { mysql_free_result($this->result); } // function to handle other querystring than the page variable function rebuild_qs($curr_var) { if (!empty($_SERVER['QUERY_STRING'])) { $parts = explode("&", $_SERVER['QUERY_STRING']); $newParts = array(); foreach ($parts as $val) { if (stristr($val, $curr_var) == false) { array_push($newParts, $val); } } if (count($newParts) != 0) { $qs = "&".implode("&", $newParts); } else { return false; } return $qs; // this is your new created query string } else { return false; } } // this method will return the navigation links for the conplete recordset function navigation($separator = " | ", $css_current = "", $back_forward = false) { $max_links = NUM_LINKS; $curr_pages = $this->set_page(); $all_pages = $this->get_num_pages() - 1; $var = $this->get_var; $navi_string = ""; if (!$back_forward) { $max_links = ($max_links < 2) ? 2 : $max_links; } if ($curr_pages <= $all_pages && $curr_pages >= 0) { if ($curr_pages > ceil($max_links/2)) { $start = ($curr_pages - ceil($max_links/2) > 0) ? $curr_pages - ceil($max_links/2) : 1; $end = $curr_pages + ceil($max_links/2); if ($end >= $all_pages) { $end = $all_pages + 1; $start = ($all_pages - ($max_links - 1) > 0) ? $all_pages - ($max_links - 1) : 1; } } else { $start = 0; $end = ($all_pages >= $max_links) ? $max_links : $all_pages + 1; } if($all_pages >= 1) { $forward = $curr_pages + 1; $backward = $curr_pages - 1; $navi_string = ($curr_pages > 0) ? "<a href=\"".$_SERVER['PHP_SELF']."?".$var."=".$backward.$this->rebuild_qs($var)."\">".$this->str_backward."</a> " : $this->str_backward." "; if (!$back_forward) { for($a = $start + 1; $a <= $end; $a++){ $theNext = $a - 1; // because a array start with 0 if ($theNext != $curr_pages) { $navi_string .= "<a href=\"".$_SERVER['PHP_SELF']."?".$var."=".$theNext.$this->rebuild_qs($var)."\">"; $navi_string .= $a."</a>"; $navi_string .= ($theNext < ($end - 1)) ? $separator : ""; } else { $navi_string .= ($css_current != "") ? "<span class=\"".$css_current."\">".$a."</span>" : $a; $navi_string .= ($theNext < ($end - 1)) ? $separator : ""; } } } $navi_string .= ($curr_pages < $all_pages) ? " <a href=\"".$_SERVER['PHP_SELF']."?".$var."=".$forward.$this->rebuild_qs($var)."\">".$this->str_forward."</a>" : " ".$this->str_forward; } } return $navi_string; } // this info will tell the visitor which number of records are shown on the current page function page_info($to = "-") { $first_rec_no = ($this->set_page() * $this->rows_on_page) + 1; $last_rec_no = $first_rec_no + $this->rows_on_page - 1; $last_rec_no = ($last_rec_no > $this->get_total_rows()) ? $this->get_total_rows() : $last_rec_no; $to = trim($to); $info = $first_rec_no." ".$to." ".$last_rec_no; return $info; } // simple method to show only the page back and forward link. function back_forward_link() { $simple_links = $this->navigation(" ", "", true); return $simple_links; } } ?> example.php <?php include($_SERVER['DOCUMENT_ROOT']."/form/my_pagina_class.php"); $test = new MyPagina; $test->sql = "SELECT * FROM example"; // the (basic) sql statement (use the SQL whatever you like) $result = $test->get_page_result(); // result set $num_rows = $test->get_page_num_rows(); // number of records in result set $nav_links = $test->navigation(" | ", "currentStyle"); // the navigation links (define a CSS class selector for the current link) $nav_info = $test->page_info("to"); // information about the number of records on page ("to" is the text between the number) $simple_nav_links = $test->back_forward_link(); // the navigation with only the back and forward links $total_recs = $test->get_total_rows(); // the total number of records ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>MyPagina example page</title> <style type="text/css"> <!-- body { font-family:"Courier New", Courier, mono; } .currentStyle { font-size:1.5em; font-weight:bold; } --> </style> </head> <body> <h2>Example page for MyPagina class</h2> <p>This information shows the current range of records and the total number of records.</p> <p><b><?php echo "rec. ".$nav_info." of ".$total_recs; ?></b></p> <p> </p> <p>Here the records (id and title):</p> <?php for ($i = 0; $i < $num_rows; $i++) { $title = mysql_result($result, $i, "title"); $id = mysql_result($result, $i, "id"); echo ($id < 9) ? " ".$id : $id; echo " -> ".$title."<br>\n"; } echo "<hr>\n"; echo "<p>The navigation() method is showing this kind of links:</p>"; echo "<p>".$nav_links."</p>"; echo "<p>Notice the large number of the current link, you can modify the style with CSS.</p>"; echo "<hr>\n"; echo "<p>The back_forward_link() method, shows only for- and backward links (you can use it for small recordsets):</p>"; echo "<p>".$simple_nav_links."</p>"; ?> </body> </html> <?php $test->free_page_result(); // if your result set is large then free the result here ?>
  19. Got it working!!! it does not accept the textarea, had to use an input, oh well it works!!! Thanks so much everyone especially you REVRAZ
  20. zomg, it worked!!! just had to tweak it a bit more, unfortunately i only have ONE more small problem, why isnt dealerinfo showing lol i swear its it!!!! SWEAR
  21. I put in commas, but is the ` effecting it or ". my...etc", how should the statement look like? $query = "UPDATE `dealer` SET `dealer` = " . mysql_real_escape_string ( $_POST [ 'dealer' ] ) . " , `address` = " . mysql_real_escape_string ( $_POST [ 'address' ] ) . " , `address2` = " . mysql_real_escape_string ( $_POST [ 'address2' ] ) . " , `city` = " . mysql_real_escape_string ( $_POST [ 'city' ] ) . " , `state` = " . mysql_real_escape_string ( $_POST [ 'state' ] ) . " , `zip` = " . mysql_real_escape_string ( $_POST [ 'zip' ] ) . " , `areacode` = " . mysql_real_escape_string ( $_POST [ 'areacode' ] ) . " , `number` = " . mysql_real_escape_string ( $_POST [ 'number' ] ) . " , `tollnumber` = " . mysql_real_escape_string ( $_POST [ 'tollnumber' ] ) . " , `ulweb` = " . mysql_real_escape_string ( $_POST [ 'ulweb' ] ) . " , `email` = " . mysql_real_escape_string ( $_POST [ 'email' ] ) . " , `dealerinfo` = " . mysql_real_escape_string ( $_POST [ 'dealerinfo' ] ) . " WHERE `ID` = " . mysql_real_escape_string ( $_REQUEST["id"] );
  22. I am using Dreamweaver 8, just CTRL+A > CTRL+C to copy the text and then copy paste. Replaced and this is what i got... Error in query: UPDATE `dealer` SET `dealer` = Fort Wayne Company `address` = 12345 Rd Ridge `address2` = `city` = Fort Wayne `state` = Indiana `zip` = 46060 `areacode` = 574 `number` = 732 `tollnumber` = 1 `ulweb` = www.ftwayne.com `email` = rog@ftwayne.com `dealerinfo` = WHERE `ID` = 5. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Wayne Company `address` = 12345 R
  23. Hmm i think the database structure is fine, i cant seem to figure out why the dealer info isnt getting pulled, i am not sure if it is logic such as ( [ { ; or if it is bad SQL Update or if my variables are somewhat wrong. Is there a way to debug this or does anyone have any ideas why this is not updating even though it says it is.... * above you can get user/ pass and url to get to what im talking about if your new to this thread. Thanks
  24. an example could be this : Dealer Information Manufacturer and Distributor of DMI Brand Towing Hitches for Pickup Trucks, Full Size SUV s and Commercial Vans. We ship Quic'n Easy and Cush'n Combo Towing Packages to Dealers throughout North Ameri
×
×
  • 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.