dennismonsewicz
Members-
Posts
1,136 -
Joined
-
Last visited
Everything posted by dennismonsewicz
-
yes it would involve php... your inputs would be saved into an array so that php can parse the data. <input type="text" name="distance[]" /> Notice the brackets after the name
-
Live update of Excel Spreadsheet
dennismonsewicz replied to dennismonsewicz's topic in PHP Coding Help
Well I have created a project board for the company i work for and they have an option to export the projects out to an excel spreadsheet and i was wondering if there was a way that all they had to do was download the spreadsheet one time and then it automatically update? anyway of doing this? -
Is there anyway to do a live update of an Excel Spreadsheet using php/mysql?
-
you would need to do this using javascript this way the add button does not have to reload the page
-
[SOLVED] different excel output problem
dennismonsewicz replied to dennismonsewicz's topic in PHP Coding Help
topic solved! I went back and reverted to using mysql_fetch_array -
try this window.location="outlands_move.php?step=up&id=<?php echo $id; ?>"
-
[SOLVED] Passing key pairs into a function
dennismonsewicz replied to SiC_Goat's topic in PHP Coding Help
you could possibly use a foreach loop http://us3.php.net/manual/en/control-structures.foreach.php -
[SOLVED] different excel output problem
dennismonsewicz replied to dennismonsewicz's topic in PHP Coding Help
bump -
[SOLVED] different excel output problem
dennismonsewicz replied to dennismonsewicz's topic in PHP Coding Help
ok i have almost got it figured out... i have a new problem now code: <?php $name = "projectlist"; $excel=new ExcelWriter(); $myArr=array("Id","Project","Project Id","PM","Designer","PM","Writer","PM","Designer","PM","Christine","PM","Designer","PM","Julie","PM","Designer","PM","Proofreading","PM","Layne","PM","Programming","PM","Testing"); $excel->writeLine($myArr); $val_qry = mysql_query("SELECT * FROM has_had_projects")or die(mysql_error()); while($num_rows = mysql_fetch_object($val_qry)) { $arr[] = $num_rows->id; $arr[] = $num_rows->project; $arr[] = $num_rows->project_id; $arr[] = $num_rows->pm1; $arr[] = $num_rows->designer1; $arr[] = $num_rows->pm2; $arr[] = $num_rows->writer; $arr[] = $num_rows->pm3; $arr[] = $num_rows->designer2; $arr[] = $num_rows->pm4; $arr[] = $num_rows->christine; $arr[] = $num_rows->pm5; $arr[] = $num_rows->designer3; $arr[] = $num_rows->pm6; $arr[] = $num_rows->julie; $arr[] = $num_rows->pm7; $arr[] = $num_rows->designer4; $arr[] = $num_rows->pm8; $arr[] = $num_rows->proofreading; $arr[] = $num_rows->pm9; $arr[] = $num_rows->layne; $arr[] = $num_rows->pm10; $arr[] = $num_rows->programming; $arr[] = $num_rows->pm11; $arr[] = $num_rows->testing; } $excel->writeLine($arr); $excel->send($name); ?> When I dump out the results and run the script I get an excel spreadsheet but the results are displayed on one row instead of individual rows... any ideas on how to fix this? -
[SOLVED] different excel output problem
dennismonsewicz replied to dennismonsewicz's topic in PHP Coding Help
well the code browser didn't like that very much... it created an infinite loop! -
I have this code: <?php $field_qry = mysql_query("SELECT * FROM has_had_projects")or die(mysql_error()); $field = mysql_num_fields($field_qry); while($row = mysql_fetch_array($field_qry)) { for($i = 0; $i < $field; $i++) { $names = mysql_field_name($field_qry, $i); $numbers = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 0); $myArr[] = str_replace($numbers, '', $names); } } $excel=new ExcelWriter(); $excel->writeLine($myArr); $val_qry = mysql_query("SELECT * FROM has_had_projects")or die(mysql_error()); $count_rows = mysql_num_fields($val_qry); while($numbered_rows = mysql_fetch_array($val_qry)) { for($i = 0; $i < $count_rows; $i++) { $arr[] = $numbered_rows[$i]; } } $excel->writeLine($arr); $excel->send('has_had_projects'); ?> It works fine if there is just one record in the DB but as soon as there is two or more records the $myArr var is repeated across the top of the spreadsheet instead of just adding a new row of data. Did that make sense?
-
problem solved! updated working code: $who_qry = mysql_query("SELECT * FROM has_had_projects")or die(mysql_error()); $field = mysql_num_fields($who_qry); while($row = mysql_fetch_assoc($who_qry)) { for($i = 3; $i < $field; $i++) { $names = mysql_field_name($who_qry, $i); $numbers = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 0); $title[] = str_replace($numbers, '', $names); } } $excel=new ExcelWriter(); $excel->writeLine($title); $excel->send('has_had_projects');
-
bump
-
Display highest value from database question
dennismonsewicz replied to Ashikaa's topic in PHP Coding Help
thats right sorry... I mixed myself up there. I thought about that after I posted it just didn't get a chance to clean it up. Thanks Disco -
Display highest value from database question
dennismonsewicz replied to Ashikaa's topic in PHP Coding Help
you could change your SQL statement to look like this $result = mysql_query("SELECT * FROM table_name ORDER BY Score DESC LIMIT 3"); The DESC sorts the query from the last record to the first... now this is only a quick fix as long as your biggest record is the last record in the database -
Code: $who_qry = mysql_query("SELECT * FROM has_had_projects")or die(mysql_error()); $field = mysql_num_fields($who_qry); while($row = mysql_fetch_assoc($who_qry)) { for($i = 3; $i < $field; $i++) { $names = mysql_field_name($who_qry, $i); $numbers = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 0); $title[] = str_replace($numbers, '', $names); } } $excel=new ExcelWriter(); foreach ($title as $t) { $excel->writeLine($t); } $excel->send('has_had_projects'); When I run the code and download the file the spreadsheet is empty any ideas?
-
so i would just rename the session after it has already registered?
-
well with the session_destroy how do you detect when a user navigates away from the page/closes the browser/closes the tab?
-
I have a programmed a couple of sites that use sessions for the login script... the problem is, is if I login to one site and begin the session and go to another site the session is still there and it acts like i am logged in... any way around this issue?
-
Play Sound When clicking an Image
dennismonsewicz replied to Orionsbelter's topic in PHP Coding Help
little orphan annie called... the sun will not come out tomorrow! Any takers? -
now its not even printing the names updated code: $who_qry = mysql_query("SELECT * FROM has_had_projects")or die(mysql_error()); $field = mysql_num_fields($who_qry); while($row = mysql_fetch_assoc($who_qry)) { for($i = 3; $i < $field; $i++) { $names = mysql_field_name($who_qry, $i); $numbers = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 0); $title[] = str_replace($numbers, '', ucwords($names . ',')); } } $excel=new ExcelWriter(); foreach ($title as $t) { $excel->writeLine($t); }
-
bump
-
Check Box to store into MySQL database
dennismonsewicz replied to phpapprentice's topic in PHP Coding Help
sorry use it like this (forget the tags) <?php $con = mysql_connect("localhost","mydatabase","mypassword"); if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("noyce", $con); $food = join (', ', $_POST['food']); $sql="INSERT INTO Persons (FirstName, LastName, Age, gender, food) VALUES ('$_POST[firstname]','$_POST[lastname]','$_POST[age]','$_POST[gender]','$food')";if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "1 record added";mysql_close($con) ?> -
Check Box to store into MySQL database
dennismonsewicz replied to phpapprentice's topic in PHP Coding Help
using barand's code use it like this: <?php $con = mysql_connect("localhost","mydatabase","mypassword"); if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("noyce", $con); [color=red]$food = join (', ', $_POST['food']); [/color] $sql="INSERT INTO Persons (FirstName, LastName, Age, gender, food) VALUES ('$_POST[firstname]','$_POST[lastname]','$_POST[age]','$_POST[gender]','[color=red]$food[/color]')";if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "1 record added";mysql_close($con) ?> -
Check Box to store into MySQL database
dennismonsewicz replied to phpapprentice's topic in PHP Coding Help
change every one of your checkbox inputs to look something like this <input type="checkbox" name="food[]" value="pizza"/> Notice the brackets ([]) after the word food Then just post them like this $food = $_POST['food'];