jakebur01
Members-
Posts
885 -
Joined
-
Last visited
Everything posted by jakebur01
-
[SOLVED] data is not writing to the e-mail field
jakebur01 replied to jakebur01's topic in PHP Coding Help
I noticed I do not have a comma after phone. $query .= "phone = " . $phone[$i] . " "; should be $query .= "phone = " . $phone[$i] . ", "; -
[SOLVED] data is not writing to the e-mail field
jakebur01 replied to jakebur01's topic in PHP Coding Help
query: update refs set name = 'ITD Testing', position = 'ITD Testing', street = 'ITD Testing', city = 'ITD Testing', state = 'AK', zip = 39042, phone = 5555555555 email = [email protected] where id=967 and num=1 query: update refs set name = 'ITD Testing', position = 'ITD Testing', street = 'ITD Testing', city = 'ITD Testing', state = 'MT', zip = 55555, phone = 5555555555 email = where id=967 and num=2 query: update refs set name = 'ITD Testing', position = 'ITD Testing', street = 'ITD Testing', city = 'ITD Testing', state = 'ND', zip = 55555, phone = 5555555555 email = where id=967 and num=3 query: update refs set name = 'ITD TestingITD Testing', position = 'ITD Testing', street = 'ITD Testing', city = 'ITD Testing', state = 'NC', zip = 55555, phone = 5555555555 email = where id=967 and num=4 query: update refs set name = 'ITD Testing', position = 'ITD Testing', street = 'ITD Testing', city = 'ITD Testing', state = 'MT', zip = 55555, phone = 5555555555 email = where id=967 and num=5 query: update refs set name = 'ITD Testing', position = 'ITD Testing', street = 'ITD Testing', city = 'ITD Testing', state = 'NC', zip = 55555, phone = 5555555555 email = where id=967 and num=6 -
[SOLVED] data is not writing to the e-mail field
jakebur01 replied to jakebur01's topic in PHP Coding Help
We must have something else going on. I made that change and it wouldn’t write any of the data. -
[SOLVED] data is not writing to the e-mail field
jakebur01 replied to jakebur01's topic in PHP Coding Help
I am starting to get lost in the code. I have attached the actual files. [attachment deleted by admin] -
[SOLVED] data is not writing to the e-mail field
jakebur01 replied to jakebur01's topic in PHP Coding Help
That isn’t working. But, all of the other fields are writing. -
[SOLVED] data is not writing to the e-mail field
jakebur01 replied to jakebur01's topic in PHP Coding Help
Wow! Thank you. -
[SOLVED] data is not writing to the e-mail field
jakebur01 replied to jakebur01's topic in PHP Coding Help
bump. . -
I am trying to write a PHP script that will write data to a MySQL database (obviously). However, the e-mail field is not working. (everything is NULL when data is entered). Is there something wrong in my coding? form page require_once("all_includes.php"); session_start(); check_valid_user(); $conn = new db_conn(); //get user id $id = $_SESSION['emp_sess_uid']; $count = 6; //get values for ($i=1; $i<=$count; $i++){ $name[$i] = addslashes(trim($_POST['ref_name' . $i])); $position[$i] = addslashes(trim($_POST['ref_pos' . $i])); $street[$i] = addslashes(trim($_POST['ref_street' . $i])); $city[$i] = addslashes(trim($_POST['ref_city' . $i])); $state[$i] = addslashes(trim($_POST['ref_state' . $i])); $zip[$i] = addslashes(trim($_POST['ref_zip' . $i])); $phone1_[$i] = addslashes(trim($_POST['ref_phone1_' . $i])); $phone2_[$i] = addslashes(trim($_POST['ref_phone2_' . $i])); $phone3_[$i] = addslashes(trim($_POST['ref_phone3_' . $i])); $phone[$i] = $phone1_[$i].$phone2_[$i].$phone3_[$i]; $email[$i] = addslashes(trim($_POST['ref_email' . $i])); } //do records already exist? for ($i=1; $i<=$count; $i++){ $ref_exists[$i] = $conn->record_exists_with_num('refs',$id,$i); //echo $i . ": ".$ref_exists[$i]; } //construct query //construct fail_to_reemploy queries for ($i=1; $i<=$count; $i++){ if (!$ref_exists[$i]){ $query = "insert into refs ("; $query .= "id, num, name, position, "; $query .= "street, city, state, zip, phone, email) "; $query .= "values ($id, "; $query .= $i . ", "; $query .= "'" . $name[$i] . "', "; $query .= "'" . $position[$i] . "', "; $query .= "'" . $street[$i] . "', "; $query .= "'" . $city[$i] . "', "; $query .= "'" . $state[$i] . "', "; $query .= "zip = " . $zip[$i] . ", "; $query .= "phone = " . $phone[$i] . " "; $query .= "email = " . $email[$i] . " "; $query .= " where id=$id "; } else{ $query = "update refs set "; $query .= "name = '" . $name[$i] . "', "; $query .= "position = '" . $position[$i] . "', "; $query .= "street = '" . $street[$i] . "', "; $query .= "city = '" . $city[$i] . "', "; $query .= "state = '" . $state[$i] . "', "; $query .= "zip = " . $zip[$i] . ", "; $query .= "phone = " . $phone[$i] . " "; $query .= "email = " . $email[$i] . " "; $query .= " where id=$id "; $query .= "and num=$i"; } //echo "<br>query: ".$query; //execute query $conn->query($query); } header("Location:".$page8); post page require_once("all_includes.php"); session_start(); check_valid_user(); $conn = new db_conn(); //get user id $id = $_SESSION['emp_sess_uid']; $count = 6; //get values for ($i=1; $i<=$count; $i++){ $name[$i] = addslashes(trim($_POST['ref_name' . $i])); $position[$i] = addslashes(trim($_POST['ref_pos' . $i])); $street[$i] = addslashes(trim($_POST['ref_street' . $i])); $city[$i] = addslashes(trim($_POST['ref_city' . $i])); $state[$i] = addslashes(trim($_POST['ref_state' . $i])); $zip[$i] = addslashes(trim($_POST['ref_zip' . $i])); $phone1_[$i] = addslashes(trim($_POST['ref_phone1_' . $i])); $phone2_[$i] = addslashes(trim($_POST['ref_phone2_' . $i])); $phone3_[$i] = addslashes(trim($_POST['ref_phone3_' . $i])); $phone[$i] = $phone1_[$i].$phone2_[$i].$phone3_[$i]; $email[$i] = addslashes(trim($_POST['ref_email' . $i])); } //do records already exist? for ($i=1; $i<=$count; $i++){ $ref_exists[$i] = $conn->record_exists_with_num('refs',$id,$i); //echo $i . ": ".$ref_exists[$i]; } //construct query //construct fail_to_reemploy queries for ($i=1; $i<=$count; $i++){ if (!$ref_exists[$i]){ $query = "insert into refs ("; $query .= "id, num, name, position, "; $query .= "street, city, state, zip, phone, email) "; $query .= "values ($id, "; $query .= $i . ", "; $query .= "'" . $name[$i] . "', "; $query .= "'" . $position[$i] . "', "; $query .= "'" . $street[$i] . "', "; $query .= "'" . $city[$i] . "', "; $query .= "'" . $state[$i] . "', "; $query .= "zip = " . $zip[$i] . ", "; $query .= "phone = " . $phone[$i] . " "; $query .= "email = " . $email[$i] . " "; $query .= " where id=$id "; } else{ $query = "update refs set "; $query .= "name = '" . $name[$i] . "', "; $query .= "position = '" . $position[$i] . "', "; $query .= "street = '" . $street[$i] . "', "; $query .= "city = '" . $city[$i] . "', "; $query .= "state = '" . $state[$i] . "', "; $query .= "zip = " . $zip[$i] . ", "; $query .= "phone = " . $phone[$i] . " "; $query .= "email = " . $email[$i] . " "; $query .= " where id=$id "; $query .= "and num=$i"; } //echo "<br>query: ".$query; //execute query $conn->query($query); } header("Location:".$page8);
-
I have 161 events in a mysql table that need to be displayed on different days in my calendar script. I need to be able to use this same calculation for other parts of my site so every page will be consistent in using the same event. Ex. Something like..... $eventpick= $month + $month + $day ' 3 + 3 + 3 ' ///// $eventpick would then equal 9 if the date is the third of march. Then SELECT from event table where event = 9 to display the event for the day. <?php //This gets today's date $date =time () ; //This puts the day, month, and year in seperate variables $day = date('d', $date) ; $month = date('m', $date) ; $year = date('Y', $date) ; //Here we generate the first day of the month $first_day = mktime(0,0,0,$month, 1, $year) ; //This gets us the month name $title = date('F', $first_day) ; //Here we find out what day of the week the first day of the month falls on $day_of_week = date('D', $first_day) ; //Once we know what day of the week it falls on, we know how many blank days occure before it. If the first day of the week is a Sunday then it would be zero switch($day_of_week){ case "Sun": $blank = 0; break; case "Mon": $blank = 1; break; case "Tue": $blank = 2; break; case "Wed": $blank = 3; break; case "Thu": $blank = 4; break; case "Fri": $blank = 5; break; case "Sat": $blank = 6; break; } //We then determine how many days are in the current month $days_in_month = cal_days_in_month(0, $month, $year) ; //Here we start building the table heads echo "<table border=1 class=standard width=530 height=250>"; echo "<tr><th colspan=7> $title $year </th></tr>"; echo "<tr><td width=42>S</td><td width=42>M</td><td width=42>T</td><td width=42>W</td><td width=42>T</td><td width=42>F</td><td width=42>S</td></tr>"; //This counts the days in the week, up to 7 $day_count = 1; echo "<tr>"; //first we take care of those blank days while ( $blank > 0 ) { echo "<td></td>"; $blank = $blank-1; $day_count++; } //sets the first day of the month to 1 $day_num = 1; //count up the days, untill we've done all of them in the month while ( $day_num <= $days_in_month ) { if($day==$day_num){ echo "<td class=today>$day_num </td>"; $day_num++; $day_count++;} else { echo "<td>$day_num </td>"; $day_num++; $day_count++; } //Make sure we start a new row every week if ($day_count > 7) { echo "</tr><tr>"; $day_count = 1; } } //Finaly we finish out the table with some blank details if needed while ( $day_count >1 && $day_count <=7 ) { echo "<td> </td>"; $day_count++; } echo "</tr></table>";
-
What is the best way to set up a recurring event to us with my mysql database?
-
Should I upload my own table data or use an api like yahoo or google?
-
I need a suggestion. My site will have international users. One of the features the site contains is a world map of all of the members in little red dots. This map uses long / lat coordinates. I downloaded a 800mb flat file that contains all towns in all countries and their coordinates. I figured I would also need to make the sign up form fields drop down menus pulling from this same large table instead of giving them the option to type in their city, etc. Before I go with this method? Does anyone have any suggestions on a better way to do this? I am really bad about complicating things. It seemed like a lot, storing all of the world data in my MySQL database. What do other people do?
-
It worked when I changed my double quotes to single quotes. Thank you premiso and thanks again for the tip.
-
ohh.. it may have a forward slash in front of it??... $fList[$i] outputs "dealer_downloads.php?command=listFiles&currDir=/secure" in the browser I tried this. It doesn't do anything yet. if ($fList[$i] == "/secure" && $standard == 1) { echo"no secure"; } else {?> <img src='/images/folder.gif'> <a href='dealer_downloads.php?command=listFiles&currDir=<?php echo $fList[$i]; ?>'> <?php echo $trimFile; ?> </a> <br> <?php } $fList[$i] does output /secure though when I echoed it out on the page
-
hmm.. It is still not catching it. I even tried if (strtolower($fList[$i]) == "secure") and it still did not work.
-
Thanks for the tip on indenting. I will work on that. I tried this, but it isn't working. I also used ereg_replace on the "secure" directory which did work, but it left the image. if(@ftp_chdir($conn, $fList[$i])) { @ftp_cdup($conn); if ($fList[$i]==secure) { } else {?> <img src='images/folder.gif'> <a href='dealer_downloads.php?command=listFiles&currDir=<?php echo $fList[$i]; ?>'> <?php echo $trimFile; ?> </a> <br> <?php } }
-
I have this script that pulls directories via ftp and displays them. I am trying to implement to where if $standard=2 then it will display the directory "secure". if $standard=1 then it will exclude the directory "secure." function ShowFiles() { $conn = DoConn(); $currDir = ""; // Get the name of the current directory if(isset($_GET["currDir"])) $currDir = $_GET["currDir"]; else $currDir = ftp_pwd($conn); // Retrieve a list of files and directories // and display the appropriate icon for each $fList = @ftp_nlist($conn, $currDir); // We will work out the parent directory $parentDir = strrev($currDir); $parentDir = ereg_replace("^[a-zA-Z0-9\-]*/", "", $parentDir); $parentDir = strrev($parentDir); ?> <a href="javascript:history.go(-1)"> <img src='images/back.gif'> </a> <a href="dealer_downloads.php"><img src="images/home.gif"></a> <br> <?php for($i = 0; $i < sizeof($fList); $i++) { // We will remove the parent directory (if any) // from the name of the file that gets displayed $trimFile = ereg_replace("^$currDir", "", $fList[$i]); // Remove any forward slash at front of name $trimFile = ereg_replace("^/", "", $trimFile); if(@ftp_chdir($conn, $fList[$i])) { @ftp_cdup($conn); ?> <img src='images/folder.gif'> <a href='dealer_downloads.php?command=listFiles&currDir=<?php echo $fList[$i]; ?>'> <?php echo $trimFile; ?> </a> <br> <?php } else { ?> <img src='images/file.gif'> <a href='dealer_downloads.php?command=getFile&currFile=<?php echo $fList[$i]; ?>&currDir=<?php echo $currDir; ?>'> <?php echo $trimFile; ?> </a> <br> <?php } } }
-
I am doing a site for a company who currently as a asp.net site on a different domain than the current php site I am working on. Clients have been complaining that when they are on the asp.net site and the link over to the php site and the go back to asp, they are logged out. Is there any way I could pass the session from the asp site over to php? What would be the best way to attack this?
-
Is there any other way to redirect at the end of a page using php?
-
Is there any way to do a safe header redirect at the end of code? I was reading on php.net where it cannot be below any html tags.
-
How can I correctly make my variables work in this string? $headers .= 'To: $name <$c_email>' . "\r\n";
-
bump..
-
Ok, I have the curl form post going to the site and I have a function the collects info within a div on a page withing the site. But, I cannot figure out how to combine the two. Or use authentication with the info collecting function. //create array of data to be posted $post_data['__VIEWSTATE'] = 'dDwfY6SxT5gIvWIKozYf='; $post_data['UcLoginPage1:tbUsername'] = '4f6'; $post_data['UcLoginPage1:tbPassword'] = 'f6'; //traverse array and prepare data for posting (key1=value1) foreach ( $post_data as $key => $value) { $post_items[] = $key . '=' . $value; } //create the final string to be posted using implode() $post_string = implode ('&', $post_items); //create cURL connection $curl_connection = curl_init('http://www.sfif.com/Login.aspx?HTTPReferer=Login.aspx?HTTPReferer=&Login=Error'); //set options curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30); curl_setopt($curl_connection, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"); curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 1); //set data to be posted curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $post_string); //perform our request $result = curl_exec($curl_connection); //show information regarding the request print_r(curl_getinfo($curl_connection)); echo curl_errno($curl_connection) . '-' . curl_error($curl_connection); //close the connection curl_close($curl_connection); $item = "OP3f33"; // get DOM from URL or file $html = file_get_html("http://smife.com/DAfil.aspx?Itefo=$item"); // find all div tags with id=gbar foreach($html->find('div#price') as $e) { $num= $e->innertext;} $new_num = preg_replace ('~[^0-9.]~','', $num); $margin_num=$new_num*1.15; // find all div tags with id=gbar foreach($html->find('div#qoh') as $e) { $qoh= $e->innertext;} echo "Original: $new_num<br />Margin: $margin_num<br />QOH: $qoh"; /*if($margin_num==0) { } else {mysql_query("UPDATE BOOKS set `price` = $margin_num WHERE `isbn` =$item", $db);} */
-
Is there any way I could make php act as a browser and send a form post to a url for authentication. I want to do this so I can access and read a page within the site using php. I have the reading bit already done. Now I am trying to see if I can authenticate php or the server into a specific website to access more content within the site.
-
I think I am just going to have it update the price from our other website only when the user clicks on the item page. That would be easier than me trying to loop through 40,000 rows on the same page. Is there any way I can authenticate the server into a website. Example. Using php.. send a form from the server to the website to authenticate. Then I can access other data like quantities. Does this make since? I complicate things way too much. I am supposed to keep it simple.