-
Posts
33 -
Joined
-
Last visited
Never
About jej1216
- Birthday 06/10/1955
Contact Methods
-
MSN
jej1216@hotmail.com
Profile Information
-
Gender
Male
-
Location
New Mexico, USA
jej1216's Achievements
Member (2/5)
0
Reputation
-
Can php code be used to hide the url in the web browser?
jej1216 replied to jej1216's topic in PHP Coding Help
Thanks, I'll look at Javascript. This is a view only schedule board - I don't want the user navigating away from the page. - Joe -
I need to hide the url as well as the menus from the web browser only when one php page is displayed. Can this be done in php code? TIA, Joe
-
OK, getting closer. Now the issue seems to be in my 'sending' page. I get one error now: Error: 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 ''700_401','730_401','800_401','830_401','900_401','930_401','1000_401','1030_401' at line 1 Here is that piece of code from that page: <tr> <td>401</td> <td><select name="data[700_401]" SIZE="1"> <?php include($_SERVER['DOCUMENT_ROOT'] . "/includes/db.php"); $result = mysql_query("SELECT fieldvalue FROM jos_sched_values order by sort",$db); while ($myrow = mysql_fetch_array($result)) { $fieldvalue=$myrow["fieldvalue"]; echo "<option value = ".$fieldvalue.">".$fieldvalue."</option>"; } echo "</select></td>"; ?> <td><select name="data[730_401]" SIZE="1"> <?php $result = mysql_query("SELECT fieldvalue FROM jos_sched_values order by sort",$db); while ($myrow = mysql_fetch_array($result)) { $fieldvalue=$myrow["fieldvalue"]; echo "<option value = ".$fieldvalue.">".$fieldvalue."</option>"; } echo "</select></td>"; ?> <td><select name="data[800_401]" SIZE="1"> <?php $result = mysql_query("SELECT fieldvalue FROM jos_sched_values order by sort",$db); while ($myrow = mysql_fetch_array($result)) { $fieldvalue=$myrow["fieldvalue"]; echo "<option value = ".$fieldvalue.">".$fieldvalue."</option>"; } echo "</select></td>"; ?> <td><select name="data[830_401]" SIZE="1"> <?php $result = mysql_query("SELECT fieldvalue FROM jos_sched_values order by sort",$db); while ($myrow = mysql_fetch_array($result)) { $fieldvalue=$myrow["fieldvalue"]; echo "<option value = ".$fieldvalue.">".$fieldvalue."</option>"; } echo "</select></td>"; ?> <td><select name="data[900_401]" SIZE="1"> <?php $result = mysql_query("SELECT fieldvalue FROM jos_sched_values order by sort",$db); while ($myrow = mysql_fetch_array($result)) { $fieldvalue=$myrow["fieldvalue"]; echo "<option value = ".$fieldvalue.">".$fieldvalue."</option>"; } echo "</select></td>"; ?> <td><select name="data[930_401]" SIZE="1"> <?php $result = mysql_query("SELECT fieldvalue FROM jos_sched_values order by sort",$db); while ($myrow = mysql_fetch_array($result)) { $fieldvalue=$myrow["fieldvalue"]; echo "<option value = ".$fieldvalue.">".$fieldvalue."</option>"; } echo "</select></td>"; ?> <td><select name="data[1000_401]" SIZE="1"> <?php $result = mysql_query("SELECT fieldvalue FROM jos_sched_values order by sort",$db); while ($myrow = mysql_fetch_array($result)) { $fieldvalue=$myrow["fieldvalue"]; echo "<option value = ".$fieldvalue.">".$fieldvalue."</option>"; } echo "</select></td>"; ?> <td><select name="data[1030_401]" SIZE="1"> <?php $result = mysql_query("SELECT fieldvalue FROM jos_sched_values order by sort",$db); while ($myrow = mysql_fetch_array($result)) { $fieldvalue=$myrow["fieldvalue"]; echo "<option value = ".$fieldvalue.">".$fieldvalue."</option>"; } echo "</select></td>"; ?> I also am attaching both php files. Thanks, Joe [attachment deleted by admin]
-
I changed the form fields as you suggested, and then in the posted page I used the code: The posted page has this code (these are lines 20-37): <?php include($_SERVER['DOCUMENT_ROOT'] . "/includes/db.php"); $cols = "'" . implode("','", array_keys($_POST['data'])) . "'"; $vals = "'" . implode("','", array_map("mysql_real_escape_string", $data)) . "'"; $sql = "INSERT INTO jos_schedule ($cols) VALUES ($vals)"; if (!mysql_query($sql,$db)) { die('Error: '.mysql_error()); } mysql_close($db); print "<H2>Schedule Update has been successfully submitted.</H2>"; print "<br>Thank you.<br>"; ?> but now I get these errors: Warning: array_map() [function.array-map]: Argument #2 should be an array in C:\xampp\htdocs\sched_board\schedboard_new_posted.php on line 24 Warning: implode() [function.implode]: Invalid arguments passed in C:\xampp\htdocs\sched_board\schedboard_new_posted.php on line 24 Error: 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 ''700_401','730_401','800_401','830_401','900_401','930_401','1000_401','1030_401' at line 1
-
Shawn - thanks for both replies. I am a PHP toddler, so the second reply kind of smokes my braincells. Do you mean I should do this: name="data[700_401]" name="data[700_402]" name="data[700_403]" etc. and then use $cols = "`" . implode("`,`", array_keys($_POST['data'])) . "`";$data = "'" . implode("','", array_map("mysql_real_escape_string", $_POST['data'])) . "'";$sql = "INSERT INTO jos_schedule ($cols) VALUES ($vals)"; ? Thanks! Joe
-
I have a pretty straightforward schedule page that should write values to a MySQL DB. Here is the relevant code: To put into the DB: <?php include($_SERVER['DOCUMENT_ROOT'] . "/includes/db.php"); $sql = "INSERT INTO jos_schedule (700_401, 700_402, 700_403, 700_404, 700_405, 700_406, 700_407, 700_408, 700_409, 700_410, 700_411, 700_412, 700_413, 700_414, 700_415, 700_416, 700_417, 700_418, 700_419, 700_420, 700_421, 730_401, 730_402, 730_403, 730_404, 730_405, 730_406, 730_407, 730_408, 730_409, 730_410, 730_411, 730_412, 730_413, 730_414, 730_415, 730_416, 730_417, 730_418, 730_419, 730_420, 730_421, 800_401, 800_402, 800_403, 800_404, 800_405, 800_406, 800_407, 800_408, 800_409, 800_410, 800_411, 800_412, 800_413, 800_414, 800_415, 800_416, 800_417, 800_418, 800_419, 800_420, 800_421, 830_401, 830_402, 830_403, 830_404, 830_405, 830_406, 830_407, 830_408, 830_409, 830_410, 830_411, 830_412, 830_413, 830_414, 830_415, 830_416, 830_417, 830_418, 830_419, 830_420, 830_421, 900_401, 900_402, 900_403, 900_404, 900_405, 900_406, 900_407, 900_408, 900_409, 900_410, 900_411, 900_412, 900_413, 900_414, 900_415, 900_416, 900_417, 900_418, 900_419, 900_420, 900_421, 930_401, 930_402, 930_403, 930_404, 930_405, 930_406, 930_407, 930_408, 930_409, 930_410, 930_411, 930_412, 930_413, 930_414, 930_415, 930_416, 930_417, 930_418, 930_419, 930_420, 930_421, 1000_401, 1000_402, 1000_403, 1000_404, 1000_405, 1000_406, 1000_407, 1000_408, 1000_409, 1000_410, 1000_411, 1000_412, 1000_413, 1000_414, 1000_415, 1000_416, 1000_417, 1000_418, 1000_419, 1000_420, 1000_421, 1030_401, 1030_402, 1030_403, 1030_404, 1030_405, 1030_406, 1030_407, 1030_408, 1030_409, 1030_410, 1030_411, 1030_412, 1030_413, 1030_414, 1030_415, 1030_416, 1030_417, 1030_418, 1030_419, 1030_420, 1030_421, 1100_401, 1100_402, 1100_403, 1100_404, 1100_405, 1100_406, 1100_407, 1100_408, 1100_409, 1100_410, 1100_411, 1100_412, 1100_413, 1100_414, 1100_415, 1100_416, 1100_417, 1100_418, 1100_419, 1100_420, 1100_421, 1130_401, 1130_402, 1130_403, 1130_404, 1130_405, 1130_406, 1130_407, 1130_408, 1130_409, 1130_410, 1130_411, 1130_412, 1130_413, 1130_414, 1130_415, 1130_416, 1130_417, 1130_418, 1130_419, 1130_420, 1130_421, 1200_401, 1200_402, 1200_403, 1200_404, 1200_405, 1200_406, 1200_407, 1200_408, 1200_409, 1200_410, 1200_411, 1200_412, 1200_413, 1200_414, 1200_415, 1200_416, 1200_417, 1200_418, 1200_419, 1200_420, 1200_421, 1230_401, 1230_402, 1230_403, 1230_404, 1230_405, 1230_406, 1230_407, 1230_408, 1230_409, 1230_410, 1230_411, 1230_412, 1230_413, 1230_414, 1230_415, 1230_416, 1230_417, 1230_418, 1230_419, 1230_420, 1230_421, 1300_401, 1300_402, 1300_403, 1300_404, 1300_405, 1300_406, 1300_407, 1300_408, 1300_409, 1300_410, 1300_411, 1300_412, 1300_413, 1300_414, 1300_415, 1300_416, 1300_417, 1300_418, 1300_419, 1300_420, 1300_421, 1330_401, 1330_402, 1330_403, 1330_404, 1330_405, 1330_406, 1330_407, 1330_408, 1330_409, 1330_410, 1130_411, 1330_412, 1330_413, 1330_414, 1330_415, 1330_416, 1330_417, 1330_418, 1330_419, 1330_420, 1330_421, 1400_401, 1400_402, 1400_403, 1400_404, 1400_405, 1400_406, 1400_407, 1400_408, 1400_409, 1400_410, 1400_411, 1400_412, 1400_413, 1400_414, 1400_415, 1400_416, 1400_417, 1400_418, 1400_419, 1400_420, 1400_421, 1430_401, 1430_402, 1430_403, 1430_404, 1430_405, 1430_406, 1430_407, 1430_408, 1430_409, 1430_410, 1430_411, 1430_412, 1430_413, 1430_414, 1430_415, 1430_416, 1430_417, 1430_418, 1430_419, 1430_420, 1430_421, 1500_401, 1500_402, 1500_403, 1500_404, 1500_405, 1500_406, 1500_407, 1500_408, 1500_409, 1500_410, 1500_411, 1500_412, 1500_413, 1500_414, 1500_415, 1500_416, 1500_417, 1500_418, 1500_419, 1500_420, 1500_421, 1530_401, 1530_402, 1530_403, 1530_404, 1530_405, 1530_406, 1530_407, 1530_408, 1530_409, 1530_410, 1530_411, 1530_412, 1530_413, 1530_414, 1530_415, 1530_416, 1530_417, 1530_418, 1530_419, 1530_420, 1530_421, 1600_401, 1600_402, 1600_403, 1600_404, 1600_405, 1600_406, 1600_407, 1600_408, 1600_409, 1600_410, 1600_411, 1600_412, 1600_413, 1600_414, 1600_415, 1600_416, 1600_417, 1600_418, 1600_419, 1600_420, 1600_421, 1630_401, 1630_402, 1630_403, 1630_404, 1630_405, 1630_406, 1630_407, 1630_408, 1630_409, 1630_410, 1630_411, 1630_412, 1630_413, 1630_414, 1630_415, 1630_416, 1630_417, 1630_418, 1630_419, 1630_420, 1630_421, 1700_401, 1700_402, 1700_403, 1700_404, 1700_405, 1700_406, 1700_407, 1700_408, 1700_409, 1700_410, 1700_411, 1700_412, 1700_413, 1700_414, 1700_415, 1700_416, 1700_417, 1700_418, 1700_419, 1700_420, 1700_421) VALUES ('$_REQUEST[700_401]','$_REQUEST[700_402]','$_REQUEST[700_403]','$_REQUEST[700_404]','$_REQUEST[700_405]','$_REQUEST[700_406]','$_REQUEST[700_407]','$_REQUEST[700_408]','$_REQUEST[700_409]','$_REQUEST[700_410]', '$_REQUEST[700_411]','$_REQUEST[700_412]','$_REQUEST[700_413]','$_REQUEST[700_414]','$_REQUEST[700_415]','$_REQUEST[700_416]','$_REQUEST[700_417]','$_REQUEST[700_418]','$_REQUEST[700_419]','$_REQUEST[700_420]','$_REQUEST[700_421]', '$_REQUEST[730_401]','$_REQUEST[730_402]','$_REQUEST[730_403]','$_REQUEST[730_404]','$_REQUEST[730_405]','$_REQUEST[730_406]','$_REQUEST[730_407]','$_REQUEST[730_408]','$_REQUEST[730_409]','$_REQUEST[730_410]', '$_REQUEST[730_411]','$_REQUEST[730_412]','$_REQUEST[730_413]','$_REQUEST[730_414]','$_REQUEST[730_415]','$_REQUEST[730_416]','$_REQUEST[730_417]','$_REQUEST[730_418]','$_REQUEST[730_419]','$_REQUEST[730_420]','$_REQUEST[730_421]', '$_REQUEST[800_401]','$_REQUEST[800_402]','$_REQUEST[800_403]','$_REQUEST[800_404]','$_REQUEST[800_405]','$_REQUEST[800_406]','$_REQUEST[800_407]','$_REQUEST[800_408]','$_REQUEST[800_409]','$_REQUEST[800_410]', '$_REQUEST[800_411]','$_REQUEST[800_412]','$_REQUEST[800_413]','$_REQUEST[800_414]','$_REQUEST[800_415]','$_REQUEST[800_416]','$_REQUEST[800_417]','$_REQUEST[800_418]','$_REQUEST[800_419]','$_REQUEST[800_420]','$_REQUEST[800_421]', '$_REQUEST[830_401]','$_REQUEST[830_402]','$_REQUEST[830_403]','$_REQUEST[830_404]','$_REQUEST[830_405]','$_REQUEST[830_406]','$_REQUEST[830_407]','$_REQUEST[830_408]','$_REQUEST[830_409]','$_REQUEST[830_410]', '$_REQUEST[830_411]','$_REQUEST[830_412]','$_REQUEST[830_413]','$_REQUEST[830_414]','$_REQUEST[830_415]','$_REQUEST[830_416]','$_REQUEST[830_417]','$_REQUEST[830_418]','$_REQUEST[830_419]','$_REQUEST[830_420]','$_REQUEST[830_421]', '$_REQUEST[900_401]','$_REQUEST[900_402]','$_REQUEST[900_403]','$_REQUEST[900_404]','$_REQUEST[900_405]','$_REQUEST[900_406]','$_REQUEST[900_407]','$_REQUEST[900_408]','$_REQUEST[900_409]','$_REQUEST[900_410]', '$_REQUEST[900_411]','$_REQUEST[900_412]','$_REQUEST[900_413]','$_REQUEST[900_414]','$_REQUEST[900_415]','$_REQUEST[900_416]','$_REQUEST[900_417]','$_REQUEST[900_418]','$_REQUEST[900_419]','$_REQUEST[900_420]','$_REQUEST[900_421]', '$_REQUEST[930_401]','$_REQUEST[930_402]','$_REQUEST[930_403]','$_REQUEST[930_404]','$_REQUEST[930_405]','$_REQUEST[930_406]','$_REQUEST[930_407]','$_REQUEST[930_408]','$_REQUEST[930_409]','$_REQUEST[930_410]', '$_REQUEST[930_411]','$_REQUEST[930_412]','$_REQUEST[930_413]','$_REQUEST[930_414]','$_REQUEST[930_415]','$_REQUEST[930_416]','$_REQUEST[930_417]','$_REQUEST[930_418]','$_REQUEST[930_419]','$_REQUEST[930_420]','$_REQUEST[930_421]', '$_REQUEST[1000_401]','$_REQUEST[1000_402]','$_REQUEST[1000_403]','$_REQUEST[1000_404]','$_REQUEST[1000_405]','$_REQUEST[1000_406]','$_REQUEST[1000_407]','$_REQUEST[1000_408]','$_REQUEST[1000_409]','$_REQUEST[1000_410]', '$_REQUEST[1000_411]','$_REQUEST[1000_412]','$_REQUEST[1000_413]','$_REQUEST[1000_414]','$_REQUEST[1000_415]','$_REQUEST[1000_416]','$_REQUEST[1000_417]','$_REQUEST[1000_418]','$_REQUEST[1000_419]','$_REQUEST[1000_420]','$_REQUEST[1000_421]', '$_REQUEST[1030_401]','$_REQUEST[1030_402]','$_REQUEST[1030_403]','$_REQUEST[1030_404]','$_REQUEST[1030_405]','$_REQUEST[1030_406]','$_REQUEST[1030_407]','$_REQUEST[1030_408]','$_REQUEST[1030_409]','$_REQUEST[1030_410]', '$_REQUEST[1030_411]','$_REQUEST[1030_412]','$_REQUEST[1030_413]','$_REQUEST[1030_414]','$_REQUEST[1030_415]','$_REQUEST[1030_416]','$_REQUEST[1030_417]','$_REQUEST[1030_418]','$_REQUEST[1030_419]','$_REQUEST[1030_420]','$_REQUEST[1030_421]', '$_REQUEST[1100_401]','$_REQUEST[1100_402]','$_REQUEST[1100_403]','$_REQUEST[1100_404]','$_REQUEST[1100_405]','$_REQUEST[1100_406]','$_REQUEST[1100_407]','$_REQUEST[1100_408]','$_REQUEST[1100_409]','$_REQUEST[1100_410]', '$_REQUEST[1100_411]','$_REQUEST[1100_412]','$_REQUEST[1100_413]','$_REQUEST[1100_414]','$_REQUEST[1100_415]','$_REQUEST[1100_416]','$_REQUEST[1100_417]','$_REQUEST[1100_418]','$_REQUEST[1100_419]','$_REQUEST[1100_420]','$_REQUEST[1100_421]', '$_REQUEST[1130_401]','$_REQUEST[1130_402]','$_REQUEST[1130_403]','$_REQUEST[1130_404]','$_REQUEST[1130_405]','$_REQUEST[1130_406]','$_REQUEST[1130_407]','$_REQUEST[1130_408]','$_REQUEST[1130_409]','$_REQUEST[1130_410]', '$_REQUEST[1130_411]','$_REQUEST[1130_412]','$_REQUEST[1130_413]','$_REQUEST[1130_414]','$_REQUEST[1130_415]','$_REQUEST[1130_416]','$_REQUEST[1130_417]','$_REQUEST[1130_418]','$_REQUEST[1130_419]','$_REQUEST[1130_420]','$_REQUEST[1130_421]', '$_REQUEST[1200_401]','$_REQUEST[1200_402]','$_REQUEST[1200_403]','$_REQUEST[1200_404]','$_REQUEST[1200_405]','$_REQUEST[1200_406]','$_REQUEST[1200_407]','$_REQUEST[1200_408]','$_REQUEST[1200_409]','$_REQUEST[1200_410]', '$_REQUEST[1200_411]','$_REQUEST[1200_412]','$_REQUEST[1200_413]','$_REQUEST[1200_414]','$_REQUEST[1200_415]','$_REQUEST[1200_416]','$_REQUEST[1200_417]','$_REQUEST[1200_418]','$_REQUEST[1200_419]','$_REQUEST[1200_420]','$_REQUEST[1200_421]', '$_REQUEST[1230_401]','$_REQUEST[1230_402]','$_REQUEST[1230_403]','$_REQUEST[1230_404]','$_REQUEST[1230_405]','$_REQUEST[1230_406]','$_REQUEST[1230_407]','$_REQUEST[1230_408]','$_REQUEST[1230_409]','$_REQUEST[1230_410]', '$_REQUEST[1230_411]','$_REQUEST[1230_412]','$_REQUEST[1230_413]','$_REQUEST[1230_414]','$_REQUEST[1230_415]','$_REQUEST[1230_416]','$_REQUEST[1230_417]','$_REQUEST[1230_418]','$_REQUEST[1230_419]','$_REQUEST[1230_420]','$_REQUEST[1230_421]', '$_REQUEST[1300_401]','$_REQUEST[1300_402]','$_REQUEST[1300_403]','$_REQUEST[1300_404]','$_REQUEST[1300_405]','$_REQUEST[1300_406]','$_REQUEST[1300_407]','$_REQUEST[1300_408]','$_REQUEST[1300_409]','$_REQUEST[1300_410]', '$_REQUEST[1300_411]','$_REQUEST[1300_412]','$_REQUEST[1300_413]','$_REQUEST[1300_414]','$_REQUEST[1300_415]','$_REQUEST[1300_416]','$_REQUEST[1300_417]','$_REQUEST[1300_418]','$_REQUEST[1300_419]','$_REQUEST[1300_420]','$_REQUEST[1300_421]', '$_REQUEST[1330_401]','$_REQUEST[1330_402]','$_REQUEST[1330_403]','$_REQUEST[1330_404]','$_REQUEST[1330_405]','$_REQUEST[1330_406]','$_REQUEST[1330_407]','$_REQUEST[1330_408]','$_REQUEST[1330_409]','$_REQUEST[1330_410]', '$_REQUEST[1330_411]','$_REQUEST[1330_412]','$_REQUEST[1330_413]','$_REQUEST[1330_414]','$_REQUEST[1330_415]','$_REQUEST[1330_416]','$_REQUEST[1330_417]','$_REQUEST[1330_418]','$_REQUEST[1330_419]','$_REQUEST[1330_420]','$_REQUEST[1330_421]', '$_REQUEST[1400_401]','$_REQUEST[1400_402]','$_REQUEST[1400_403]','$_REQUEST[1400_404]','$_REQUEST[1400_405]','$_REQUEST[1400_406]','$_REQUEST[1400_407]','$_REQUEST[1400_408]','$_REQUEST[1400_409]','$_REQUEST[1400_410]', '$_REQUEST[1400_411]','$_REQUEST[1400_412]','$_REQUEST[1400_413]','$_REQUEST[1400_414]','$_REQUEST[1400_415]','$_REQUEST[1400_416]','$_REQUEST[1400_417]','$_REQUEST[1400_418]','$_REQUEST[1400_419]','$_REQUEST[1400_420]','$_REQUEST[1400_421]', '$_REQUEST[1430_401]','$_REQUEST[1430_402]','$_REQUEST[1430_403]','$_REQUEST[1430_404]','$_REQUEST[1430_405]','$_REQUEST[1430_406]','$_REQUEST[1430_407]','$_REQUEST[1430_408]','$_REQUEST[1430_409]','$_REQUEST[1430_410]', '$_REQUEST[1430_411]','$_REQUEST[1430_412]','$_REQUEST[1430_413]','$_REQUEST[1430_414]','$_REQUEST[1430_415]','$_REQUEST[1430_416]','$_REQUEST[1430_417]','$_REQUEST[1430_418]','$_REQUEST[1430_419]','$_REQUEST[1430_420]','$_REQUEST[1430_421]', '$_REQUEST[1500_401]','$_REQUEST[1500_402]','$_REQUEST[1500_403]','$_REQUEST[1500_404]','$_REQUEST[1500_405]','$_REQUEST[1500_406]','$_REQUEST[1500_407]','$_REQUEST[1500_408]','$_REQUEST[1500_409]','$_REQUEST[1500_410]', '$_REQUEST[1500_411]','$_REQUEST[1500_412]','$_REQUEST[1500_413]','$_REQUEST[1500_414]','$_REQUEST[1500_415]','$_REQUEST[1500_416]','$_REQUEST[1500_417]','$_REQUEST[1500_418]','$_REQUEST[1500_419]','$_REQUEST[1500_420]','$_REQUEST[1500_421]', '$_REQUEST[1530_401]','$_REQUEST[1530_402]','$_REQUEST[1530_403]','$_REQUEST[1530_404]','$_REQUEST[1530_405]','$_REQUEST[1530_406]','$_REQUEST[1530_407]','$_REQUEST[1530_408]','$_REQUEST[1530_409]','$_REQUEST[1530_410]', '$_REQUEST[1530_411]','$_REQUEST[1530_412]','$_REQUEST[1530_413]','$_REQUEST[1530_414]','$_REQUEST[1530_415]','$_REQUEST[1530_416]','$_REQUEST[1530_417]','$_REQUEST[1530_418]','$_REQUEST[1530_419]','$_REQUEST[1530_420]','$_REQUEST[1530_421]', '$_REQUEST[1600_401]','$_REQUEST[1600_402]','$_REQUEST[1600_403]','$_REQUEST[1600_404]','$_REQUEST[1600_405]','$_REQUEST[1600_406]','$_REQUEST[1600_407]','$_REQUEST[1600_408]','$_REQUEST[1600_409]','$_REQUEST[1600_410]', '$_REQUEST[1600_411]','$_REQUEST[1600_412]','$_REQUEST[1600_413]','$_REQUEST[1600_414]','$_REQUEST[1600_415]','$_REQUEST[1600_416]','$_REQUEST[1600_417]','$_REQUEST[1600_418]','$_REQUEST[1600_419]','$_REQUEST[1600_420]','$_REQUEST[1600_421]', '$_REQUEST[1630_401]','$_REQUEST[1630_402]','$_REQUEST[1630_403]','$_REQUEST[1630_404]','$_REQUEST[1630_405]','$_REQUEST[1630_406]','$_REQUEST[1630_407]','$_REQUEST[1630_408]','$_REQUEST[1630_409]','$_REQUEST[1630_410]', '$_REQUEST[1630_411]','$_REQUEST[1630_412]','$_REQUEST[1630_413]','$_REQUEST[1630_414]','$_REQUEST[1630_415]','$_REQUEST[1630_416]','$_REQUEST[1630_417]','$_REQUEST[1630_418]','$_REQUEST[1630_419]','$_REQUEST[1630_420]','$_REQUEST[1630_421]', '$_REQUEST[1700_401]','$_REQUEST[1700_402]','$_REQUEST[1700_403]','$_REQUEST[1700_404]','$_REQUEST[1700_405]','$_REQUEST[1700_406]','$_REQUEST[1700_407]','$_REQUEST[1700_408]','$_REQUEST[1700_409]','$_REQUEST[1700_410]', '$_REQUEST[1700_411]','$_REQUEST[1700_412]','$_REQUEST[1700_413]','$_REQUEST[1700_414]','$_REQUEST[1700_415]','$_REQUEST[1700_416]','$_REQUEST[1700_417]','$_REQUEST[1700_418]','$_REQUEST[1700_419]','$_REQUEST[1700_420]','$_REQUEST[1700_421]')"; But on submit from the feeding page, I get "Parse error: syntax error, unexpected T_STRING, expecting ']' in C:\xampp\htdocs\sched_board\schedboard4_posted.php on line 44 Line 44 is the line starting with VALUES ( This has to be a syntax error, but I cannot see anything (missing ' or anything like that) I include the 2 php files as well. Thanks in Advance [attachment deleted by admin]
-
premiso, Thanks - works like a charm. And "Read the Forum Rules, who knows you may learn how to post properly on PHP Freaks!" would not have helped. I had the browser opened and was called away for an extended time, came back and posted it, did not see it in the list afterwards. I thought I must have lost the connection, so I posted it again and later saw it in the list twice. What can I say, it's Friday! Thanks again. jej1216
-
[SOLVED] Include - issue with folder location of include file
jej1216 replied to jej1216's topic in PHP Coding Help
Thanks, Samshel Exactly what I needed. jej1216 -
Sorry - I double-posted this. I'm redoing some PHP code to put things like the Database info into an include file instead of putting the connect info in the main PHP page. I have it working, but only if I put the php file I want to include in a folder below where my main php resides. Here is my code that works: <?php include("includes/db.php"); ?> <?php $sql = "INSERT INTO my_table (field1, field2) VALUES ('$_REQUEST[field1]', '$_REQUEST[field2]')"; if (!mysql_query($sql,$db)) { die('Error: '.mysql_error()); } mysql_close($db); ?> I would prefer to put the 'includes' folder in a location that is 'beside' the folder that holds the main php file I am working on, not 'below' it. In other words, right now I have this folder structure: 1) htdocs b)-> main i.-> includes I want the structure to be 1) htdocs a)-> main b)-> includes when I move folder to where it is 'beside' the main folder I get this error: "Warning: include(includes/db.php) [function.include]: failed to open stream: No such file or directory in C:\xampp\htdocs\main\main.php " I can't figure out how to identify this folder location in my include line of code. I also tried <?php include("http://localhost/includes/db.php"); ?> and got this error: "Warning: include() [function.include]: URL file-access is disabled in the server configuration in C:\xampp\htdocs\main\main.php.... Warning: include(http://localhost/includes/db.php) [function.include]: failed to open stream: no suitable wrapper could be found in C:\xampp\htdocs\main\main.php.... Warning: include() [function.include]: Failed opening 'http://localhost/includes/db.php' for inclusion (include_path='.;C:\xampp\php\pear\') in C:\xampp\htdocs\main\main.php " I appreciate the help. jej1216
-
I'm redoing some PHP code to put things like the Database info into an include file instead of putting the connect info in the main PHP page. I have it working, but only if I put the php file I want to include in a folder below where my main php resides. Here is my code that works: <?php include("includes/db.php"); ?> <?php $sql = "INSERT INTO my_table (field1, field2) VALUES ('$_REQUEST[field1]', '$_REQUEST[field2]')"; if (!mysql_query($sql,$db)) { die('Error: '.mysql_error()); } mysql_close($db); ?> I would prefer to put the 'includes' folder in a location that is 'beside' the folder that holds the main php file I am working on, not 'below' it. In other words, right now I have this folder structure: 1) htdocs b)-> main i.-> includes I want the structure to be 1) htdocs a)-> main b)-> includes when I move folder to where it is 'beside' the main folder I get this error: "Warning: include(includes/db.php) [function.include]: failed to open stream: No such file or directory in C:\xampp\htdocs\main\main.php " I can't figure out how to identify this folder location in my include line of code. I also tried <?php include("http://localhost/includes/db.php"); ?> and got this error: "Warning: include() [function.include]: URL file-access is disabled in the server configuration in C:\xampp\htdocs\main\main.php.... Warning: include(http://localhost/includes/db.php) [function.include]: failed to open stream: no suitable wrapper could be found in C:\xampp\htdocs\main\main.php.... Warning: include() [function.include]: Failed opening 'http://localhost/includes/db.php' for inclusion (include_path='.;C:\xampp\php\pear\') in C:\xampp\htdocs\main\main.php " I appreciate the help. jej1216
-
I am not a PHP expert by any means, so here goes....... I have php code that successfully connects to a MySQL DB and writes the data to an Excel spreadsheet, thanks to a cool php I found called class-excel-xml.inc.php by Oliver Schwarz <oliver.schwarz@gmail.com>. By including this in my php, I got the data to load to an Excel spreadsheet. However, I need the column headers as well. I tried creating a different array to get the headers and putting it prior to the data array, but it did not work - I got the Header array values and the data array values output to the browser, not in an Excel. Here is my code taht correctly loads the data: <?php // include the php-excel class require (dirname (__FILE__) . "/class-excel-xml.inc.php"); $connection = mysql_connect("server", "id", "password"); mysql_select_db("database", $connection); $query = "SELECT * FROM incidents"; $result = mysql_query($query) or die($query . '<br>' . mysql_error()); $myarray = array(); while($row = mysql_fetch_array($result)) { $myarray[] = array($row['STAMP'], $row['incident_id'], $row['fac_id'], $row['room_descr'], $row['oth_descr'], $row['person_type'], $row['medrec_num'], $row['acct_num'], $row['person_name'], $row['person_lname'], $row['person_street'], $row['person_city'], $row['person_state'], $row['person_zip'], $row['person_phone'], $row['dob'], $row['inc_date'], $row['inc_time'], $row['fall_type'], $row['assisted'], $row['observe'], $row['fall_type2'], $row['assisted2'], $row['observe2'], $row['treat_var'], $row['med_var'], $row['pt_outcome'], $row['pt_outcome_oth'], $row['ni_type'], $row['pt_rights'], $row['near_miss'], $row['equip'], $row['environ'], $row['desc_oth'], $row['inc_descr'], $row['injury'], $row['inj_descr'], $row['rel_factor_fall'], $row['rel_factor_fall2'], $row['rel_factor_fall3'], $row['rel_factor_fall4'], $row['rel_factor_meds'], $row['rel_factor_oth'], $row['severity'], $row['not_type'], $row['note_oth'], $row['not_time'], $row['not_type2'], $row['note2_oth'], $row['not_time2'], $row['not_type3'], $row['note3_oth'], $row['not_time3'], $row['not_type4'], $row['note4_oth'], $row['not_time4'], $row['witness1_type'], $row['witness1_name'], $row['witness1_street'], $row['witness1_city'], $row['witness1_st'], $row['witness1_zip'], $row['witness1_phone'], $row['witness2_type'], $row['witness2_name'], $row['witness2_street'], $row['witness2_city'], $row['witness2_st'], $row['witness2_zip'], $row['witness2_phone'], $row['reporting_name'], $row['reporting_id'], $row['reporting_date'], $row['assess_ortho'], $row['rescore_morse'], $row['det_contrib'], $row['id_rec_medment'], $row['req_pharm_review'], $row['rev_curr_int'], $row['id_add_int'], $row['addr_bwlblddr'], $row['assure_safety_equip'],$row['id_env_issues'], $row['id_learn_pref'], $row['comm_team'], $row['comm_fam'], $row['notify_attending'], $row['comm_name'], $row['actions_descr'], $row['followup_descr'], $row['rm_severity'], $row['notified_ceo'], $row['not_ceo_datetime'], $row['notified_ho'], $row['not_ho_datetime'], $row['notified_plant'], $row['not_plant_datetime'], $row['notified_food'], $row['not_food_datetime'],$row['notified_attending'],$row['not_sattending_datetime'], $row['notified_ins'], $row['not_ins_datetime'], $row['notified_pharm'], $row['not_pharm_datetime'], $row['notified_dno'], $row['not_dno_datetime'], $row['notified_dto'], $row['not_dto_datetime'], $row['notified_oth'], $row['not_oth_datetime'], $row['not_oth_descr'], $row['root_cause_an'], $row['rca_date'], $row['rm_name'], $row['rm_date'], $row['Done']); } // generate excel file $xls = new Excel_XML; $xls->addArray ( $myarray ); $xls->generateXML ( "incidents" ); ?> I tried adding a header array with this: <?php // include the php-excel class require (dirname (__FILE__) . "/class-excel-xml.inc.php"); $connection = mysql_connect("server", "id", "password"); mysql_select_db("database", $connection); $query = "SELECT * FROM incidents"; $result = mysql_query($query) or die($query . '<br>' . mysql_error()); $myheaderarray = array(); $myheaderarray [] = array('STAMP','incident_id','fac_id','room_descr','oth_descr','person_type','medrec_num','acct_num','person_name', 'person_lname','person_street','person_city','person_state','person_zip','person_phone','dob','inc_date', 'inc_time','fall_type','assisted','observe','fall_type2','assisted2','observe2','treat_var','med_var','pt_outcome', 'pt_outcome_oth', 'ni_type','pt_rights','near_miss','equip','environ','desc_oth','inc_descr','injury','inj_descr', 'rel_factor_fall', 'rel_factor_fall2','rel_factor_fall3','rel_factor_fall4','rel_factor_meds','rel_factor_oth', 'severity','not_type','note_oth','not_time','not_type2','note2_oth','not_time2','not_type3','note3_oth','not_time3', 'not_type4','note4_oth','not_time4','witness1_type','witness1_name','witness1_street','witness1_city','witness1_st', 'witness1_zip','witness1_phone','witness2_type','witness2_name','witness2_street','witness2_city','witness2_st', 'witness2_zip','witness2_phone','reporting_name','reporting_id','reporting_date','assess_ortho','rescore_morse', 'det_contrib','id_rec_medment','req_pharm_review','rev_curr_int','id_add_int','addr_bwlblddr','assure_safety_equip', 'id_env_issues','id_learn_pref','comm_team','comm_fam','notify_attending','comm_name','actions_descr','followup_descr', 'rm_severity','notified_ceo','not_ceo_datetime','notified_ho','not_ho_datetime','notified_plant','not_plant_datetime', 'notified_food','not_food_datetime','notified_attending','not_sattending_datetime','notified_ins','not_ins_datetime', 'notified_pharm','not_pharm_datetime','notified_dno','not_dno_datetime','notified_dto','not_dto_datetime','notified_oth', 'not_oth_datetime','not_oth_descr','root_cause_an','rca_date','rm_name','rm_date','Done'); $myarray = array(); while($row = mysql_fetch_array($result)) { $myarray[] = array($row['STAMP'], $row['incident_id'], $row['fac_id'], $row['room_descr'], $row['oth_descr'], $row['person_type'], $row['medrec_num'], $row['acct_num'], $row['person_name'], $row['person_lname'], $row['person_street'], $row['person_city'], $row['person_state'], $row['person_zip'], $row['person_phone'], $row['dob'], $row['inc_date'], $row['inc_time'], $row['fall_type'], $row['assisted'], $row['observe'], $row['fall_type2'], $row['assisted2'], $row['observe2'], $row['treat_var'], $row['med_var'], $row['pt_outcome'], $row['pt_outcome_oth'], $row['ni_type'], $row['pt_rights'], $row['near_miss'], $row['equip'], $row['environ'], $row['desc_oth'], $row['inc_descr'], $row['injury'], $row['inj_descr'], $row['rel_factor_fall'], $row['rel_factor_fall2'], $row['rel_factor_fall3'], $row['rel_factor_fall4'], $row['rel_factor_meds'], $row['rel_factor_oth'], $row['severity'], $row['not_type'], $row['note_oth'], $row['not_time'], $row['not_type2'], $row['note2_oth'], $row['not_time2'], $row['not_type3'], $row['note3_oth'], $row['not_time3'], $row['not_type4'], $row['note4_oth'], $row['not_time4'], $row['witness1_type'], $row['witness1_name'], $row['witness1_street'], $row['witness1_city'], $row['witness1_st'], $row['witness1_zip'], $row['witness1_phone'], $row['witness2_type'], $row['witness2_name'], $row['witness2_street'], $row['witness2_city'], $row['witness2_st'], $row['witness2_zip'], $row['witness2_phone'], $row['reporting_name'], $row['reporting_id'], $row['reporting_date'], $row['assess_ortho'], $row['rescore_morse'], $row['det_contrib'], $row['id_rec_medment'], $row['req_pharm_review'], $row['rev_curr_int'], $row['id_add_int'], $row['addr_bwlblddr'], $row['assure_safety_equip'],$row['id_env_issues'], $row['id_learn_pref'], $row['comm_team'], $row['comm_fam'], $row['notify_attending'], $row['comm_name'], $row['actions_descr'], $row['followup_descr'], $row['rm_severity'], $row['notified_ceo'], $row['not_ceo_datetime'], $row['notified_ho'], $row['not_ho_datetime'], $row['notified_plant'], $row['not_plant_datetime'], $row['notified_food'], $row['not_food_datetime'],$row['notified_attending'],$row['not_sattending_datetime'], $row['notified_ins'], $row['not_ins_datetime'], $row['notified_pharm'], $row['not_pharm_datetime'], $row['notified_dno'], $row['not_dno_datetime'], $row['notified_dto'], $row['not_dto_datetime'], $row['notified_oth'], $row['not_oth_datetime'], $row['not_oth_descr'], $row['root_cause_an'], $row['rca_date'], $row['rm_name'], $row['rm_date'], $row['Done']); } // generate excel file $xls = new Excel_XML; $xls->addArray ( $myheaderarray ); $xls->addArray ( $myarray ); $xls->generateXML ( "incidents" ); ?> But this outputs the information to the browser, not an Excel spreadsheet. Did I do the header array incorrectly or is there another way to do this? Should I upload the class-excel-xml.inc.php code to show what it does? TIA
-
[SOLVED] need to add an incremented value to a file name
jej1216 replied to jej1216's topic in PHP Coding Help
Perfect! Thanks! -
I have a process in a PHP page that creates a file, and it works fine: if ("$_REQUEST[severity]" == "Level1-No_Obvious_Harm") { $sevvar = "1"; } elseif ("$_REQUEST[severity]" == "Level2-Non-permanent_Harm") { $sevvar = "2"; } elseif ("$_REQUEST[severity]" == "Level3-Semi-permanent_Harm") { $sevvar = "3"; } elseif ("$_REQUEST[severity]" == "Level4-Major_Permanent_Harm") { $sevvar = "4"; } elseif ("$_REQUEST[severity]" == "Level5-Death") { $sevvar = "5"; } else { $sevvar = "Nada"; } $file = "notify/$sevvar".".$_REQUEST[fac_id]".".txt"; $handle = fopen($file, 'w'); fclose($handle); The name is based on a severity level data value and hospital name. I now need to increment the filename since it is possible to need more than one file with the same severity level and hospital. I see where autoincrementing a database field is covered in PHP, but what about autoincrementing a filename that is created by PHP? TIA, jej1216