Jump to content

ianhaney

Members
  • Posts

    330
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by ianhaney

  1. Just a update, I have built the register and login php scripts and that works perfect and now working on the view page but got stuck with it a bit I got the following code <?php ini_set('display_startup_errors',1); ini_set('display_errors',1); error_reporting(-1); ?> <?php include("db-connect.php"); // get the records from the database if ($result = $mysqli->query("SELECT e.emp_id , t.description FROM employee e JOIN assignment a ON e.emp_id = a.emp_id JOIN task t ON a.task_id = t.task_id")) { // display records if there are records to display if ($result->num_rows > 0) { // display records in a table echo "<table>"; // set table headers echo "<tr> <th>Task ID</th> <th>Description</th> <th>Status</th> <th>Emp ID</th> <th>Status</th> <th colspan='2'>Actions</th> </tr>"; while ($row = $result->fetch_object()) { // set up a row for each record echo "<tr>"; echo "<td>" . $row->task_id . "</td>"; echo "<td>" . $row->description . "</td>"; echo "<td>" . $row->status . "</td>"; echo "<td>" . $row->emp_id . "</td>"; echo "<td>" . $row->status . "</td>"; echo "<td><a href='records.php?task_id=" . $row->task_id . "'>Edit</a></td>"; echo "</tr>"; } echo "</table>"; } // if there are no records in the database, display an alert message else { echo "No results to display!"; } } // show an error if there is an issue with the database query else { echo "Error: " . $mysqli->error; } // close database connection $mysqli->close(); ?> I get the following errors Notice: Undefined property: stdClass::$task_id in /home/sites/it-doneright.co.uk/public_html/admin/staff-tasks/view-employee-tasks.php on line 40 Notice: Undefined property: stdClass::$status in /home/sites/it-doneright.co.uk/public_html/admin/staff-tasks/view-employee-tasks.php on line 42 Notice: Undefined property: stdClass::$status in /home/sites/it-doneright.co.uk/public_html/admin/staff-tasks/view-employee-tasks.php on line 44 Notice: Undefined property: stdClass::$task_id in /home/sites/it-doneright.co.uk/public_html/admin/staff-tasks/view-employee-tasks.php on line 45 It is pulling the following info from the database Description and the emp_id but not the task_id or the status
  2. Hi Barand Thank you for the reply, I have created the database with the three tables and created the db connect php file which is the easy part and now just created a view page, at the mo I have not done the login etc for it as that is quite straight forward but thinking about it, I need to do that first to make sure when logging in that that specific employee can only see their tasks and no one elses So far I have the following, does the SELECT line look ok as always get bit confused on the JOINS part $sql = "SELECT emp_id, emp_name FROM employee JOIN task ON employee.emp_id = task.task_id JOIN assignment on employee.assign_id = assignment.task_id";
  3. Hi Sorry if is in the wrong place but was seeing if anyone knows of a script that can do the following 1) login to an admin side using admin login info 2) add tasks and assign them to employees 3) the employee can log in with their own log in info 4) the employee can then view their tasks that are just for them and not view others that are assigned to other employees 5) update the task themselves once completed 6) admin can also see the task and the update of it if it has been completed or working on Thank you in advance Ian
  4. Yeah sorry I figured that out after I posted, so sorry, it is working perfect now
  5. Hi I have finally got the HTML email all working ok but got stuck on a few lines which I have added below, I can't work out how to output the date format to dd/mm/yyyy and also output the last id number inserted <p>Expected Start Date: date('d/m/Y', strtotime($exstdate))</p> <p>Expected Repair Date: date('d/m/Y', strtotime($exrdate))</p> <p>Repair Job ID: . mysqli_insert_id($mysqli) . <strong>(Enter this ID number into link below)</strong></p> The whole code is below $to = "$customer_email"; $subject = "Booked Repair Information"; $message = " <html> Hello <strong>$customer_name</strong> <h2>Below is your repair details to track the repair status</h2> <p>Your Name: $customer_name</p> <p>Your Email: $customer_email</p> <p>Your Phone Number: $customer_phone</p> <p>PC/Laptop Make: $computer_make</p> <p>PC/Laptop Make: $computer_model</p> <p>Assigned to Technician: $technician</p> <p>Current Repair Status: $status</p> <p>Expected Start Date: date('d/m/Y', strtotime($exstdate))</p> <p>Expected Start Time: $exstime</p> <p>Expected Repair Date: date('d/m/Y', strtotime($exrdate))</p> <p>Expected Repair Time: $exrtime</p> <p>Dropoff or Pickup: $deltype</p> <p>Comments: $comments</p> <p>Repair Cost: '\243' $exstime . </p> <p>Repair Job ID: . mysqli_insert_id($mysqli) . <strong>(Enter this ID number into link below)</strong></p> <p>http://www.it-doneright.co.uk/track-my-repair.php</p> </html> "; // Always set content-type when sending HTML email $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; $headers .= 'From: <enquiries@it-doneright.co.uk>' . "\r\n"; mail($to,$subject,$message,$headers);
  6. Sorry got bit lost, below is the whole coding that does the php email header('Content-Type: text/html;charset=utf-8'); $header = "From: enquiries@it-doneright.co.uk\n" . "Reply-To: enquiries@it-doneright.co.uk\n"; $subject = "Booked Repair Information"; $email_to = "$customer_email"; $message .= "Below is your repair details to track the repair status\n\n"; $message .= "Your Name: $customer_name\n"; $message .= "Your Email: $customer_email\n"; $message .= "Your Phone Number: $customer_phone\n"; $message .= "PC/Laptop Make: $computer_make\n"; $message .= "PC/Laptop Model: $computer_model\n"; $message .= "Assigned to Technician: $technician\n"; $message .= "Current Repair Status: $status\n"; $message .= "Expected Start Date: " . date("d/m/Y", strtotime($exstdate)) . "\n"; $message .= "Expected Start Time: $exstime\n"; $message .= "Expected Repair Date: " . date("d/m/Y", strtotime($exrdate)) . "\n"; $message .= "Expected Repair Time: $exrtime\n"; $message .= "Dropoff or Pickup: $deltype\n"; $message .= "Comments: $comments\n"; $message .= "Repair Cost: " . "\243" . $cost . "\n\n"; $message .= "Repair Job ID: " . mysqli_insert_id($mysqli) . " (Enter this ID number into link below)" . "\n\n"; $message .= "http://www.it-doneright.co.uk/track-my-repair.php"; mail($email_to, $subject ,$message ,$header ) ; I am testing it and having them sent to myself
  7. Hi Sorry I have tried all different ways to get part of the following line of code in bold $message .= "Repair Job ID: " . mysqli_insert_id($mysqli) . " (Enter this ID number into link below)" . "\n\n"; I want the (Enter this ID number into link below) to be in bold but when I added <strong> just before it, it outputted the html tag so made the line like the following but didn't work as just outputs the html tag as well as am guessing it is because I have wrapped it in " " but then would be wrong if I took the " " out, is that right? $message .= "Repair Job ID: " . mysqli_insert_id($mysqli) . "<strong>" . " (Enter this ID number into link below)" . "</strong> . "\n\n"; Sorry, I have tried myself first before posting and have looked all over for the solution and tried different ways
  8. Hi Sorted it, thank you so much Barand for the replies and advice etc. I managed to do it using the mysqli_insert_id as you mentioned Thank you again so so much
  9. Hi Barand I thought about using the mysqli_insert_id and tried to add it to the php email content but didn't display, I will try it again and try and work it out Sorry there is just one ID column in the repairs table, sorry was my fault not being clear, it is just called id in the repairs table and is auto_inc
  10. Hi Barand Thank you for the reply Yeah the ID is unique, below is the whole coding I have <?php /* Allows the user to both create new records and edit existing records */ // connect to the database include("connect-db.php"); // creates the new/edit record form // since this form is used multiple times in this file, I have made it a function that is easily reusable function renderForm($customer_name = '', $customer_email = '', $customer_phone = '', $computer_make = '', $computer_model = '', $technician = '', $status = '', $exrdate = '', $exrtime = '', $exstdate = '', $exstime = '', $deltype = '', $comments = '', $cost = '', $error = '', $id = '') { ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title> <?php if ($id != '') { echo "Edit Repair Tracking"; } else { echo "New Repair Tracking"; } ?> </title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <link rel="stylesheet"href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/blitzer/jquery-ui.css"/> <script src="//code.jquery.com/jquery-1.10.2.js"></script> <script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script> <link rel="stylesheet" type="text/css" media="screen" href="css/styles.css" /> <script src="js/jquery.ui.timepicker.js"></script> <link rel="stylesheet" type="text/css" media="screen" href="css/jquery.ui.timepicker.css" /> <script> $(function() { $("#exrdate").datepicker({ showButtonPanel: true, dateFormat: "yy/mm/dd", showOn:"both" }); }); $(function() { $("#exstdate").datepicker({ showButtonPanel: true, dateFormat: "yy/mm/dd", showOn:"both" }); }); </script> <script> $(document).ready(function() { $('#exrtime').timepicker({ defaultTime: '12:00', showLeadingZero: true, showNowButton: true, showCloseButton: true, showDeselectButton: true, showOn: 'both', }); $('#exstime').timepicker({ defaultTime: '12:00', showLeadingZero: true, showNowButton: true, showCloseButton: true, showDeselectButton: true, showOn: 'both', }); }); </script> <script src="//cdn.ckeditor.com/4.5.5/full/ckeditor.js"></script> </head> <body> <div id="logo"> <img src="images/logo/it-done-right.jpg" alt="" title=""> </div> <? session_start(); if($_SESSION['user']==''){ header("Location:../index.php"); }else{ include("../config.php"); $sql=$dbh->prepare("SELECT * FROM users WHERE id=?"); $sql->execute(array($_SESSION['user'])); while($r=$sql->fetch()){ echo "<div class='home-content'>"; echo "<center><h2>Hello, ".$r['username']."</h2>"; echo "<a href='../logout.php'>Log Out</a> <br><br> <a href='../index.php'>Home</a></center>"; echo "</div>"; } } ?> <h1><?php if ($id != '') { echo "Edit Record"; } else { echo "New Record"; } ?></h1> <?php if ($error != '') { echo "<div style='padding:4px; border:1px solid red; color:red'>" . $error . "</div>"; } ?> <form action="" method="post" class="basic-grey"> <div> <?php if ($id != '') { ?> <input type="hidden" name="id" value="<?php echo $id; ?>" /> <p>Repair ID: <?php echo $id; ?></p> <?php } ?> <br> <strong>Customer Name:</strong> <input type="text" name="customer_name" value="<?php echo $customer_name; ?>"/> <br/> <strong>Customer Email:</strong> <input type="text" name="customer_email" value="<?php echo $customer_email; ?>"/> <br> <strong>Customer Phone:</strong> <input type="text" name="customer_phone" value="<?php echo $customer_phone; ?>"/> <br> <strong>Computer Make:</strong> <input type="text" name="computer_make" value="<?php echo $computer_make; ?>"/> <br> <strong>Computer Model:</strong> <input type="text" name="computer_model" value="<?php echo $computer_model; ?>"/> <br> <strong>Assigned to Technician:</strong> <select name="technician"> <option value="Phil Roskams">Phil Roskams</option> <option value="Ian Haney">Ian Haney</option> </select> <br> <strong>Repair Status:</strong> <select name="status"> <option value="In Queue">In Queue</option> <option value="Working on">Working on</option> <option value="Awaiting Parts">Awaiting Parts</option> <option value="Ready for Collection/Delivery">Ready for Collection/Delivery</option> <option value="Complete">Complete</option> </select> <br> <strong>Expected Start Date:</strong> <input type="text" name="exstdate" value="<?php echo $exstdate; ?>" id="exstdate" /> <br><br> <strong>Expected Start Time:</strong> <input type="time" name="exstime" value="<?php echo $exstime; ?>" id="exstime"/> <br><br> <strong>Expected Repair Date:</strong> <input type="text" name="exrdate" value="<?php echo $exrdate; ?>" id="exrdate"/> <br><br> <strong>Expected Repair Time:</strong> <input type="time" name="exrtime" value="<?php echo $exrtime; ?>" id="exrtime"/> <br><br> <strong>Delivery Type:</strong> <select name="deltype"> <option value="Customer Pickup">Customer Pickup</option> <option value="Delivery">Delivery</option> </select> <br> <strong>Comments:</strong> <br> <textarea name="comments" class="ckeditor"><?php echo $comments; ?></textarea> <br> <strong>Repair Cost:</strong> <input type="text" name="cost" value="<?php echo $cost; ?>"/> <br> <input type="submit" name="submit" value="Add/Update Repair Tracking" /> </div> </form> </body> </html> <?php } /* EDIT RECORD */ // if the 'id' variable is set in the URL, we know that we need to edit a record if (isset($_GET['id'])) { // if the form's submit button is clicked, we need to process the form if (isset($_POST['submit'])) { // make sure the 'id' in the URL is valid if (is_numeric($_POST['id'])) { // get variables from the URL/form $id = $_POST['id']; $customer_name = htmlentities($_POST['customer_name'], ENT_QUOTES); $customer_email = htmlentities($_POST['customer_email'], ENT_QUOTES); $customer_phone = htmlentities($_POST['customer_phone'], ENT_QUOTES); $computer_make = htmlentities($_POST['computer_make'], ENT_QUOTES); $computer_model = htmlentities($_POST['computer_model'], ENT_QUOTES); $technician = htmlentities($_POST['technician'], ENT_QUOTES); $status = htmlentities($_POST['status'], ENT_QUOTES); $exrdate = htmlentities($_POST['exrdate'], ENT_QUOTES); $exrtime = htmlentities($_POST['exrtime'], ENT_QUOTES); $exstdate = htmlentities($_POST['exstdate'], ENT_QUOTES); $exstime = htmlentities($_POST['exstime'], ENT_QUOTES); $deltype = htmlentities($_POST['deltype'], ENT_QUOTES); $comments = htmlentities($_POST['comments'], ENT_QUOTES); $cost = htmlentities($_POST['cost'], ENT_QUOTES); // check that firstname and lastname are both not empty if ($customer_name == '' || $customer_phone == '' || $computer_make == '' || $computer_model == '' || $comments == '') { // if they are empty, show an error message and display the form $error = 'ERROR: Please fill in all required fields!'; renderForm($customer_name, $customer_phone, $computer_make, $computer_model, $comments, $error, $id); } else { // if everything is fine, update the record in the database if ($stmt = $mysqli->prepare("UPDATE repairs SET customer_name = ?, customer_email = ?, customer_phone = ?, computer_make = ?, computer_model = ?, technician = ?, status = ?, exrdate = ?, exrtime = ?, exstdate = ?, exstime = ?, deltype = ?, comments = ?, cost = ? WHERE id=?")) { $stmt->bind_param("ssssssssssssssi", $customer_name, $customer_email, $customer_phone, $computer_make, $computer_model, $technician, $status, $exrdate, $exrtime, $exstdate, $exstime, $deltype, $comments, $cost, $id); $stmt->execute(); $stmt->close(); } // show an error message if the query has an error else { echo "ERROR: could not prepare SQL statement."; } // redirect the user once the form is updated header("Location: view-repairs-tracking.php"); } } // if the 'id' variable is not valid, show an error message else { echo "Error!"; } } // if the form hasn't been submitted yet, get the info from the database and show the form else { // make sure the 'id' value is valid if (is_numeric($_GET['id']) && $_GET['id'] > 0) { // get 'id' from URL $id = $_GET['id']; // get the recod from the database if($stmt = $mysqli->prepare("SELECT id, customer_name, customer_email, customer_phone, computer_make, computer_model, technician, status, exrdate, exrtime, exstdate, exstime, deltype, comments, cost FROM repairs WHERE id=?")) { $stmt->bind_param("i", $id); $stmt->execute(); $stmt->bind_result($id, $customer_name, $customer_email, $customer_phone, $computer_make, $computer_model, $technician, $status, $exrdate, $exrtime, $exstdate, $exstime, $deltype, $comments, $cost); $stmt->fetch(); // show the form renderForm($customer_name, $customer_email, $customer_phone, $computer_make, $computer_model, $technician, $status, $exrdate, $exrtime, $exstdate, $exstime, $deltype, $comments, $cost, NULL, $id); $stmt->close(); } // show an error if the query has an error else { echo "Error: could not prepare SQL statement"; } } // if the 'id' value is not valid, redirect the user back to the view.php page else { header("Location: view-repairs-tracking.php"); } } } /* NEW RECORD */ // if the 'id' variable is not set in the URL, we must be creating a new record else { // if the form's submit button is clicked, we need to process the form if (isset($_POST['submit'])) { // get the form data $customer_name = htmlentities($_POST['customer_name'], ENT_QUOTES); $customer_email = htmlentities($_POST['customer_email'], ENT_QUOTES); $customer_phone = htmlentities($_POST['customer_phone'], ENT_QUOTES); $computer_make = htmlentities($_POST['computer_make'], ENT_QUOTES); $computer_model = htmlentities($_POST['computer_model'], ENT_QUOTES); $technician = htmlentities($_POST['technician'], ENT_QUOTES); $status = htmlentities($_POST['status'], ENT_QUOTES); $exrdate = htmlentities($_POST['exrdate'], ENT_QUOTES); $exrtime = htmlentities($_POST['exrtime'], ENT_QUOTES); $exstdate = htmlentities($_POST['exstdate'], ENT_QUOTES); $exstime = htmlentities($_POST['exstime'], ENT_QUOTES); $deltype = htmlentities($_POST['deltype'], ENT_QUOTES); $comments = htmlentities($_POST['comments'], ENT_QUOTES); $cost = htmlentities($_POST['cost'], ENT_QUOTES); // check that firstname and lastname are both not empty if ($customer_name == '' || $computer_make == '' || $computer_model == '' || $comments == '') { // if they are empty, show an error message and display the form $error = 'ERROR: Please fill in all required fields!'; renderForm($customer_name, $computer_make, $computer_model, $comments, $error); } else { // insert the new record into the database if ($stmt = $mysqli->prepare("INSERT repairs (customer_name, customer_email, customer_phone, computer_make, computer_model, technician, status, exrdate, exrtime, exstdate, exstime, deltype, comments, cost) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")) { $stmt->bind_param("ssssssssssssss", $customer_name, $customer_email, $customer_phone, $computer_make, $computer_model, $technician, $status, $exrdate, $exrtime, $exstdate, $exstime, $deltype, $comments, $cost); $stmt->execute(); $stmt->close(); } // show an error if the query has an error else { echo "ERROR: Could not prepare SQL statement."; } if($stmt) $header = "From: enquiries@it-doneright.co.uk\n" . "Reply-To: enquiries@it-doneright.co.uk\n"; $subject = "Booked Repair Information"; $email_to = "$customer_email"; $message = "Below is your repair details to track the repair status\n\n" . "Your Name: $customer_name\n" . "Your Email: $customer_email\n" . "Your Phone Number: $customer_phone\n" . "PC/Laptop Make: $computer_make\n" . "PC/Laptop Model: $computer_model\n" . "Assigned to Technician: $technician\n" . "Current Repair Status: $status\n" . "Expected Start Date: $exstdate\n" . "Expected Start Time: $exstime\n" . "Expected Repair Date: $exrdate\n" . "Expected Repair Time: $exrtime\n" . "Dropoff or Pickup: $deltype\n" . "Comments: $comments\n" . "Repair Cost: $cost\n\n" . "Repair ID: $id\n\n" . "<a href='http://www.it-doneright.co.uk/track-my-repair.php'>Track your repair</a>"; mail($email_to, $subject ,$message ,$header ) ; // redirec the user header("Location: view-repairs-tracking.php"); } } // if the form hasn't been submitted yet, show the form else { renderForm(); } } // close the mysqli connection $mysqli->close(); ?> Sorry to post the whole code but thought would all be important and related
  11. Hi I have added in a email script so that after the data is stored in the mysql database, a email is sent out to the customer, it all works perfect apart from one little bit hopefully I can't seem to get the $id number from the database to display within the email, it just returns Repair ID: the coding I have is below if($stmt) $header = "From: enquiries@it-doneright.co.uk\n" . "Reply-To: enquiries@it-doneright.co.uk\n"; $subject = "Booked Repair Information"; $email_to = "$customer_email"; $message = "Below is your repair details to track the repair status\n\n" . "Your Name: $customer_name\n" . "Your Email: $customer_email\n" . "Your Phone Number: $customer_phone\n" . "PC/Laptop Make: $computer_make\n" . "PC/Laptop Model: $computer_model\n" . "Assigned to Technician: $technician\n" . "Current Repair Status: $status\n" . "Expected Start Date: $exstdate\n" . "Expected Start Time: $exstime\n" . "Expected Repair Date: $exrdate\n" . "Expected Repair Time: $exrtime\n" . "Dropoff or Pickup: $deltype\n" . "Comments: $comments\n" . "Repair Cost: $cost\n\n" . "Repair ID: $id\n\n" . "<a href='http://www.it-doneright.co.uk/track-my-repair.php'>Track your repair</a>"; mail($email_to, $subject ,$message ,$header ) ; I guess I need to add $_GET or $_POST somewhere before the email part to retrieve the $id and display in the email, is that right?
  12. Hi Barand and Ch0cu3r I have altered the coding to what you both said and is perfect now, thank you so much
  13. Hi Each time I go to insert or edit a textarea, I seem to have big blank space before typing so can't start typing from the left and always seems to start way over to the left on the first line and I keep having to delete the blank spaces so is over to the left before I can start typing, the coding I have is below <strong>Comments:</strong> <br> <textarea name="comments"> <?php echo $comments; ?> </textarea> Just seeing if anyone can see if I have done anything wrong somewhere? Thank you in advance Ian
  14. Hi I need some help with php math functions I have added a php order form to my website at the following http://www.irhwebsites.co.uk/web-design-order-form.php I have added a total deposit to pay now field Two issues, one is I want the total to be divided into 2 and then that figure displayed in the total deposit to pay now input field Second issue is after filling the details and clicking submit, I have made extra text saying total deposit to pay now, I want that to display the total price divided by 2 and then the paypal button to know that number divided into 2 and taken through to PayPal At the moment the paypal button is just taking the total price and going through to PayPal I can send over php files if that is possible through PM or by email if anyone wants to email me at ianhaney@irhwebsites.co.uk Thank you in advance Kind regards Ian
  15. Hi I need some help I am doing a car listing website for a client of mine and am using openautoclassifieds as does everything the client needs Only issue is he wants the users to list car number plates as well Am struggling on how to work out how to allow users to list car number plates as well as cars Does anyone know about openautoclassifieds The website is www.247autotrade.com Kind regards Ian
  16. Hi I am looking for a good php cms tutorial if anyone knows of any that I can test out on my localhost Kind regards Ian
  17. Hi I am building a website on wamp that I can play around with and have got some errors They are SCREAM: Error suppression ignored for ( ! ) Notice: Undefined index: qs in C:\wamp\www\admin website\admin\index.php on line 22 AND SCREAM: Error suppression ignored for ( ! ) Notice: Undefined index: inv_usr in C:\wamp\www\admin website\admin\index.php on line 52 ON LINE 22 IS THE FOLLOWING if($_REQUEST["qs"]=="logout" AND ON LINE 52 IS THE FOLLOWING <?php if($_GET['inv_usr'] == 'yes') I got a couple on the front end of the website as well but will worry about them after Any ideas Kind regards Ian
  18. Hi I was just wondering if anyone knows about osclass in here My issue with it is, I added a cars attribute plugin and all works ok but I can't get a attribute to return any search results I am testing it with the colour attribute and I type in a colour that I know is the database but returns no results for it Any ideas or can point me in the right direction, am getting a headache with it lol I got a issue with it and can't figure it out, I have only been using it a couple of days Kind regards Ian
  19. I have attached images of how I entered the fields in the database table see images below And to do it as the way you said $query = sprintf("INSERT INTO your_table (col1,col2,col3,...) VALUES ('%s',%d,'%s', ...)", $some_string_value, $some_integer_value, $someother_string_value); $query = sprintf("INSERT INTO webid_auctions (make,model,number_doors,...) VALUES ('%make',%model,'%number_doors', ...)", $some_string_value, $some_integer_value, $someother_string_value); Would that be right? I was thinking of something like the following
  20. Hmm not sure how I would convert the following to the way you said return "INSERT INTO " . $DBPrefix . "auctions VALUES (NULL, " .$user->user_data['id'] . ", '" . $system->cleanvars($_SESSION['SELL_title']) . "', '" . $system->cleanvars($_SESSION['SELL_subtitle']) . "', '" . $a_starts . "', '" . addslashes($_SESSION['SELL_description']) . "', '" . $system->cleanvars($_SESSION['SELL_pict_url']) . "', " . $_SESSION['SELL_sellcat1'] . ", " . intval($_SESSION['SELL_sellcat2']) . ", '" . $system->input_money(($_SESSION['SELL_buy_now_only'] == 'n') ? $_SESSION['SELL_minimum_bid'] : $_SESSION['SELL_buy_now_price']) . "', '" . $system->input_money($_SESSION['SELL_shipping_cost']) . "', '" . $system->input_money(($_SESSION['SELL_with_reserve'] == 'yes') ? $_SESSION['SELL_reserve_price'] : 0) . "', '" . $system->input_money(($_SESSION['SELL_with_buy_now'] == 'yes') ? $_SESSION['SELL_buy_now_price'] : 0) . "', '" . $_SESSION['SELL_atype'] . "', '" . $_SESSION['SELL_condition'] . "', '" . $_SESSION['SELL_make'] . "', '" . $_SESSION['SELL_model'] . "', '" . $_SESSION['SELL_number_doors'] . "', '" . $_SESSION['SELL_colour'] . "', '" . $_SESSION['SELL_year'] . "', '" . $_SESSION['SELL_fuel_type'] . "', '" . $_SESSION['SELL_duration'] . "', '" . $system->input_money($_SESSION['SELL_customincrement']) . "', '" . $_SESSION['SELL_shipping'] . "', '" . $payment_text . "', " . (($_SESSION['SELL_international']) ? 1 : 0) . ", '" . $a_ends . "', 0, 0, " . (($_SESSION['SELL_file_uploaded']) ? 1 : 0) . ", " . $_SESSION['SELL_iquantity'] . ", 0, " . intval($_SESSION['SELL_relist']) . ", 0, 0, 'n', '" . $system->cleanvars($_SESSION['SELL_shipping_terms']) . "', '" . $_SESSION['SELL_buy_now_only'] . "', '" . $_SESSION['SELL_is_bold'] . "', '" . $_SESSION['SELL_is_highlighted'] . "', '" . $_SESSION['SELL_is_featured'] . "', " . $fee . ")"; }
  21. Hi I added extra fields following the link below http://www.webidsupport.com/forums/s...ight=condition I get the following error after pressing submit An unexpected error occurred. The error has been forwarded to our technical team and will be fixed shortly I checked the error log just now in admin ->tools and has the following Ford Mondeo ', '', 198, 0, '299', '0', '0', '299', '1', '1', '1', '2', 'Array', 'Silver', '3', '2', '1', '0', '2', '1', 0, '1367774117', 0, 0, 1, 1, 0, 0, 0, 0, 'n', '', 'y', 'n', 'n', 'n', 0.00) Column count doesn't match value count at row 1 page:/home/sites/247autotrade.com/public_html/sell.php line:108 I found it is because I have a field short in the coding I am guessing as also found out there are more database columns than there are values, is that right? if so just unsure how to correct it I have been trying to fix it for ages but can't seem to do it Is it to do with the coding below return "INSERT INTO " . $DBPrefix . "auctions VALUES (NULL, " .$user->user_data['id'] . ", '" . $system->cleanvars($_SESSION['SELL_title']) . "', '" . $system->cleanvars($_SESSION['SELL_subtitle']) . "', '" . $a_starts . "', '" . addslashes($_SESSION['SELL_description']) . "', '" . $system->cleanvars($_SESSION['SELL_pict_url']) . "', " . $_SESSION['SELL_sellcat1'] . ", " . intval($_SESSION['SELL_sellcat2']) . ", '" . $system->input_money(($_SESSION['SELL_buy_now_only'] == 'n') ? $_SESSION['SELL_minimum_bid'] : $_SESSION['SELL_buy_now_price']) . "', '" . $system->input_money($_SESSION['SELL_shipping_cost']) . "', '" . $system->input_money(($_SESSION['SELL_with_reserve'] == 'yes') ? $_SESSION['SELL_reserve_price'] : 0) . "', '" . $system->input_money(($_SESSION['SELL_with_buy_now'] == 'yes') ? $_SESSION['SELL_buy_now_price'] : 0) . "', '" . $_SESSION['SELL_atype'] . "', '" . $_SESSION['SELL_condition'] . "', '" . $_SESSION['SELL_make'] . "', '" . $_SESSION['SELL_model'] . "', '" . $_SESSION['SELL_number_doors'] . "', '" . $_SESSION['SELL_colour'] . "', '" . $_SESSION['SELL_year'] . "', '" . $_SESSION['SELL_fuel_type'] . "', '" . $_SESSION['SELL_duration'] . "', '" . $system->input_money($_SESSION['SELL_customincrement']) . "', '" . $_SESSION['SELL_shipping'] . "', '" . $payment_text . "', " . (($_SESSION['SELL_international']) ? 1 : 0) . ", '" . $a_ends . "', 0, 0, " . (($_SESSION['SELL_file_uploaded']) ? 1 : 0) . ", " . $_SESSION['SELL_iquantity'] . ", 0, " . intval($_SESSION['SELL_relist']) . ", 0, 0, 'n', '" . $system->cleanvars($_SESSION['SELL_shipping_terms']) . "', '" . $_SESSION['SELL_buy_now_only'] . "', '" . $_SESSION['SELL_is_bold'] . "', '" . $_SESSION['SELL_is_highlighted'] . "', '" . $_SESSION['SELL_is_featured'] . "', " . $fee . ")"; } Thank you in advance Kind regards Ian
  22. Hi Sen Yeah I know but that line is commented out
  23. Hi I am using webid for a website I am doing for a customer and have added some extra fields to the sell item page and just before I submit it, the data I entered is not showing up in the confirm listing bit and was wondering if anyone could point me in the right direction, I did check the error log and found this but am bit unsure what to change or alter PHP Parse error: syntax error, unexpected ')', expecting '&' or T_STRING or T_VARIABLE or '$' in /home/sites/247autotrade.com/public_html/sell.php on line 551, referer: http://247autotrade.com/select_category.php Below is line 551 from the coding foreach ($system->SETTINGS['make'] as $key => $val) That line is taken from the following // MAKE $TPL_make = '<input type="text" name="make" size="25">' . "\n"; foreach ($system->SETTINGS['make'] as $key => $val) { //$TPL_item_condition .= "\t" . '<option value="' . $key . '" ' . (($key == $condition) ? 'selected="true"' : '') . '>' . $val . '</option>' . "\n"; } $TPL_make .= '</input>' . "\n"; I have a screenshot if anyone needs to see the screenshot of the issue
  24. Hi On one of my customers websites, I have a feedback form that automatically adds the feedback to the testimonials page by adding it to the testimonials database table and displays it on the testimonials page I have noticed that if a special character like a ' or something, the feedback is not added I can't remember how to do it so that the feedback is added if it has a special character in the text Can someone help please Kind regards Ian
  25. Hi I have a html contact form in my website and it's action is using a php file and I am trying to get the contact form to send a email to two different email addresses but can't get it working correctly The php file coding the contact form is using is below <?php // EDIT THE 2 LINES BELOW AS REQUIRED $send_email_to = "sales@bhwebsites.co.uk"; $ccemail = "sales@irhwebsites.co.uk"; $email_subject = "Enquiry from the website"; function send_email($name,$email,$email_message) { global $send_email_to; global $ccemail; global $email_subject; $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n"; $headers .= "From: ".$email. "\r\n"; $headers .= "Cc: ".$ccemail. "\r\n"; $message = "<strong>Email = </strong>".$email."<br>"; $message .= "<strong>Name = </strong>".$name."<br>"; $message .= "<strong>Message = </strong>".$email_message."<br>"; @mail($send_email_to, $ccemail, $email_subject, $message,$headers); return true; } function validate($name,$email,$message) { $return_array = array(); $return_array['success'] = '1'; $return_array['name_msg'] = ''; $return_array['email_msg'] = ''; $return_array['message_msg'] = ''; if($email == '') { $return_array['success'] = '0'; $return_array['email_msg'] = 'email is required'; } else { $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/'; if(!preg_match($email_exp,$email)) { $return_array['success'] = '0'; $return_array['email_msg'] = 'enter valid email.'; } } if($name == '') { $return_array['success'] = '0'; $return_array['name_msg'] = 'name is required'; } else { $string_exp = "/^[A-Za-z .'-]+$/"; if (!preg_match($string_exp, $name)) { $return_array['success'] = '0'; $return_array['name_msg'] = 'enter valid name.'; } } if($message == '') { $return_array['success'] = '0'; $return_array['message_msg'] = 'message is required'; } else { if (strlen($message) < 2) { $return_array['success'] = '0'; $return_array['message_msg'] = 'enter valid message.'; } } return $return_array; } $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message']; $return_array = validate($name,$email,$message); if($return_array['success'] == '1') { send_email($name,$email,$message); } header('Content-type: text/json'); echo json_encode($return_array); die(); ?> Any help would be great Kind regards Ian
×
×
  • 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.