Jump to content

hitman6003

Members
  • Posts

    1,807
  • Joined

  • Last visited

Everything posted by hitman6003

  1. echo out your query so you can see what it is that is causing the problem.
  2. http://www.php.net/mysqli When in doubt....look in the manual
  3. Depending on the method of sending the data, GET or POST, you can use: [code]$loginID = $_GET['loginID' . $n]; or $lognID = $_POST['loginID' . $n];[/code] Where $n is an int.
  4. change this: [code]$uResult = mysql_query($uSql, $connection);[/code] to this: [code]$uResult = mysql_query($uSql, $connection) or die(mysql_error());[/code] Your query may not be returning any results.  You may also want to echo it out, then put it into your mysql administration tool of choice and ensure that rows are being returned.
  5. If you want it to be smaller than 500 px, wouldn't it be: [code]if ($ImportWidth >= 500)[/code] and the list line should be: [code]list($ImportWidth,$ImportHeight,$ImageMimeType) = getimagesize($_FILES['uploaded']['tmp_name']) ;[/code] not $_FILES['uploaded']['name'].
  6. are you wanting to display all of the images in a directory?
  7. You were not assigning the result of the query to a variable: [code]<?php include '../db_connect.php'; $uSql = "SELECT product_image, product_name, product_desc, product_type, product_price FROM products WHERE product_id= '" . $_GET['product_id'] . "'"; $uResult = mysql_query($uSql, $connection) or die("Error: ". mysql_error(). " with query ". $uSql); $uRow = mysql_fetch_array($uResult); ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <link href="../CSS.css" rel="stylesheet" type="text/css"> <style type="text/css"> <!-- body {   margin-left: 0px;   margin-top: 0px;   margin-right: 0px;   margin-bottom: 0px;   background-color: #E7E7DD; } --> </style></head> <body> <table width="500" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="18" align="center"> <table width="408" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="408" align="center">You have ordered </td> </tr> <tr> <td align="center"> <table width="36" border="1" cellpadding="0" cellspacing="0" bordercolor="#666666"> <tr> <td width="32" align="center"><img src="../images/products/thumbs/<?= $uRow[0]?>.jpg"></td> </tr> </table> </td> </tr> <tr> <td><img src="../images/spacer.gif" width="4" height="4"></td> </tr> <tr> <td bg bgcolor="#E14B19"><img src="../images/spacer.gif" width="4" height="1"></td> </tr> <tr> <td><img src="../images/spacer.gif" width="4" height="4"></td> </tr> <tr> <td align="center"><?php echo $uRow[1]; ?></td> </tr> <tr> <td align="center"><?php echo $uRow[2]; ?></td> </tr> <tr> <td align="center"><?php echo $uRow[3]; ?></td> </tr> <tr> <td><img src="../images/spacer.gif" width="4" height="4"></td> </tr> <tr> <td bg bgcolor="#E14B19"><img src="../images/spacer.gif" width="4" height="1"></td> </tr> <tr> <td><img src="../images/spacer.gif" width="4" height="4"></td> </tr> <tr> <td>&nbsp;</td> </tr> <tr> <td>&nbsp;</td> </tr> <tr> <td>&nbsp;</td> </tr> <tr> <td>&nbsp;</td> </tr> </table> </td> </tr> </table> </body> </html>[/code]
  8. If any data has been sent to the browser...spaces, new lines, whatever...then a header can not be sent...they must be the first thing the browser receives.
  9. If your format will always be dd-mm-yyyy: [code]$startdate = explode("-", $_POST['data1']); $enddate = explode("-", $_POST['data2']); $days = floor((mktime(null, null, null, $enddate[1], $enddate[0], $enddate[2]) - mktime(null, null, null, $startdate[1], $startdate[0], $startdate[2])) / 86400); echo $days . " days difference between " . $_POST['data1'] . " and " . $_POST['data2'];[/code]
  10. == is php's equality operator.  Use a single = in SQL.
  11. If you use my code, do a count on $_POST['input'], then a for loop, or do a foreach loop on the same array. If you use Barand's code, do a count on either $_POST['descrip'] or $_POST['cb'], then do a for loop to get the matching elements from each.
  12. It's saying that the file db.php has output something to the browser.  Make sure that it's not...meaning no echos, prints, etc.  Also, having [code]<?php some code here.... ?> <?php ...some more code ?>[/code] will output a newline to the browser, which will throw off the header.
  13. change: [code]<?=$PHP_SELF?>[/code] to: [code]<?php echo $_SERVER['PHP_SELF']; ?>[/code]
  14. [code]<?php require_once('odbc.php'); if ($_POST) { $lname=$_POST['LastName']; $fname=$_POST['FirstName']; $dob=$_POST['DOB']; $query = "SELECT * from tblPatient"; if (isset($_POST['select']) { $query .= " WHERE id = '" . $_POST['select'] . "'"; } else { if ( $_POST['LastName'] != "") { $where[] = "LastName LIKE '%$lname%'"; } if ( $_POST['FirstName'] != ""){ $where[] = "FirstName LIKE '%$fname%'"; } if ($_POST['DOB'] != ""){ $where[] = "DOB LIKE '%$dob%'"; } if (count($where) > 0) { $query .= " WHERE " . implode(" AND ", $where); } } $result = odbc_exec($odbc, $query) or die (odbc_errormsg()); if (odbc_num_rows($result) > 1) { $select = '<select name="select" size="1">'; while ($row = odbc_fetch_array($result)) { $select .= '<option value="' . $row['PatientID'] . '">' . $row['LastName'] . ', ' . $row['FirstName'] . ' - ' . $row['DOB'] . '</option>'; } $select .= '</select>'; } else { $row = odbc_fetch_array($result); } } ?> <form method="post"> <table width="1000" border="1" align="center" cellpadding="2"> <tr> <td colspan="8"><div align="center"><b>Patient Information</b></div></td> </tr> <?php if ($select != "") { echo ' <tr> <td>Please select a patient to edit:</td> <td>' . $select . '</td> </tr> <tr> <td colspan="8" style="text-align: center;"><input type="submit" name="submit" value="Display"></td> </tr>'; } ?> <tr> <td width="100"><div align="right">LName</div></td> <td width="150"><input type="text" name="LastName" value="<?php echo $row['LastName']; ?>"></td> </tr> ... rest of form inputs in same format ... </table>[/code]
  15. supply the connection name...looks like "$link" so it should be: [code]$result= mysqli_query($link, $select) or die(mysqli_error($link));[/code]
  16. The easiest way is to have your form fields follow a specific naming convention: [code]Description: <input type="text" name="input[1][description]" size="25"/> Checkbox: <input type="checkbox" name="input[1][checkbox]" value="somevalue" />[/code] Increment the number after the input (i.e. the next one would be input[2][description] etc.) for each set. Which will generate, on POST, a multidimensional array that you can then yeild all of your information from.
  17. change this line: [code]$result= mysqli_query($link, $select);[/code] to: [code]$result= mysqli_query($link, $select) or die(mysqli_error());[/code] And let us know what the output is then.
  18. Please post the relevant code that you are having trouble with.  There are many, many functions that are a part of php, and on php.net, and without knowing what specific problem you are having with your code, we can't help.
  19. Tutorial: http://www.phpfreaks.com/tutorials/40/0.php
  20. If you are checking the data for validity, which you should, then there is no easy way to condense your code.
  21. Why would you want to have more than one action?  Your information would go to one page for verification, and at the same time be emailed, so verification would do no good. Combine the two into one...have the initial part verify the data, if it's bad, ask the user to reenter.  If it's good, then send an email.
  22. [quote author=Thierry link=topic=104788.msg420816#msg420816 date=1156351287] The browser loading bar does seem dependant on page loading time so there must be something. [/quote] That's because it knows how much data is in/on the page...it's a part of the packet information.
  23. Intro to MySQL: http://www.phpfreaks.com/tutorials/33/0.php
  24. [code]$query = "SELECT * from tblPatient"; if ( $_POST['lname'] != "") { $where[] = "lname LIKE '%$lname%'"; } if ( $_POST['fname'] != ""){ $where[] = "fname LIKE '%$fname%'"; } if ($_POST['dob'] != ""){ $where[] = "dob LIKE '%$dob%'"; } if (count($where) > 0) { $query .= " WHERE " . implode(" AND ", $where); } $result = odbc_exec($odbc, $query) or die (odbc_errormsg()); if (odbc_num_rows($result) > 1) { ... form that submits to script that will pull the record for processing ... echo '<select name="selectname" size="1">'; while ($row = odbc_fetch_row($result)) { echo '<option value="' . $row['id'] . '">' . $row['lastname'] . ', ' . $row['firstname'] . ' - ' . $row['dob'] . '</option>'; } echo '</select>'; } else { $row = odbc_fetch_row($result); ... continue with previous script ... }[/code]  
×
×
  • 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.