Jump to content

dennismonsewicz

Members
  • Posts

    1,136
  • Joined

  • Last visited

Everything posted by dennismonsewicz

  1. Like it opens Excel but cannot open the actual XLS file. This saddens me
  2. ok so I have this slight problem: It worked, but when I try to open the file it physically does not open the file HAHA this is pretty funny. Any ideas on this?
  3. the file problem has been fixed, but it keeps looping the same sentence and it is only writing one record into the Excel sheet!
  4. ok I am not getting an error but I am getting this problem: It is looping the line of "data is write into hr.xls successfully" There is only one record recorded into the XLS file And the file is not over-writing the previous one. Here is my code: include "../includes/db_login.php"; include("../excel/excelwriter.inc.php"); $excel=new ExcelWriter(); $myArr=array("Id","Product","Company","Description","Web Address","Last Used","Where product was last use","Is product active or inactive?"); $excel->writeLine($myArr); $query = "SELECT * FROM $tablename"; $result = mysql_query( $query ); if(!$result) { die("Could not query the database: <br/>" . mysql_error()); } while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $id = $row['rowid']; $company = $row['company']; $product = $row['product']; $description = $row['description']; $web = $row['web']; $last = $row['last']; $used = $row['used']; $active = $row['active']; $myArr=array($id,$product,$company,$description,$web,$last,$used,$active); $excel->writeLine($myArr); $excel->close(); echo "data is write into hr.xls Successfully."; } $excel->send('hr');
  5. try replacing "question" with 'question'
  6. Rhodesa, is there a way to make the array's dynamic? I see where you can manually add them but how would I make them dynamic? Making them dynamic would probably be a lot easier to manage. -Dennis
  7. Yeah I actually need for this to be dynamic. I am trying to locate the documentation now, and can't seem to find out how to do that?
  8. Rhodesa, So in the below code I change the values of the $myArr variable array with the values of my header names from my DB table? <?php include("excelwriter.inc.php"); $excel=new ExcelWriter("myXls.xls"); if($excel==false) echo $excel->error; $myArr=array("Name","Last Name","Address","Age"); $excel->writeLine($myArr); $myArr=array("Sriram","Pandit","23 mayur vihar",24); $excel->writeLine($myArr); $excel->writeRow(); $excel->writeCol("Manoj"); $excel->writeCol("Tiwari"); $excel->writeCol("80 Preet Vihar"); $excel->writeCol(24); $excel->writeRow(); $excel->writeCol("Harish"); $excel->writeCol("Chauhan"); $excel->writeCol("115 Shyam Park Main"); $excel->writeCol(22); $myArr=array("Tapan","Chauhan","1st Floor Vasundhra",25); $excel->writeLine($myArr); $excel->close(); echo "data is write into myXls.xls Successfully."; ?>
  9. Try this website: http://www.w3schools.com/php/php_mysql_insert.asp
  10. Does anyone know how I can do a PHP export from a website into an excel spreadsheet? Example: My company intranet has a ton of data that is loaded into MySQL and one of the users of the intranet wants an export to excel function. So if they are looking at a table of data they can click on export to excel and it does it. Anyone know where to start? -Dennis
  11. Thanks for everyones help. I love this forum! One more question: How would I uppercase just the first letter of a word using php? Wouldn't it be like ucase($string)?
  12. Awesome! But now how would I capture the page a user is on?
  13. Ok... I want to be able to use the breadcrumb function in PHP but with a twist. Is there anyway to capture the page someone is one and display the breadcrumb backlinks capturing the page and stripping the .php from the page? Example: You are here: HOME > Users.php But I want to take the .php away from the Users.php to give the user this: You are here: HOME > Users
  14. This is probably a stupid question, but I was wondering if it is ok to use session variables in a SQL Query? Example: sql = "Select * From users Where username = " . $_SESSION['username'] . ";
  15. is there anyway you can include an example?
  16. I have a login script in place now for a company intranet, but I need to have a session timeout so after say like 30 minutes of no activity the user is logged out. Can anyone help with this? This is my login.php page: <p>To login, please fill out the form below with your given username and password</p> <div id="loginform"> <form name="form1" method="post" action="checklogin.php"> <table border="0" cellpadding="0" cellspacing="0" align="center"> <tr> <td>Username: </td> <td><input name="username" type="text" id="username" /></td> </tr> <tr> <td>Password: </td> <td><input name="password" type="password" id="password" /></td> </tr> <tr> <td colspan="2"><input type="image" src="../images/login.gif" class="submit" alt="Submit Changes" value="Login" /></td> </tr> </table> </form> </div> Do I need to pass a hidden input somehow recording the time of login? This is my checklogin.php page: ob_start(); include "includes/db_login.php"; // username and password sent from signup form $username = $_POST['username']; $password = $_POST['password'] $sql="SELECT * FROM users WHERE username='$username' and password='$password'"; $result=mysql_query($sql) or die(mysql_error()); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $username and $password, table row must be 1 row if($count==1){ // Register $username, $password and redirect to file "login_success.php" session_register("username"); session_register("password"); header("location: http://intranet.healthresources.net/index.php"); } else { include "includes/header.php"; echo "<p>Wrong Username or Password</p>"; echo "<p><a href='index.php'>Try Again?</a></p>"; include "includes/footer.php"; } ob_end_flush(); All help is greatly appreciated, Dennis
  17. Sorry bout my previous post... I reckon i didn't understand ya. Ok... I know how to do what you are talking about. Let me look at some code I have written and get back with you
  18. Try the site below. http://www.w3schools.com/sql/func_count.asp
  19. yeah...you are going to have to pass the table names in the URL. Or at least thats how i did it. so your URL would like something like this: http://www.yoursitename.com/form.php?table=tablename your code: $var = $_GET['table']; $query = "SELECT * FROM " . $var . " ; Or something to that effect. This could extremely "hairy" LOL!
  20. For your query statements you are going to need to look into the UNION SQL Command
  21. try placing all of your closing brackets in the last open and closing PHP tags
×
×
  • 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.