Jump to content

a2bardeals

Members
  • Posts

    62
  • Joined

  • Last visited

    Never

Everything posted by a2bardeals

  1. i replaced the escape < with < and it seems to do the job
  2. line 80 is exactly the code i just posted a second ago 77 $linedata = $data["frlong"] . " " . substr($data["frlat"],1) . ","; 78 if ( $rt2 != null ) { 79 foreach($rt2 as $rtsq => $ll) { 80 for($x=1; $x<11; $x++) { 81 if ( $ll["Lng$x"] == "+000000000" ) break; 82 $linedata .= $ll["Lng$x"] . " " . substr($ll["Lat$x"],'1') . ","; 83 } 84 } 85 }
  3. did not fix the problem... i think it lies some where in the code: for($x=1; $x<11; $x++) what is the purpose of the semi-colons and could that be the reason?
  4. i have a script that I did not write that is used for importing TIGER/Line data into a MySQL database. when i run the script it gives me a parse error. I cannot find the error for the life of me. See if you can find it. The parse error is: Parse error: parse error, expecting `')'' in /Library/WebServer/Documents/bar/secure/mrp/geocode/tigerload.php on line 80 here is the suspect code snipit around line 80 function processData($data, $rt2=null) { global $dbConn; // ====== Builds a linedata string similiar to: // -121952185 45642435,-121952674 45642755,-121953000 45642755,-121953072 45642719 // // It uses the fr/to lat/long of the type1 record ( = $data) for the start and end points // and if this TLID has a corresponding type2 record ($rt1 != null) then the intermediate // points in that type2 record are included. Once built, the string is added to the $data // array and stored in the database. // $linedata = $data["frlong"] . " " . substr($data["frlat"],1) . ","; if ( $rt2 != null ) { foreach($rt2 as $rtsq => $ll) { for($x=1; $x<11; $x++) { if ( $ll["Lng$x"] == "+000000000" ) break; $linedata .= $ll["Lng$x"] . " " . substr($ll["Lat$x"],'1') . ","; } } } $linedata .= $data["tolong"] . " " . substr($data["tolat"],1); $data["linedata"] = $linedata; // ==== Store all of the type1 record info and the new linedata to the completechain table // using the handy AutoExecute method in the ADODB library. return $dbConn->AutoExecute("completechain", $data, 1); } Any Ideas?
  5. a2bardeals

    picture

    basically it sounds like what you want to do is incorporate a <input type=file> form element and then insert a column in your MySQL data for the path to the uploaded file. You can find out more about uploading files though a form here: http://www.faqs.org/rfcs/rfc1867.html it's a two page process. The first page is your form and where you input user data (name, address, and location of the file your wish to upload) and the sencond page which is the form action page which will copy() the uploaded file and insert the path to that file into your MySQL table. I hope this helps.
  6. I am working on a geocoding program that will calculate distance between two addresses and I think I have found a way to do it. However, the data I could find is from the US census website. It's called TIGER/Line data and its in a wierd format. I have found one site that kind of explains how to do it but I can't get it to work the way they want. Basically, they have a PHP script that is supposed to read the data into MySQL which dosen't seem to work for me (gives parse errors and such). I am desperatly in need of finding a way to use this TIGER/Line Data to geocode a certain county. To fully undertand this problem you may need to read the article. http://blog.tooleshed.com/?p=16 Any ideas on getting this data into a MySQL format?
  7. i don't know your date format in SQL but if it's DATE and not TIMESTAMP then you could try something like: $oneyearago = date('Y-m-d', mktime(0, 0, 0, date('Y') - 1, date('m'), date('d'))); $twoyearsago = date('Y-m-d', mktime(0, 0, 0, date('Y') - 2, date('m'), date('d'))); $sql= "SELECT * FROM projects WHERE DATE_SUB <= '$oneyearago' && DATE_SUB >=$twoyearsago' ;";
  8. i am writing a stat cruncher for my site and i have a simple script: [code]<?php $con1 = mysql_connect("localhost","LOGIN", "PASSWORD"); $domain = GetHostByName($REMOTE_ADDR); $browser = $_SERVER['HTTP_USER_AGENT']; $page = $_SERVER['SCRIPT_NAME']; mysql_select_db("stats", $con1); $sql44="INSERT INTO `visitors` ( `IP` , `BROWSER` , `PAGE`, `TIME`) VALUES ('$domain', '$browser', '$page', NOW() );"; if (!mysql_query($sql44,$con1)) { die('Error: ' . mysql_error()); } ?> [/code] of course for sanity i have this page called getinfo.php and use it as an include on different pages i want to track. So say on my index page i have <?php include "getinfo.php"; ?> now here's the problem.... when i load the index page it inserts the data multiple times. It's not at all consistant with how many it will insert 1,2,3,4 up to 5. The TIME column is a TIMESTAMP in MySQL format and is also the primary index for the table. What's weird is it works fine if you only load getinfo.php by itself and not as an include. I have tried this include in both the head and body and produces the same result. Any Ideas would be very much appreciated!
  9. so i am now sure it is a Firefox issue i've checked it on IE (Win/MacOS), Safari (MacOS), Firefox (Win/MacOS), & Opera. Firefox is the only one that does this!
  10. I am using firefox 1.5.0.8 and my only other testing browser is Safari and it does not insert the extra row in Safari. So it may be a Firefox issue. But why would Firefox submit twice? It makes no sense to me and i need to fix it! Grrrrrr. If you would like to test what im working with a different browser, go to: [url=http://www.barcheese.com/newyears]http://www.barcheese.com/newyears[/url] Help!
  11. ok so i am playing around with a simple script. a form with a post action sending to a page with the sql insert code: my form is simple: [code]<form action="do_register.php" method="POST"> Name: <input type="text" name="fname" size="20"> Age: <select name="age"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> </select> Favorite Color: <select name="color"> <option value="red">Red</option> <option value="green">Green</option> <option value="blue">Blue</option> <option value="orange">Orange</option> <option value="purple">Purple</option> <option value="pink">Pink</option> </select> <input type="SUBMIT" value="GO"> </form>[/code] this sends the data just fine. it goes to "do_register.php" then i insert the data: [code] <? $con = mysql_connect("localhost", "user", "pass"); mysql_select_db("database", $con); $sql = "INSERT INTO 'table' (`fname`, `age` , `color`) VALUES ('$_POST[fname]' , '$_POST[age]' , '$_POST[color]');"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo 'Thanks, '; echo $fname; echo '<br>Your info has been submitted!'; ?> [/code] it all seems fine after you post but when i call the results there is one row with the data and another blank row inserted after it. The ID row which is the index is set to auto_increment and it assignes two rows (eg. one submission = one row id:23 with the data and one row id:24 with no data.) Any ideas?
  12. I have a few different pages on my site with a basic set up of: Page_1.php is a normal html form with the POST method and the action set to Page_2.php a couple hidden variables mostly user defined text inputs or select fields. On submit it sends data to Page_2.php which updates a MySQL database using: [code]$con = mysql_connect("localhost","root", "*******"); mysql_select_db("database", $con); $sql="INSERT INTO addcampus (school, city, state, email, send) VALUES ('$_POST[school]','$_POST[city]','$_POST[state]','$_POST[email]','$_POST[send]')"; if (!mysql_query($sql,$con)) { die('ErrorTran: ' . mysql_error()); } [/code] the database table is also set with an ID column that auto increments and is the primary index. Often my database has been inserting one or multiple empty rows with just an ID. So basically the user data is there but where the user data row has an id of 10 the empties are 11 12 13 and so on. At one point i had a table with 1400 rows and only 20 of them actually had information in them. This is very frustrating for maintenance! Anyone have any ideas let me know. Thanks!
  13. so i have a foreach statement that includes an if statement. There are say, 5 camcorder tapes with the corresponding variables representing the length of each tape. $tape1 = 30 $tape2 = 60 $tape3 = 30 $tape4 = 90 $tape5 = 30 from get action of a form i have these variables carry over to the next page where i will try to decide which/how many tapes can fit on a 2 hour dvd or which ones need multiple dvds. eg. if 3 tapes are 30 min and 1 tape is 180 min i can fit the 30 min 3 tapes on one 2 hour dvd but the 180 min will require 2 dvds. (this will eventually genereate a price quote for how many master dvds company_x has to make) ok, so i have the following code: [code] foreach ( range(1, $no_of_tapes) as $number){ $name = 'tape'.$number;   if ($_GET[$name] == 30){ // **HERE IS WHERE I NEED TO COUNT THE NUMBER OF TAPES THAT ARE 30 MIN AND DIVIDE THAT NUMBER BY 4 WHICH WILL GIVE ME THE NUMBER OF DVDS NEEDED.   }elseif ($_GET[$name] == 60{ // **AGAIN I NEED TO COUNT THE NUMBER OF TAPES THAT ARE 60 MIN AND DIVIDE THAT NUMBER BY 2 WHICH WILL GIVE ME THE NUMBER OF DVDS NEEDED.   } } is this easy to do or even possible?[/code]
  14. that makes sense however to gather the tape lengths i am using something like: [code] foreach(range(1, $no_of_tapes) as $no){ echo "<select name=tape'.$no.'>"; echo "<option value=30>30 min</option>"; echo "<option value=60>60 min</option>"; echo "<option value=90>90 min</option>"; echo "</select>"; } [/code] which will always seem to pass mutiple variables even if i make the select name the same for all....
  15. i have page1 that asks how many tapes you have, which is sent as a variable to page2 as $tapes which is used in a foreach statement creating the correct number of input fields to ask the length of tape1, tape2, ect.... On the third page i carry over those thengths via the GET method aka tape1=20 tape2=45 Here's where it gets tricky...I would like to create a variable that represents a 60 or 120 min DVD and create a fuction to add the tapes to the dvd and subtract the $tape value from the $dvd value. I also need to not allow that function to be performed if there is not enough space left on the dvd. and a function to create a new 1 or 2 hour dvd. Then calculate how many tapes are on each dvd and how many dvds there are. Is this possisble or only a dream in a young programmers head?
  16. that totally works! i made the mistake of calling the 'echo' still in the 'foreach' bracket so it was displaying every time it added a number but simply calling it after the bracket returned the sum! So thaaaaank you.
  17. hello. I have 3 pages. The point of the 3 pages is to find out the total length of multiple video tapes. 1. The first has a form with a text field that asks the customer how many video tapes they have. Which is sent via the GET method as $tapes. 2. The second page takes that number and creates the same number of select fields to find the individual lengths of the tapes. Using: [code]<form name=form3 method=GET> foreach ( range(1, $tapes) as $num ) { echo '<select name=tape'.$num.'>'; echo '<option value=30>30 min</option>'; echo '<option value=60>60 min</option>'; echo '</select>'; } </form>[/code] 3. The third page is the one i have problems with. I have the variable of each tape in the URL (eg. tape1=30&tape2=60) I know i can obviously manually call these values back simply by: [code]echo $_GET[tape1];[/code] but i don't know how many variables will need to be added up, therfore i can't simply do that.... so i started thinking... the variable $tapes (number of tapes) also carries over to the third page by a hidden input variable in the second page so i tried: [code]foreach( range(1, $tapes) as $number)  { $no = 'tape'.$number; echo $_GET[$no]; } [/code] this displays the values that i need to add up.... but how do i add them up? It's probably something really obvious and my brain is too fried to think of what will do that. After 3 hours in the php.net manual still no answer. Please will someone help me out?
  18. well the orders for transfers have totally different options (fields) than the duplication orders so its hard to have them in the same table. For web sanity i need to keep them seperate and for accounting and customer service sanity i need to have a unique id for each different project. I will try the go between table and let you know how it works. p.s. it would be nice if somehow i could add an identifier in the Order Number like WT0003 for a "Web: Transfer" or WD0004 for "Web: Duplication". Can i generate the number from MySQL auto_increment or would i have to write a script that checks the last four digits of the last order in the orders table and adds one?
  19. ALTER TABLE `YOUR_TABLE_NAME` ADD `YOUR_FIELD_NAME` YOUR_FEILD_TYPE NOT NULL ; a field type is like text (TEXT) or integer (INT). more field types http://dev.mysql.com/doc/refman/4.1/en/data-types.html if you want just a normal string variable like a 'username' and your table is named 'table1' your query might look like: ALTER TABLE `table1` ADD `username` TEXT NOT NULL 
  20. by the way...why dont you just have a table called dvds with fields named 'TITLE' and 'COPIES' then you could just call the results as one table select like: "SELECT title, copies FROM DVDS WHERE 1
  21. SELECT * FROM `DVD`,`COPIES` WHERE 1
  22. i have an online order process witch places orders into two types of orders reperesented by two different tables in a MySQL database ('transfers' & 'dupliaction'). I am trying to create a unique order number ('ID') field in both tables that auto_increments but so that there are not duplicate ids in the 2 tables. Basically, If someone places a transfer order it assigns the order ID: 00001 in the table 'transfers' and then another customer comes along and places a duplication order it will assign the duplication order ID: 00002 [b]rather than[/b] 00001 becuase its the first in the table 'duplication'. This is for order processing and shipping sanity.
  23. a2bardeals

    search?

    i am having some trouble searching my database. the db is set up like an address book. name, address, city, state, phone, id(int) *auto_increment*  i created the db then created a php script to populate the db with entries. now i want to search those entries. i tried going this route but it returns a blank page. of course i have a form page (search.html) that the action is set to srch.php srch.php: <font face="arial, helvetica" size="1"> <? $username = "XXXXXX"; $password = "XXXXXXX"; $database = "aXXXXXXXX"; $server  = "localhost"; @mysql_connect($server,$username,$password); @mysql_select_db($database); ?> <? $result = mysql_query("SELECT name, city, state, id FROM a2_bars WHERE name LIKE '".$_POST['term']."'"); if (!$result) { echo 'Could not run query: ' . mysql_error(); exit; } while ($row = mysql_fetch_array($result, MYSQL_NUM)) { printf('%s<br>%s<br><br>', $row[0], $row[1]); } mysql_free_result($result); ?>
  24. ok heres the code so far... The Daily List (daily/list.php) [code]<font face="arial, helvetica" size="2"> <? @mysql_connect($server,$username,$password); @mysql_select_db($database); echo '<b>Specials For:</b> '; echo $today; echo '<br><br>'; $result = mysql_query("SELECT link, day, deal FROM daily WHERE day = '".$today."'"); if (!$result) { echo 'Could not run query: ' . mysql_error(); exit; } while ($row = mysql_fetch_array($result, MYSQL_NUM)) { printf('%s<br>%s<br><br>', $row[0], $row[2]); } mysql_free_result($result); ?>[/code] Here is the Monthly List (monthly/monthylist.php) [code]<font face="arial, helvetica" size="2"> <? @mysql_connect($server,$username,$password); @mysql_select_db($database); $file = basename($_SERVER['PHP_SELF']); echo 'Deals For:'; echo $mo; echo '<br><br>'; $result = mysql_query("SELECT link, month, deal FROM monthly WHERE month = '".$mo."'"); if (!$result) { echo 'Could not run query: ' . mysql_error(); exit; } while ($row = mysql_fetch_array($result, MYSQL_NUM)) { printf('%s<br>%s<br><br>', $row[0], $row[2]); } mysql_free_result($result); ?>[/code] and here is the dislplay (display.php) ***in lower directory [code] <html> <head> </head> <body> <? $file = basename($_SERVER['PHP_SELF']); echo 'Daily Specials <br>'; ?> <form action=<? echo $file; ?> method="get">   <select name=today> <option selected>Select Day...</option>     <option value=Mon>Monday</option>     <option value=Tue>Tuesday</option>     <option value=Wed>Wednesday</option>     <option value=Thu>Thursday</option>     <option value=Fri>Friday</option>     <option value=Sat>Saturday</option>     <option value=Sun>Sunday</option>   </select> <input type=Submit value=View!> </form> <? include "daily/list.php"; ?> <br> <hr> <br> Monthly Specials <br> <form action=<? echo $file; ?> method="get">   <select name="mo"> <option selected>Select Month...</option>     <option value="Jan">January</option>     <option value="Feb">February</option>     <option value="Mar">March</option>     <option value="Apr">April</option>     <option value="May">May</option>     <option value="Jun">June</option>     <option value="Jul">July</option>   </select> <input type="Submit" value="View!"> </form><br> <?php include "monthly/monthlylist.php"; ?> </body> </html>[/code] i also have an index.php file that detects the day and week redirects to display by doing this: [code] <html> <head> <title>Hold On..</title> <? $dday = Date('D'); $monthy = Date('M'); ?> </head> <body> <script> location = "display.php?today=<? echo $dday; ?>&mo=<? echo $monthy; ?>"; </script> Getting Deals For <?echo $Monthly; echo $monthy; ?> <center>Hold On!</a> </body> </html>[/code] but there has to be an easier way to load the variables in the URL on the load of display.php without having to redirect right? basically when the user is looking at display.php and chages the day to view i want the mo=Jun to stay the same in the URL aka page is loaded as [a href=\"http://www.domain.com/display.php?today=Tue&mo=Jun\" target=\"_blank\"]http://www.domain.com/display.php?today=Tue&mo=Jun[/a] user selects wednesday from the list and URL changes to [a href=\"http://www.domain.com/display.php?today=Wed&mo=Jun\" target=\"_blank\"]http://www.domain.com/display.php?today=Wed&mo=Jun[/a] rather right now it goes to [a href=\"http://www.domain.com/display.php?today=Wed\" target=\"_blank\"]http://www.domain.com/display.php?today=Wed[/a] and the monthy list of events goes away... PLEASE HELP! my brain hurts
  25. So I have hit a wall. I have two problems. First, I have two lists that are dependent on variables. a daily events list (daily.php) and a monthly events list (monthly.php) they both have variables to set which day or month to view. If i am looking at monthly.php i can use html to pass variables just by <a href="monthly.php?mo=jan">Jan</a> or manually typing in the URL however when i try to set a default value for $mo in monthly.php e.g. $mo = date('M') // to auto detect todays date i cant change the variable via the URL or a link to view other months or days Second, I have a page called display.php which includes the two files together one on top of the other <? include 'daily/daily.php'; ?> <br> <? include 'monthly/monthly.php';?> If i use links on both pages to pass variables the URL comes out like [a href=\"http://www.domain.com/mysql/monthly.php?mo=jan\" target=\"_blank\"]http://www.domain.com/mysql/monthly.php?mo=jan[/a] and i get a File Not Found becuase monthly is in a higher directory anyways. get ok results when i use the GET method of a form. aka selection box with submit button however any information that was kept in the $today variable in the URL goes away. So is there a way to keep one variable up and just replace the value of the other one? any help will be very helpful
×
×
  • 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.