Jump to content

jbille

Members
  • Posts

    13
  • Joined

  • Last visited

    Never

Everything posted by jbille

  1. error_reporting is "2039", display_errors is "ON". I am unable to change error_reporting in php.ini, but I have used error_reporting(E_ALL) in my script. This is the mysql_connect that is causing the error, however this is inside a DB function I created myself. When I call this function it will successfully make the db connection and won't give any problems until I get to a certain function call: $DB = mysql_connect($Server[$Server]['read'][$Node], $User, $Pass);
  2. error_reporting = E_ALL and display_errors = On in the php.ini file. I am using php 4.3.2. What boggles me is the fact that I am getting a page cannot be displayed in IE and safari, which means to me means there is no error being thrown by PHP.
  3. I work on a decent sized system that uses many different mysql connections. The particular page I am concerned with is one which uses many includes. My problem is this, whenever I create a new mysql connection I am getting blank pages when using Firefox, and page cannot be displayed errors when using other browsers (IE and safari). The weird thing about this is that it doesn't happen every time. When I first bring up the page it will be blank or it cannot be displayed. But if I refresh the page will be displayed and the functionality in the page works fine. Sometimes I will have to refresh a couple of times before this happens. Also when I go to the page from a different link in the system it works fine, but not if I type the link directly into the URL bar. I've narrowed the problem down to a single mysql_connect statement, I did this by putting different "die('here')" statements in the script. The particular connection I am referring to is not the one I am using in my new script but one that has been working fine in the current system. However I only get the problem when I create a new connection. I have error_reporting(E_ALL) set in my script and I have checked my Apache logs only to find nothing. Any ideas?
  4. I have a page that grabs all products matching the selected category from mysql and outputs them on the page.  I was wondering how I can set these products up as links where when clicked on it will take you to a whole new page which shows that single product.  If anyone could give me an idea on where to start that would be great.  It seems to my I would have to create new php files when the link was clicked on.  Is this correct.
  5. I am trying to let the user enter 123-456 in the form, and I want to load that number in a database.  However when I try this it just loads 123 in mysql and it stops at the -.  The same goes for 2.50, this puts 2 in the database.  And when I try to use $number=str_replace("-","000000", $number); it puts a false number into mysql.  I am using 000000 because $number is an INT(30).
  6. What character besides "" can I replace it with so I can return it back to original form when outputting it.
  7. I was wondering how I could replace a period(.) and a dash(-) when passing them through a form to mysql.
  8. [code]$name = $_POST['name']; $number = $_POST['number']; $price = $_POST['price']; $order = $_POST['order']; $category = $_POST['category']; $description = $_POST['description']; $picture = $_POST['picture']; if((empty($name)) || (empty($number)) || (empty($price)) || (empty($category)) || (empty($description))) { echo "Please <a href=\"addproduct.html\">go back</a> and fill in the following information: "; if(empty($name)) echo ("Product Name"); if(empty($number)) echo ("Product Number"); if(empty($price)) echo ("Product Price"); if(empty($category)) echo ("Category must be picked"); if(empty($description)) echo ("Product Description"); exit(1); } $data = addslashes(fread(fopen($picture, "r"), filesize($picture))); $link = mysql_connect(localhost, $user, $pass); if (!$link) {   die('Not connected : ' . mysql_error()); } mysql_select_db($dbname, $link) or die("Unable to select database"); $query ="INSERT INTO products (category, name, number, price, description, picture) VALUES ('$category', '$name', '$number', '$price', '$description', '$data')"; mysql_query($query) or die('Error, query failed, Call Jimmy (330)268-9271'); mysql_close($link);[/code]
  9. I have a form which uploads the following information into mysql: name number description price image However I am having trouble uploading the image and then viewing the image on a page with the rest of these results.  I've looked but have not been able to find any help on this.  Can anyone give me suggestions.
  10. I would use sub-tables, however I would need to have 5 columns in every sub-table.  Do you have any other suggestions.
  11. I'm not sure if this is the correct forum to ask this but I'm going to anyway.  I have a php program which needs to select * from every table where number = '$number' in the entire database and return what table it matches the $number.  The only thing I can think of is a bunch of if statements.  If anyone could give me some advice about what to do I would greatly appreciate it.  Thanks.
  12. Thank you both for your replies.  I used both suggestions to solve the problem.
  13. Hello I have an html form (findproduct.html)which asks for a product number in order to edit the details of that product.  What I am trying to provide is a way to edit anything about that product, including the product number.  When the user enters it and clicks submit a php file (findproduct.php) finds the product through MySQL and outputs the info about the product in another form.  The user can then edit the form appropriately.  When submit is clicked another file (editproduct.php) performs a query to MySQL and updates the information.  However I cannot perform the query correctly because it is using product number from the second form, not the first.  If anyone can help it would be greatly appreciated.  My code is listed below. -----------------------------findproduct.html---------------------- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"       xml:lang="en" lang="en"> <head><title>Administration Page</title> <link rel=stylesheet href="main.css" type="text/css"></head> <body bgcolor="#204D70"> <table  bgcolor="white" frame="box" border="0" width="700" cellpadding="0" cellspacing="0" align="center" valign="center" height=600> <tr> <td> <table bgcolor="#C76114" border="0" cellpadding="5" cellspacing="0" align="center" valign="center"> <form name="findproduct" action="findproduct.php" method="POST" id="findproduct"> <tr><td align="center" class="adminform">Product Number:</td><td></td><td><input type="text" name="number1" id="number1" size="27" /></td></tr> <tr><td></td><td></td><td align="right"><input type="submit" value="submit"></td></tr> </form> </table> </td> </tr> </body> </html> ----------------------findproduct.php----------------------------- <?php session_start(); $host = localhost; $user = websters; $pass = west4; $dbname = WebSter; $prodnumber = $_POST['number1']; $_SESSION['prodnumber'] = $prodnumber; $link = mysql_connect($host, $user, $pass); if (!$link) {   die('Not connected : '); } mysql_select_db($dbname, $link) or die("Unable to select database"); $query ="SELECT * FROM electrical WHERE (number = " . $prodnumber . ")"; $result = mysql_query($query); if (!result) { echo "Product Number could not be found.  Please go back and try again"; } while($row = mysql_fetch_array($result, MYSQL_NUM)) {     $name = $row[0];     $number = $row[1];     $price = $row[2];     $order = $row[3];     $description = $row[4];     $picture = $row[5];     }     echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"     \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"> <html xmlns=\"http://www.w3.org/1999/xhtml\"       xml:lang=\"en\" lang=\"en\">       <body><head><title>Edit product</title> <link rel=stylesheet href=\"main.css\" type=\"text/css\"></head> <body bgcolor=\"#204D70\"> <table  bgcolor=\"white\" frame=\"box\" border=\"0\" width=\"700\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\"  valign=\"center\" height=600> <tr><td align=\"center\" class=\"admin\">Edit a product</td></tr> <tr> <td> <table bgcolor=\"#C76114\" border=\"0\" cellpadding=\"5\" cellspacing=\"0\" align=\"center\" valign=\"center\"> <form name=\"editproduct\" action=\"editproduct.php\" method=\"POST\" encytype=\"multipart/form-data\"> <tr><td class=\"adminform\">Product Name:</td><td></td><td><input type=\"text\" value=" . $name . " name=\"name\" id=\"name\" size=\"27\" /></td></tr> <tr><td class=\"adminform\">Product Number:</td><td align=\"right\" class=\"adminform\">#</td><td><input value=" . $prodnumber . " type=\"text\" name=\"number\" id=\"number\" size=\"27\" /></td></tr> <tr><td class=\"adminform\">Product Price:</td><td align=\"right\" class=\"adminform\">$</td><td valign=\"top\"><input type=\"text\" value=" . $price . " name=\"price\" id=\"price\" size=\"27\" /></td></tr> <tr><td class=\"adminform\">Where do you want this item to be in the list?:</td><td></td><td><input type=\"text\" value=" . $order . " name=\"order\" id=\"order\" size=\"27\" /></td></tr>     <tr><td class=\"adminform\">What category do you want the product to go in?:</td><td></td>     <td><select id=\"category\" name=\"category\" size=\"1\" value=\"electrical\"> <option value=\"0\">Choose a category</option> <option value=\"electrical\">Electrical</option> <option value=\"hydraulic\">Hydraulic</option> <option value=\"air\">Air</option> <option value=\"springs\">Springs</option> <option value=\"shoes\">Brake Shoes</option> <option value=\"suspension\">Suspension</option> </select></td> <tr><td valign=\"top\" class=\"adminform\">Product Description:</td><td></td><td><textarea name=\"description\" cols=20 rows=6>" . $description . "</textarea></td></tr> <tr> <td class=\"adminform\"><input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"300000\" />Upload this picture: </td> <td></td> <td><input name=\"picture\" value=\"something\" type=\"file\" />     </td>     </tr>     <tr height=\"10\"></tr>   <tr><td></td><td></td><td align=\"left\"><input type=\"submit\" value=\"submit\"></td></tr>     </form>   </table>     </td>     </tr> </table> </body> </html>"; mysql_close($link); ?> ------------------------editproduct.php-------------------------- <?php session_start(); $host = localhost; $user = websters; $pass = west4; $dbname = WebSter; $name = $_POST['name']; $number = $_POST['number']; $price = $_POST['price']; $order = $_POST['order']; $category = $_POST['category']; $description = $_POST['description']; $picture = $_POST['picture']; if((empty($name)) || (empty($number)) || (empty($price)) || (empty($order)) || (empty($category)) || (empty($description)) || (empty($picture))) { echo "Please go back and fill in the following information: <br><br>"; if(empty($name)) echo ("Product Name <br>"); if(empty($number)) echo ("Product Number<br>"); if(empty($price)) echo ("Product Price<br>"); if(empty($order)) echo ("Order of item in the list<br>"); if(empty($category)) echo ("Category must be picked<br>"); if(empty($description)) echo ("Product Description<br>"); if(empty($picture)) echo ("Please upload a photo<br>"); exit(1); } $data = addslashes(fread(fopen($picture, "r"), filesize($picture))); $link = mysql_connect($host, $user, $pass); if (!$link) {   die('Not connected : '); } mysql_select_db($dbname, $link) or die("Unable to select database"); $prodnumber = $_SESSION['prodnumber']; $query ="UPDATE " . $category . " SET number='$number' WHERE number='$prodnumber'"; mysql_query($query) or die('Error, query failed, Call Jimmy (330)268-9271'); mysql_close($link); echo "<html><body><p>Thank you. <a href=\"findproduct.html\">Click here</a> to edit another product or <a href=\"admin.html\">here</a> to return to administration home page <br>"; echo $_SESSION['prodnumber']; session_destroy(); ?>
×
×
  • 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.