ianhaney50
Members-
Posts
261 -
Joined
-
Last visited
-
Days Won
1
Everything posted by ianhaney50
-
Hi Sorry I trying to debug my PHP bit by bit and have put in a connection success or fail message as well as echo $query and all it says is success so I know it connecting to the database ok as when I change the database info it comes up with fail check parameters message so am thinking is there something wrong with my $query line, I have commented out the email part for now and do one bit at a time, below is the coding I currently have <?php ini_set('display_startup_errors',1); ini_set('display_errors',1); error_reporting(-1); ?> <html> <title>Automatic Email</title> <body> <?php $db = mysqli_connect("" , "", "") or die("Check connection parameters!"); // Optionally skip select_db and use: mysqli_connect(host,user,pass,dbname) mysqli_select_db($db,"") or die(mysqli_error($db)); if (mysqli_connect_error()) { die ('Failed to connect to MySQL'); } else { echo 'success'; } $query = "SELECT * FROM visitors WHERE visitor_mot = DATE_ADD(curdate(), INTERVAL 1 DAY)"; $result = mysqli_query($db, $query) or die(mysqli_error($db)); //fetch tha data from the database while ($row = mysqli_fetch_array($result)) { echo $query; /*ini_set( 'display_errors', 1 ); error_reporting( E_ALL ); $from = "noreply@irhwebsites.co.uk"; $to = "ianhaney@irhwebsites.co.uk"; $subject = "PHP Mail Test script"; $message = "This is a test to check the PHP Mail functionality"; $headers = "From:" . $from; mail($to,$subject,$message, $headers); echo "Test email sent";*/ } //close the connection mysqli_close($db); ?> </body> </html>
-
I got the test email script and put that in and worked perfect so I put the database mysqli coding back in and the email don't work, is just a blank white page <?php ini_set('display_startup_errors',1); ini_set('display_errors',1); error_reporting(-1); ?> <html> <title>Automatic Email</title> <body> <?php $db = mysqli_connect("" , "", "") or die("Check connection parameters!"); // Optionally skip select_db and use: mysqli_connect(host,user,pass,dbname) mysqli_select_db($db,"") or die(mysqli_error($db)); $query = "SELECT * FROM visitors WHERE visitor_mot = DATE_ADD(curdate(), INTERVAL 1 DAY)"; $result = mysqli_query($db, $query) or die(mysqli_error($db)); //fetch tha data from the database while ($row = mysqli_fetch_array($result)) { ini_set( 'display_errors', 1 ); error_reporting( E_ALL ); $from = "noreply@irhwebsites.co.uk"; $to = "ianhaney@irhwebsites.co.uk"; $subject = "PHP Mail Test script"; $message = "This is a test to check the PHP Mail functionality"; $headers = "From:" . $from; mail($to,$subject,$message, $headers); echo "Test email sent"; } //close the connection mysqli_close($db); ?> </body> </html> I was just thinking if the php script stops running before it gets to the email script part?
-
Ahh ok I have taken that line out or do I need the line but just remove IsSMTP part
-
Ahh ok so shall I set that back to SMTP instead of IsMail? no is on a live hosting environment
-
Hi Sorry for my late reply I have just switched to using phpmailer but am not receiving any email and the page is still blank with no errors <?php ini_set('display_startup_errors',1); ini_set('display_errors',1); error_reporting(-1); ?> <html> <title>Automatic Email</title> <body> <?php $servername = ""; $username = ""; $password = ""; $dbname = ""; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } // get the 'id' value from the URL (if it exists), making sure that it is valid (checing that it is numeric/larger than 0) if (isset($_GET['visitor_id']) && ($visitor_id = (int)$_GET['visitor_id']) > 0) { // query db $result = mysql_query("SELECT * FROM visitors WHERE visitor_id = ".$visitor_id) or die(mysql_error()); // Using assoc is better in my opinion. Yes array gives you the same info, but it also gives double the info in numeric indexes, which typically are not needed. $row = mysql_fetch_assoc($result); // check that the 'id' matches up with a row in the databse if($row) { $sql = "SELECT * FROM visitors WHERE (visitor_tax AND visitor_mot AND visitor_insurance > DATE_SUB(CURDATE(), INTERVAL 2 WEEK)"; { if($sql){ $to = $row['visitor_email']; require("class.phpmailer.php"); $mail = new PHPMailer(); $mail->IsMail(); // telling the class to use SMTP $mail->Host = "mail.broadwaymediadesigns.co.uk"; // SMTP server $mail->From = "noreply@broadwaymediadesigns.co.uk"; $mail->AddAddress("ianhaney@broadwaymediadesigns.co.uk"); $mail->Subject = "TEST EMAIL"; $mail->Body = "Hi! \n\n This is my test e-mail sent through PHPMailer."; $mail->WordWrap = 50; if(!$mail->Send()) { echo 'Message was not sent.'; echo 'Mailer error: ' . $mail->ErrorInfo; } else { echo 'Message has been sent.'; } } } } } ?> </body> </html>
-
Hi fastsol I have been working on the following php script, the first bit I have commented out was a test to make sure I received the email ok and I did in my inbox so that is all good then started working on the php script underneath but I am just getting a blank white page, I have php error reporting coding in it but is not displaying no errors? <?php /*ini_set( 'display_errors', 1 ); error_reporting( E_ALL ); $from = "noreply@irhwebsites.co.uk"; $to = "ianhaney@irhwebsites.co.uk"; $subject = "PHP Mail Test script"; $message = "This is a test to check the PHP Mail functionality"; $headers = "From:" . $from; mail($to,$subject,$message, $headers); echo "Test email sent";*/ ?> <?php ini_set('display_startup_errors',1); ini_set('display_errors',1); error_reporting(-1); ?> <?php $servername = ""; $username = ""; $password = ""; $dbname = ""; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } // get the 'id' value from the URL (if it exists), making sure that it is valid (checing that it is numeric/larger than 0) if (isset($_GET['visitor_id']) && is_numeric($_GET['visitor_id']) && $_GET['visitor_id'] > 0) { // query db $visitor_id = $_GET['visitor_id']; $result = mysql_query("SELECT * FROM visitors WHERE visitor_id=$visitor_id") or die(mysql_error()); $row = mysql_fetch_array($result); // check that the 'id' matches up with a row in the databse if($row) { $visitor_email = $row['visitor_email']; $sql = "SELECT * FROM visitors WHERE (visitor_tax AND visitor_mot AND visitor_insurance > DATE_SUB(CURDATE(), INTERVAL 2 WEEK)"; if($sql){ $to = $_POST ['visitor_email']; $subject = "Expiry Tax Date Approaching"; $message = "Hello! Please be informed that your tax is due to expire on $visitor_tax"; $from = "noreply@irhwebsites.co.uk"; $headers = "From: $from"; $sent = mail($to,$subject,$message,$headers); if ($sent){ $statusMessage = "Mail Successfully Sent."; }else{ $statusMessage = "Mail Unsuccessfully Sent"; } } } } ?>
-
Hi I am looking to see if anyone knows of any php scripts that sends out a automatic email 14 days before a expiry date stored in a mysql database I know it can be done with cron job which is ok, I have looked all over Google for a php script that does a php automatic email, I found some but were really old Thank you in advance Ian
-
Yeah I spotted that and is working perfect now
-
Sorry sussed why it was not updating
-
Hi QuickOldCar so should it be all the same either POST or GET?
-
Ahh yeah easy to miss things until someone points it out Got another issue, hopefully is the last one When I am on the edit.php page, I am putting the address line 2 and town and county text in the input field but is not updating and storing it in the database Sorry
-
Hmm another issue, just tried to update a record and I clicked submit and came up with the following error Notice: Undefined index: visitor_id in /home/sites/broadwaymediadesigns.co.uk/public_html/sites/micromend/admin/edit.php on line 90 Error! On line 90 is the following if (is_numeric($_POST['visitor_id']))
-
That was it, I had a extra $visitor_name in the renderForm function at the very top, funny how didn't see it all this time and you mention it and I see it hahahaha Thank you so much for replying, appreciate it
-
Hi I need bit of help on the edit.php page I got the following errors come up and was just seeing if anyone could help with where I am going wrong please if ok Warning: Missing argument 13 for renderForm(), called in /home/sites/broadwaymediadesigns.co.uk/public_html/sites/micromend/admin/edit.php on line 163 and defined in /home/sites/broadwaymediadesigns.co.uk/public_html/sites/micromend/admin/edit.php on line 26 Notice: Undefined variable: error in /home/sites/broadwaymediadesigns.co.uk/public_html/sites/micromend/admin/edit.php on line 41 Below is the coding from the edit.php page <?php error_reporting(-1); ini_set('display_errors', 'On'); ?> <?php session_start(); if(empty($_SESSION['loggedin'])) { header('Location: http://' . $_SERVER['HTTP_HOST'] . '/admin/login.php'); exit; } echo 'You will only see this if you are logged in.'; ?> <?php /* EDIT.PHP Allows user to edit specific entry in database */ // creates the 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($visitor_id, $visitor_name, $visitor_name, $visitor_email, $visitor_firstline, $visitor_secondline, $visitor_town, $visitor_county, $visitor_postcode, $visitor_tel, $visitor_mobile, $visitor_newsletter, $error) { ?> <?php include ( 'includes/header.php' ); ?> <title>Admin edit customers data</title> </head> <body> <div id='column-whole-inner'> <?php // if there are any errors, display them if ($error != '') { echo '<div style="padding:4px; border:1px solid red; color:red;">'.$error.'</div>'; } ?> <form action="" method="post"> <input type="hidden" name="id" value="<?php echo $visitor_id; ?>"/> <div> <p><strong>Visitor ID:</strong> <?php echo $visitor_id; ?></p> <strong>Name: *</strong> <input type="text" name="visitor_name" value="<?php echo $visitor_name; ?>"/> <br/><br> <strong>Email: *</strong> <input type="text" name="visitor_email" value="<?php echo $visitor_email; ?>"/> <br/><br> <strong>Address Line 1: *</strong> <input type="text" name="visitor_firstline" value="<?php echo $visitor_firstline;?>"/> <br><br> <strong>Address Line 2: *</strong> <input type="text" name="visitor_secondline" value="<?php echo $visitor_secondline;?>"/> <br><br> <strong>Town: *</strong> <input type="text" name="visitor_town" value="<?php echo $visitor_town; ?>"/> <br><br> <strong>County: *</strong> <textarea name="visitor_county" rows="8" cols="30"><?php echo $visitor_county; ?></textarea> <br><br> <strong>Postcode: *</strong> <input type="text" name="visitor_postcode" value="<?php echo $visitor_postcode; ?>"/> <br><br> <strong>Telephone Number: *</strong> <input type="text" name="visitor_tel" value="<?php echo $visitor_tel; ?>"/> <br><br> <strong>Mobile Number: *</strong> <input type="text" name="visitor_mobile" value="<?php echo $visitor_mobile; ?>"/> <br> <label style="color: #FFFFFF;"><input type="radio" name="visitor_newsletter" value="Yes" <?php if($visitor_newsletter == Yes) echo 'checked="checked"'; ?> > Yes</label> <br> <label style="color: #FFFFFF;"><input type="radio" name="visitor_newsletter" value="No"<?php if($visitor_newsletter == No) echo 'checked="checked"'; ?> > No</label> <p>* Required</p> <input type="submit" name="submit" value="Submit"> </div> </form> </div> </body> </html> <?php } // connect to the database include('config.php'); // check if the form has been submitted. If it has, process the form and save it to the database if (isset($_POST['submit'])) { // confirm that the 'id' value is a valid integer before getting the form data if (is_numeric($_POST['visitor_id'])) { // get form data, making sure it is valid $visitor_id = $_POST['visitor_id']; $visitor_name = mysql_real_escape_string(htmlspecialchars($_POST['visitor_name'])); $visitor_email = mysql_real_escape_string(htmlspecialchars($_POST['visitor_email'])); $visitor_firstline = mysql_real_escape_string(htmlspecialchars($_POST['visitor_firstline'])); $visitor_secondline = mysql_real_escape_string(htmlspecialchars($_POST['visitor_secondline'])); $visitor_town = mysql_real_escape_string(htmlspecialchars($_POST['visitor_town'])); $visitor_county = mysql_real_escape_string(htmlspecialchars($_POST['visitor_county'])); $visitor_postcode = mysql_real_escape_string(htmlspecialchars($_POST['visitor_postcode'])); $visitor_tel = mysql_real_escape_string(htmlspecialchars($_POST['visitor_tel'])); $visitor_mobile = mysql_real_escape_string(htmlspecialchars($_POST['visitor_mobile'])); $visitor_newsletter = $_POST['visitor_newsletter']; // check that all fields are both filled in if ($visitor_name == '' || $visitor_email == '' || $visitor_firstline == '' || $visitor_secondline == '' || $visitor_town == '' || $visitor_county == '' || $visitor_postcode == '' || $visitor_tel == '' || $visitor_mobile == '') { // generate error message $error = 'ERROR: Please fill in all required fields!'; //error, display form renderForm($visitor_id, $visitor_name, $visitor_email, $visitor_firstline, $visitor_secondline, $visitor_town, $visitor_county, $visitor_postcode, $visitor_tel, $visitor_mobile, $visitor_newsletter, $error); } else { // save the data to the database mysql_query("UPDATE visitors SET visitor_name='$visitor_name', visitor_email='$visitor_email', visitor_firstline='$visitor_firstline', visitor_secondline='$secondline', visitor_town='$town', visitor_county='$visitor_county', visitor_postcode='$visitor_postcode', visitor_tel='$visitor_tel', visitor_mobile='$visitor_mobile', visitor_newsletter='$visitor_newsletter' WHERE visitor_id='$visitor_id'") or die(mysql_error()); // once saved, redirect back to the view page header("Location: index.php"); } } else { // if the 'id' isn't valid, display an error echo 'Error!'; } } else // if the form hasn't been submitted, get the data from the db and display the form { // get the 'id' value from the URL (if it exists), making sure that it is valid (checing that it is numeric/larger than 0) if (isset($_GET['visitor_id']) && is_numeric($_GET['visitor_id']) && $_GET['visitor_id'] > 0) { // query db $visitor_id = $_GET['visitor_id']; $result = mysql_query("SELECT * FROM visitors WHERE visitor_id=$visitor_id") or die(mysql_error()); $row = mysql_fetch_array($result); // check that the 'id' matches up with a row in the databse if($row) { // get data from db $visitor_id = $row['visitor_id']; $visitor_name = $row['visitor_name']; $visitor_email = $row['visitor_email']; $visitor_firstline = $row['visitor_firstline']; $visitor_secondline = $row['visitor_secondline']; $visitor_town = $row['visitor_town']; $visitor_county = $row['visitor_county']; $visitor_postcode = $row['visitor_postcode']; $visitor_tel = $row['visitor_tel']; $visitor_mobile = $row['visitor_mobile']; $visitor_newsletter = $row['visitor_newsletter']; // show form renderForm($visitor_id, $visitor_name, $visitor_email, $visitor_firstline, $visitor_secondline, $visitor_town, $visitor_county, $visitor_postcode, $visitor_tel, $visitor_mobile, $visitor_newsletter, ''); } else // if no match, display result { echo "No results!"; } } else // if the 'id' in the URL isn't valid, or if there is no 'id' value, display an error { echo 'Error!'; } } ?>
-
Sorry sussed it again, I had a extra ' at the end of the VALUES line
-
Hi Sorry am stuck again, I know I need to sanitize the PHP etc. but just want to get the form saving the data to my mysql databas but is not for some reason and can't remember what I did yesterday to get the form to work instead of just resetting itself <?php ini_set('display_startup_errors',1); ini_set('display_errors',1); error_reporting(-1); ?> <?php $title = "Sign Up - Micromend"; $pgDesc=""; $pgKeywords=""; include ( 'includes/header.php' ); ?> <!--CONTENT--> <div id="column-whole-inner"> <div id="login"> <h2>Visitor's Form</h2> <br /> <form action="" method="post"> <label>Name :</label> <input type="text" name="visitor_name" required="required" placeholder="Please Enter Name"/> <br /><br /> <label>Email :</label> <input type="email" name="visitor_email" required="required" placeholder="john123@gmail.com"/> <br/><br /> <label>Address Line 1 :</label> <input type="text" name="visitor_firstline" required="required" placeholder="Please Enter First Line of your address"/> <br><br> <label>Address Line 2 :</label> <input type="text" name="visitor_secondline" required="required" placeholder="Please Enter Second Line of your address"/> <br><br> <label>Town :</label> <input type="text" name="visitor_town" required="required" placeholder="Please Enter your Town"/> <br><br> <label>County :</label> <input type="text" name="visitor_county" required="required" placeholder="Please Enter Your County"/> <br/><br /> <label>Postcode :</label> <input type="text" name="visitor_postcode" required="required" placeholder="Please Enter Your Postcode"/> <br><br> <label>Telephone Number :</label> <input type="text" name="visitor_tel" required="required" placeholder="Please Enter Your Telephone Number"/> <br><br> <label>Mobile Number :</label> <input type="text" name="visitor_mobile" required="required" placeholder="Please Enter Your Mobile Number"/> <br><br> <label>Receive our Monthly Newsletter :</label> <br> <input type="radio" name="visitor_newsletter" value="Yes"><label>Yes</label> <br> <input type="radio" name="visitor_newsletter" value="No"><label>No</label> <br><br> <input type="submit" value=" Submit " name="submit"/> <br /> </form> </div> </div> <!--CONTENT--> <?php if(isset($_POST["submit"])){ $servername = ""; $username = ""; $password = ""; $dbname = ""; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $sql = "INSERT INTO visitors (visitor_name, visitor_email, visitor_firstline, visitor_secondline, visitor_town, visitor_county, visitor_postcode, visitor_tel, visitor_mobile, visitor_newsletter) VALUES ('".$_POST["visitor_name"]."','".$_POST["visitor_email"]."','".$_POST["visitor_firstline"]."', '".$_POST["visitor_secondline"]."', '".$_POST["visitor_town"]."','".$_POST["visitor_county"]."','".$_POST["visitor_postcode"]."','".$_POST["visitor_tel"]."','".$_POST["visitor_mobile"]."','".$_POST["visitor_newsletter"]."'')"; if ($conn->query($sql) === TRUE) { echo "<script type= 'text/javascript'>alert('Your Information has been added successfully to our database');</script>"; } else { echo "<script type= 'text/javascript'>alert('Error: " . $sql . "<br>" . $conn->error."');</script>"; } $conn->close(); } ?> <?php include( 'includes/footer.php' ); ?> Just can't see what or where I am going wrong?
-
Sorry was me being silly, I sussed it and works perfect now
-
Hi I have created a form that allows my clients visitors to sign up and it stored the values in a mysql database but for some reason the form just resets itself and does not give any error reporting issue as have that in the coding and does not save into the database, below is PHP coding <?php ini_set('display_startup_errors',1); ini_set('display_errors',1); error_reporting(-1); ?> <?php $title = "Sign Up - Micromend"; $pgDesc=""; $pgKeywords=""; include ( 'includes/header.php' ); ?> <!--CONTENT--> <div id="column-whole-inner"> <div id="login"> <h2>Visitor's Form</h2> <br /> <form action="" method="post"> <label>Name :</label> <input type="text" name="vis_name" id="name" required placeholder="Please Enter Name"/> <br /><br /> <label>Email :</label> <input type="email" name="vis_email" id="email" required placeholder="john123@gmail.com"/> <br/><br /> <label>Address Line 1 :</label> <input type="text" name="vis_firstline" id="firstline" required placeholder="Please Enter First Line of your address"/> <br><br> <label>Address Line 2 :</label> <input type="text" name="vis_secondline" id="secondline" required placeholder="Please Enter Second Line of your address"/> <br><br> <label>Town :</label> <input type="text" name="vis_town" id="town" required placeholder="Please Enter your Town"/> <br><br> <label>County :</label> <input type="text" name="vis_county" id="county" required placeholder="Please Enter Your County"/> <br/><br /> <label>Postcode :</label> <input type="text" name="vis_postcode" id="postcode" required placeholder="Please Enter Your Postcode"/> <br><br> <label>Telephone Number :</label> <input type="text" name="vis_tel" id="tel" required placeholder="Please Enter Your Telephone Number"/> <br><br> <label>Mobile Number :</label> <input type="text" name="vis_mobile" id="mobile" required placeholder="Please Enter Your Mobile Number"/> <br><br> <label>Receive our Monthly Newsletter :</label> <br> <input type="radio" name="vis_newsletter" value="Yes">Yes <br> <input type="radio" name="vis_newsletter" value="No">No <br><br> <input type="submit" value=" Submit " name="submit"/> <br /> </form> </div> </div> <?php if(isset($_POST["submit"])){ $servername = ""; $username = ""; $password = ""; $dbname = ""; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $sql = "INSERT INTO visitors (visitor_name, visitor_email, visitor_firstline, visitor_secondline, visitor_town, visitor_county, visitor_postcode, visitor_tel, visitor_mobile, visitor_newsletter) VALUES ('".$_POST["vis_name"]."','".$_POST["vis_email"]."','".$_POST["vis_town"]."','".$_POST["vis_county"]."','".$_POST["vis_postcode"]."','".$_POST["vis_tel"]."','".$_POST["vis_mobile"]."','".$_POST["vis_newsletter"]."'')"; if ($conn->query($sql) === TRUE) { echo "<script type= 'text/javascript'>alert('Your Information has been added successfully to our database');</script>"; } else { echo "<script type= 'text/javascript'>alert('Error: " . $sql . "<br>" . $conn->error."');</script>"; } $conn->close(); } ?> <!--CONTENT--> <?php include( 'includes/footer.php' ); ?> Don't think I have missed anything as it seems to connect to the database ok and don't get a connection error Thank you in advance Ian
-
Hi I found the following extension for opencart, it looks perfect for what I need but am trying to do it myself to understand the coding better but got stuck https://www.opencart.com/index.php?route=extension/extension/info&extension_id=16530&token=9f7ebe35ce7a380fde936f97007cc60b I managed to get the calendar displaying all ok on the front end and it calls the events from a php file by looks of the coding <div id="eventCalendarHumanDate"></div> <script> $(document).ready(function() { $("#eventCalendarHumanDate").eventCalendar({ eventsjson: 'http://upyerpole.co.uk/bookingoc/catalog/view/theme/default/js/event.humanDate.json.php', jsonDateFormat: 'human' // 'YYYY-MM-DD HH:MM:SS' }); }); </script> <script> $(id).eventCalendar({ eventsjson: 'file.json', jsonDateFormat: 'human' }); </script> Looking at the extension he has managed to add it into the admin side so events can be created by the admin side but I am not sure how to get that done Looks like the person who made the extension is using the following jquery calendar http://www.vissit.com/jquery-event-calendar-plugin-english-version The php file coding that has the events is below <?php header('Content-type: text/json'); echo '['; $separator = ""; $days = 16; // echo ' { "date": "2013-03-19 17:30:00", "type": "meeting", "title": "Test Last Year", "description": "Lorem Ipsum dolor set", "url": "" },'; // echo ' { "date": "2013-03-23 17:30:00", "type": "meeting", "title": "Test Next Year", "description": "Lorem Ipsum dolor set", "url": "http://www.event3.com/" },'; $i = 1; echo $separator; $initTime = date("Y")."-".date("m")."-".date("d")." ".date("H").":00:00"; //$initTime = date("Y-m-d H:i:00"); echo ' { "date": "2013-04-01 17:30:00", "type": "meeting", "title": "Test Last Year", "description": "Lorem Ipsum dolor set", "url": "" },'; echo ' { "date": "2013-04-02 17:30:00", "type": "meeting", "title": "Test Last Year", "description": "Lorem Ipsum dolor set", "url": "" },'; echo ' { "date": "'; echo date("Y-m-d H:i:00",strtotime($initTime. ' + 1 days')); echo '", "type": "meeting", "title": "Project '; echo $i; echo ' meeting", "description": "Lorem Ipsum dolor set", "url": "" },'; echo ' { "date": "'; echo date("Y-m-d H:i:00",strtotime($initTime. ' + 1 days + 4 hours')); echo '", "type": "demo", "title": "Project '; echo $i; echo ' demo", "description": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.", "url": "http://www.event2.com/" },'; echo ' { "date": "'; echo date("Y-m-d H:i:00",strtotime($initTime. ' + 1 days 8 hours')); echo '", "type": "meeting", "title": "Test Project '; echo $i; echo ' Brainstorming", "description": "Lorem Ipsum dolor set", "url": "http://www.event3.com/" },'; echo ' { "date": "'; echo date("Y-m-d H:i:00",strtotime($initTime. ' + 2 days 3 hours')); echo '", "type": "test", "title": "A very very long name for a f*cking project '; echo $i; echo ' events", "description": "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam.", "url": "http://www.event4.com/" },'; echo ' { "date": "'; echo date("Y-m-d H:i:00",strtotime($initTime. ' + 2 days 3 hours')); echo '", "type": "meeting", "title": "Project '; echo $i; echo ' meeting", "description": "Lorem Ipsum dolor set", "url": "http://www.event5.com/" },'; echo ' { "date": "'; echo date("Y-m-d H:i:00",strtotime($initTime. ' + 4 days 3 hours')); echo '", "type": "demo", "title": "Project '; echo $i; echo ' demo", "description": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.", "url": "http://www.event6.com/" },'; echo ' { "date": "'; echo date("Y-m-d H:i:00",strtotime($initTime. ' + 7 days 1 hours')); echo '", "type": "meeting", "title": "Test Project '; echo $i; echo ' Brainstorming", "description": "Lorem Ipsum dolor set", "url": "http://www.event7.com/" },'; echo ' { "date": "'; echo date("Y-m-d H:i:00",strtotime($initTime. ' + 12 days 3 hours')); echo '", "type": "test", "title": "A very very long name for a f*cking project '; echo $i; echo ' events", "description": "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam.", "url": "http://www.event8.com/" },'; echo ' { "date": "'; echo date("Y-m-d H:i:00",strtotime($initTime. ' + 20 days 10 hours')); echo '", "type": "demo", "title": "Project '; echo $i; echo ' demo", "description": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.", "url": "http://www.event9.com/" },'; echo ' { "date": "'; echo date("Y-m-d H:i:00",strtotime($initTime. ' + 22 days 3 hours')); echo '", "type": "meeting", "title": "Test Project '; echo $i; echo ' Brainstorming", "description": "Lorem Ipsum dolor set", "url": "http://www.event10.com/" },'; echo ' { "date": "'; echo date("Y-m-d H:i:00",strtotime($initTime. ' + 28 days 1 hours')); echo '", "type": "test", "title": "A very very long name for a f*cking project '; echo $i; echo ' events", "description": "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam.", "url": "http://www.event11.com/" }'; $separator = ","; echo ']'; ?> I don't understand the coding dates wise to be honest but not too worried about that at the mo, is more trying to get the events being added from the admin side, looks like he has made it into a module looking at the demo admin side? Any help would really be appreciated Thank you in advance Ian
-
Hi I wonder if anyone can help point me in the right direction please I am building a booking system using opencart and so far so good but on the product page which is the class, I have put a book now button in that pops up when clicked on and within that, I want to show available days and times and have multiple add to cart buttons next to each available date and time At the mo,I have only been able to get one add to cart button but can't work out how to get multiple ones next to each date and time The classes available will be eventually be added from the backend but for now I did it myself within the coding as seen below to until can get the multiple add to cart buttons sorted my code looks like the following at the mo <div id="ex1" style="display:none;"> <p> <table> <tr> <th>Date</th> <th>Time</th> <th>Action</th> </tr> <tr> <td>Date 1</td> <td>13:00 - 14:00</td> <td><input type="button" value="<?php echo $button_cart; ?>" id="button-cart" class="button" /></td> </tr> </table> Thank you in advance Ian
-
what would the query look like as guessing it needs to be UPDATE instead of INSERT INTO so it updates the other text fields as well as storing new images uploaded by the user
-
Hi jcbones Thank you for replying, do appreciate it Yeah sorry that is it, rather than replacing, should be a unique image name for each image so say if they have two current images stored, image1 and image2 then the user updates their listing and uploads the new images imagenew1 and imagenew2, they they should be stored on the database and server instead of image1 and image2, that make sense is it done via the rename link you put just above?
-
Hi I am winning I think I have got the records displayed for the current user logged in so basically they can only see their submitted listings and just working on the edit of them so the current user logged in can update their listing and is all working apart from the update of the images the images are stored by the file name on the database and then gets moved onto the server so the actual images are not stored on the database only the file names are and the images are moved onto the server, hope that makes sense what I can't do at the mo is work out how to update the file names of the images on the database and update on the server I get the following error Notice: Undefined index: photo on line 209 and line 211 the coding for them lines are below $pic1= basename($_FILES['photo']['name'][0]); $pic2= basename($_FILES['photo']['name'][1]); The rest of the coding below that is if(!empty($_FILES['photo']['tmp_name'])) { // Number of uploaded files $num_files = count($_FILES['photo']['tmp_name']); /** loop through the array of files ***/ for($i=0; $i < $num_files;$i++) { // check if there is a file in the array if(!is_uploaded_file($_FILES['photo']['tmp_name'][$i])) { $messages[] = 'No file uploaded'; } else { // move the file to the specified dir if(move_uploaded_file($_FILES['photo']['tmp_name'][$i],$target.'/'.$_FILES['photo']['name'][$i])) { $messages[] = $_FILES['photo']['name'][$i].' uploaded'; } else { // an error message $messages[] = 'Uploading '.$_FILES['photo']['name'][$i].' Failed'; } } } The update query is below // save the data to the database mysql_query("UPDATE privatelistings SET listingtitle='$listingtitle', make='$model', model='$model', exteriorcolour='$exteriorcolour', enginesize='$enginesize', fueltype='$fueltype', yearregistered='$yearregistered', transmission='$transmission', mileage='$mileage', nodoors='$nodoors', bodystyle='$bodystyle', price='$price', photo='$pic1', photo1='$pic2' WHERE id='$id'") or die(mysql_error()); I am going to be updating to mysqli just want to get it working first My HTML form coding is below <form action="" method="post" enctype="multipart/form-data"> <input type="hidden" name="id" value="<?php echo $id; ?>"/> <div> <strong>Listing Title: *</strong> <input type="text" name="listingtitle" value="<?php echo $listingtitle; ?>"/> <br/> <strong>Make: *</strong> <input type="text" name="make" value="<?php echo $make; ?>"/> <br/> <strong>Model: *</strong> <input type="text" name="model" value="<?php echo $model; ?>"/> <br/> <strong>Exterior Colour: *</strong> <input type="text" name="exteriorcolour" value="<?php echo $exteriorcolour; ?>"/> <br/> <strong>Engine Size: *</strong> <input type="text" name="enginesize" value="<?php echo $enginesize; ?>"/> <br/> <strong>Fuel Type: *</strong> <input type="text" name="fueltype" value="<?php echo $fueltype; ?>"/> <br/> <strong>Year Registered: *</strong> <input type="text" name="yearregistered" value="<?php echo $yearregistered; ?>"/> <br/> <strong>Transmission: *</strong> <input type="text" name="transmission" value="<?php echo $transmission; ?>"/> <br/> <strong>Mileage: *</strong> <input type="text" name="mileage" value="<?php echo $mileage; ?>"/> <br/> <strong>Number of Doors: *</strong> <input type="text" name="nodoors" value="<?php echo $nodoors; ?>"/> <br/> <strong>Body Style: *</strong> <input type="text" name="bodystyle" value="<?php echo $bodystyle; ?>"/> <br/> <strong>Price: *</strong> <input type="text" name="price" value="<?php echo $price; ?>"/> <br/> <strong>Photo One:</strong> <input type='hidden' name='size' value='350000'><input type='file' name='photo[]'> <br> <strong>Photo Two:</strong> <input type='hidden' name='size' value='350000'><input type='file' name='photo[]'> <br> <input type="submit" name="submit" value="Submit"> </div> </form> sorry was not sure what other I need to show, so you guys get the idea?
-
Am getting somewhere now after the steps mentioned above 1) DONE 2) Got the session value for the userID in the INSERT query to associate the listing with the user who submitted it. 3) On the profile page, I got the link called view listings and am already getting the user id displayed in the url - view-private-listings.php?id=4 so now just need to get the listings only displayed on that view-private-listings.php page for that user ie id=4 then same for another user if they was logged in so am getting the user id passed in the url so that side is ok just the user id 4 listings displayed on the view listings page if submitted by user id 4 but at the mo am getting all the listings displayed on the view listings page submitted by user id 4 or not will have another look tomorrow morning and see if can work it out but feel a step closer, sorry for being a pain and difficult, I know it can be done and is easy when you know how but will get there im determined with it Thank you, sorry again
-
Thank you appreciate the help, sorry yeah my fault did forget to mention that users won't be able to view other users pages