Jump to content

BigD

Members
  • Posts

    75
  • Joined

  • Last visited

Everything posted by BigD

  1. BigD

    different behavior

    Jsg, How do you find PHP version number?I went to myPHP admin panel and it showed PHP 3.x.x.x.
  2. BigD

    different behavior

    Folks, I resolved all the problems and got everything working on remote server. Let me tell you what I did.my local server has version 3.3.9 and remote server has version 3.4.10.1 I do not know it is the software versiondifferences or the PHP variables value differences; they behave differently.I did not change any PHP variable values.On remote server, goto causes syntax error, echo causes header() not transfer control, it is case sensitive on panel names.error goes to error-log, not screen.I modified my code to make it work on remote server.If you know what causes those behavior on remote server, please share it.This is a great place to work issues. Thanks folks.
  3. BigD

    different behavior

    I captured PHP variables/values on both home pc local PHP adm and web server. I plan to change home PC PHP values to be the same as web serverso problems on remote can be tested locally. I am not experienced on PHP. Anyone have done similar things please advise. Does ini file need to be the same? Thanks.
  4. BigD

    different behavior

    I have another piece code using the same logic, This one passed control to another panel.<?phpsession_start();include ("../mylibrary/login.php");login();$userid = $_POST['userid'];$password = $_POST['password'];//echo "<h2> userid is $userid</h2>\n";//echo "<h2> password is $password</h2>\n";$query = "SELECT userid from admins where userid = '$userid' and password = PASSWORD('$password')";//echo "SQL $query\n";//$query = "SELECT userid, firstname from admins where userid = '$userid' and password = '$password'";//echo "SQL $query\n";$result = mysql_query($query);if (mysql_num_rows($result) == 0){ echo "<h2>Sorry, your account was not validated.</h2><br>\n"; echo "<a href=\"admin.php\">Try again</a><br>\n";} else{ $_SESSION['store_admin'] = $userid; header("Location: admin.php");}?>
  5. BigD

    different behavior

    I changed code as suggested, it echoed where it was but the 2 lines added at the beginning did not produce any debug info. Is there another way to go to another panel after displaying "going to next panel"? <?phpini_set('display_errors', '1');ini_set('error_reporting', 'E_ALL');session_start();include ("mylibrary/login.php");login();$userid = $_POST['userid'];$password = $_POST['password'];echo "<h2> userid is $userid</h2>\n";echo "<h2> password is $password</h2>\n";//*********$query = "SELECT stdid, firstname from student where userid = '$userid' and password = PASSWORD('$password')";$query = "SELECT stdid, classid, lastname, firstname from student where userid = '$userid' and password = '$password'";$result = mysql_query($query);if (mysql_num_rows($result) == 0){ echo "<h2>Sorry, your account was not validated.</h2><br>\n"; echo "<a href=\"std.php\">Try again</a><br>\n";} else{ echo "Going to next panel<br>"; $_SESSION['store_admin'] = $userid; header("Location: std.php");}?>
  6. Enjoyed the comics. Yes goto should be discouraged to use, but there are times it is the simplest thing and the right thing to do. Can you share what the unexpected result might be?
  7. Krewe, you answered my question. It works. Thanks.
  8. BigD

    different behavior

    There are other pieces PHP code worked on home PC but just sits there on server PC, no errors displayed. Anyone noticed there are differences when code is running on remote server?
  9. BigD

    different behavior

    On my home PC server I did not get Headers already sent error, it just brought up std.php."values in the POST array are treated as strings" does not cause a probelm, why making the change?
  10. BigD

    different behavior

    My code ran ok on my PC, ran differently after I uploaded to web server. The code checks if user in database. brings up std.php if it is.On web server it passed the check but failed to bring up std.php. it just sits there. <?phpsession_start();include ("mylibrary/login.php");login();$userid = $_POST['userid'];$password = $_POST['password'];$query = "SELECT stdid, classid, lastname, firstname from student where userid = '$userid' and password = '$password'";$result = mysql_query($query);if (mysql_num_rows($result) == 0){ echo "<h2>Sorry, your account was not validated.</h2><br>\n"; echo "<a href=\"std.php\">Try again</a><br>\n";} else{ $_SESSION['store_admin'] = $userid; header("Location: std.php");}?>
  11. For Scout: I got it. Problem was due to the PHP coding. Thanks Scout.
  12. Question for Scout: I tried your code and it worked.When I tried to incorporate that into my code, I got syntext error. It did not like the curly bracket after the table in style section. I have 2 styles, did I do it wrong?<?php//header("Pragma: no-cache");//header("Expires: 0");/*<head><style>@page { size 8.5in 11in; margin: 2cm }div.page { page-break-after: always }</style><style type="text/css"> /*<![CDATA[*/table{ width:40%; border:3px solid black; float:left; margin-left:5%;}td{ border:1px dotted black;} /*]]>*/ </style></head>?>
  13. I attached a screen snapshot to my first post. Some how as I look at it now, it did not show correctly.What I meant was: From the web page generated by the code, I do a file > Print Preview, Only the first table can be seen, other tables are ant-sized.
  14. Yes. Thanks.What does table{} in style do? Without that tables will lay top to bottom. What does this do /*<![CDATA[*/ ?
  15. I changed code to use mysql_affected_rows(), it should 0 rows affected. The search Key on Update SQL is exactly the same key on SELECT SQL. I am still puzzled why Update did not update. No SQL_error though. just no update.
  16. The page should not have the Links, "Was your browser sandboxed when you did the download?" Sorry I do not know what does that mean. During download I did not Virus check (Do not know how).I removed downloaded S/W and Virus scanned using MS Security Essential quick scan, no virus found.The changes is not just on that page. It add links when I open emails and do anything on my computer.
  17. Can someone please show code to lay 2 tables horizontally ? Thanks.
  18. This is my code that has 5 tables on a page. How do I prevent tables been shrinked? Only 1st table is readable on print preview.echo "<table width=\"70%\" cellpadding=\"1\" border=\"1\">\n"; echo "<tr><td><div align=\"center\">Massage Therapy Technique(Written)</div></td>\n"; echo "<td><div align=\"center\">$grade</div></td></tr>\n"; echo "<tr><td><div align=\"center\">Massage Therapy Technique(pratical)</div></td>\n"; echo "<td><div align=\"center\">$mttp</div></td></tr>\n"; echo "<tr><td><div align=\"center\">Anatomy,Physiology & Pathology</div></td>\n"; echo "<td><div align=\"center\">$avggrade</div></td></tr>\n"; echo "<tr><td><div align=\"center\">Human Anatomy</div></td>\n"; echo "<td><div align=\"center\">$avggrade</div></td></tr>\n"; echo "<tr><td><div align=\"center\">Human Pathology</div></td>\n"; echo "<td><div align=\"center\">$avggrade</div></td></tr>\n"; echo "<tr><td><div align=\"center\">Human Physiology</div></td>\n"; echo "<td><div align=\"center\">$avggrade</div></td></tr>\n"; echo "<tr><td><div align=\"center\">Kinesiology</div></td>\n"; echo "<td><div align=\"center\">$avggrade</div></td></tr>\n"; echo "<tr><td><div align=\"center\">Business Practice and Professional Ethics</div></td>\n"; echo "<td><div align=\"center\">$avggrade</div></td></tr>\n"; echo "<tr><td><div align=\"center\">Human Health & Hygiene / CPR / SFA</div></td>\n"; echo "<td><div align=\"center\">$grade</div></td></tr>\n"; echo "<tr><td><div align=\"center\">Hydrotherapy</div></td>\n"; echo "<td><div align=\"center\">$avggrade</div></td></tr>\n"; echo "</table>\n";echo "<table width=\"60%\" height = \"20\" cellpadding=\"1\" border=\"1\">\n"; echo "<tr><td><div align=\"center\">Required Classroom Hours:</div></td>\n"; echo "<td><div align=\"center\">$rhrs</div></td></tr>\n"; echo "<tr><td><div align=\"center\">Hours Attended to Date:</div></td>\n"; echo "<td><div align=\"center\">$ett</div></td></tr>\n"; echo "<tr><td><div align=\"center\">Make-up Hours Needed:</div></td>\n"; echo "<td><div align=\"center\">$ntt</div></td></tr>\n"; echo "</table>\n";echo "<table width=\"100%\" cellpadding=\"1\" border=\"1\">\n"; echo "<tr><td><div align=\"left\">Probationary Action Taken:</div></td></tr>\n"; echo "<tr><td>______________________________________________________________</td></tr>\n"; echo "<tr><td>______________________________________________________________</td></tr>\n"; echo "<tr><td>______________________________________________________________</td></tr>\n"; echo "</table>\n";echo "<table width=\"100%\" cellpadding=\"1\" border=\"1\">\n"; echo "<tr><td><div align=\"left\">General Comments:</div></td></tr>\n"; echo "<tr><td></td></tr>\n"; echo "<tr><td></td></tr>\n"; echo "<tr><td></td></tr>\n"; echo "</table>\n";echo "<table width=\"100%\" cellpadding=\"1\" border=\"1\">\n"; echo "<tr><td><div align=\"left\">Student's Signature:</div></td>\n"; echo "<td><div align=\"left\">Instructor's Signature:</div></td></tr>\n"; echo "<tr><td></td><td></td></tr>\n"; echo "</table>\n"; echo '<div class="page"> </div>'."\n"
  19. Yes. Do not know why but now the report2.pdf can be viewed with the right contents. and printed ok. I did not change anything.One small problem. It produces 5 pages with blank 1st and 5th page, real report on pages 2-4.
  20. I ran a short version of code and created report2.htm. Right Clicked it, select print, select CutePDF Writer as printer, clicked print.On save as panel I used report2.pdf as file name.This file can not be opened by Acrobat reader. When sent to printer it printed pages of garbage. Here is the function that was called to generate the file:<head><style>@media print{.page { page-break-after: always; height:1px;font-size:0; line-height:0; } }</style></head><?php function shortpage($fname, $lname, $eval, $bdate, $edate, $classid, $stdid,$ofile){header("Content-type: application/vnd.ms-word");header("Content-Disposition: attachment; filename=$ofile.htm");?><html><body><?phpecho "<div align=\"center\"> School of Massage</div></br>";echo "<div align=\"center\">17043 El Camino Real, Suite 201 ~ Houston, Texas 77058 ~ </div></br>";echo "<div align=\"center\">PROGRESS REPORT</h3></br>";echo "<table width=\"100%\" cellpadding=\"1\" border=\"1\">\n"; echo "<tr><td><div align=\"center\">Massage Therapy Technique(Written)</div></td>\n"; echo "<td><div align=\"center\">$fname</div></td></tr>\n"; echo "<tr><td><div align=\"center\">Massage Therapy Technique(pratical)</div></td>\n"; echo "<td><div align=\"center\">$eval</div></td></tr>\n"; echo "</table>\n";echo "<table width=\"100%\" cellpadding=\"1\" border=\"1\">\n"; echo "<tr><td><div align=\"center\">Required Classroom Hours:</div></td>\n"; echo "<td><div align=\"center\">$bdate</div></td></tr>\n"; echo "<tr><td><div align=\"center\">Hours Attended to Date:</div></td>\n"; echo "<td><div align=\"center\">$edate</div></td></tr>\n"; echo "<tr><td><div align=\"center\">Make-up Hours Needed:</div></td>\n"; echo "<td><div align=\"center\">$ofile</div></td></tr>\n"; echo "</table>\n"; echo '<div class="page"> </div>'."\n"; //echo "<br clear='all' style='page-break-after:always'/>";echo "</div>";echo "</body>";echo "</html>";}?>
  21. I used a select statement and found a record in DB, When I tried to update the record, returned 0 rows and not updated. Here is the code. Please help.$query="SELECT classtype,startdate,enddate,classstatus from class where classname = '$classnameval'"; $result = mysql_query($query); echo "select class sql $query</br>"; $num_rows = mysql_num_rows($result); if (!$num_rows) { echo nl2br("Class $classname not in DB\n"); goto bye; } if ($result) { $row = mysql_fetch_array($result, MYSQL_ASSOC); $classtypeo = $row['classtype']; $classstatuso = $row['classstatus']; $sdateo = $row['startdate']; $edateo = $row['enddate']; echo "<h2>Class '$classname' found</h2>\n";var_dump($classstatuso,$sdateo,$edateo,$classtypeo); } else { echo "<h2>Sorry, unable to change class $classname </h2>\n"; goto bye; }var_dump($classstatusval,$sdate,$edate,$classtype); if ($classstatusval == '') $classstatusval = $classstatuso; if ($classtype == '') $classtype = $classtypeo; if ($edate == '') $edate = $edateo; if ($sdate == '') $sdate = $sdateo; $query="UPDATE class SET classstatus = '$classstatusval', startdate = '$sdate', enddate = '$edate', classtype = '$classtype', where classname = '$classnameval'"; $result = mysql_query($query); echo "update class sql $query</br>"; $num_rows = mysql_num_rows($result); if (!$num_rows)// if (!$mysql_num_rows($result)) { echo nl2br("Class $classname not in DB\n"); goto bye; }
  22. I write code for a school. Today someone changed my screen layout. Happened after I downloaded Soda PDF 3D Reader software. my screen attached. Classes and Graduates changed color, becaome clickable anchor and will re-direct to some site. My code generated the screen remains the same. Anyone seeing this before?
  23. Is this how I use page break Dsonesuk?<head><style>@media print{div.page { page-break-after: always } }</style></head><?phpecho "<div>";// someloop started here {echo "<table width=\"100%\" cellpadding=\"1\" border=\"1\">\n"; echo "<tr><td><div align=\"center\">Required Classroom Hours:</div></td>\n"; echo "<td><div align=\"center\">$mttw</div></td></tr>\n"; echo "<tr><td><div align=\"center\">Hours Attended to Date:</div></td>\n"; echo "<td><div align=\"center\">$mttw</div></td></tr>\n"; echo "<tr><td><div align=\"center\">Make-up Hours Needed:</div></td>\n"; echo "<td><div align=\"center\">$mttw - $mttw</div></td></tr>\n"; echo "</table>\n"; // ??????I want a pagebreak here echo "<page>"; } echo "</div>";echo "</body>";echo "</html>";?>
  24. I created a test.php. When IE browser went to open it, got this error:Fatal error: Call to undefined function PDF_new() in C:\wamp\www\mschool\admin\test.php on line 2Here is test.php:<?php$p = PDF_new();/* open new PDF file; insert a file name to create the PDF on disk */if (PDF_begin_document($p, "", "") == 0) { die("Error: " . PDF_get_errmsg($p));}PDF_set_info($p, "Creator", "hello.php");PDF_set_info($p, "Author", "Rainer Schaaf");PDF_set_info($p, "Title", "Hello world (PHP)!");PDF_begin_page_ext($p, 595, 842, "");$font = PDF_load_font($p, "Helvetica-Bold", "winansi", "");PDF_setfont($p, $font, 24.0);PDF_set_text_pos($p, 50, 700);PDF_show($p, "Hello world!");PDF_continue_text($p, "(says PHP)");PDF_end_page_ext($p, "");PDF_end_document($p, "");$buf = PDF_get_buffer($p);$len = strlen($buf);header("Content-type: application/pdf");header("Content-Length: $len");header("Content-Disposition: inline; filename=hello.pdf");print $buf;//PDF_delete($p);?>
  25. I am not sure I should post it here or at CSS forum, here is the questionI have a html file with 2 sets of info in it. is there a way to have each set on one page when I sent it to a printer? <html><head><title>Title of the document1</title></head> <body>The content of the document1......</body> </html> <html><head><title>Title of the document12</title></head> <body>The content of the document12......</body> </html>
×
×
  • Create New...