Jump to content

QuickOldCar

Staff Alumni
  • Posts

    2,972
  • Joined

  • Last visited

  • Days Won

    28

Everything posted by QuickOldCar

  1. Posted code so others do not have to download. add_to_cart.php <?php session_start(); include 'includes/conn_db.php'; /*$jobid_out = $_GET['jobid'];*/ $med_year = date('Y'); $byear = $med_year - 60; $ryear = $med_year + 1; $year = range($byear,$med_year); $yearr = range($ryear,$med_year); $query = "SELECT * from config"; $result = mysql_query($query, $conn); while ($row = mysql_fetch_assoc($result)){ $address1_out = $row["address1"]; $address2_out = $row["address2"]; $suburb_out = $row["suburb"]; $city_out = $row["city"]; $tel_out = $row["tel"]; $fax_out = $row["fax"]; /*$cell_out = $row["cell"];*/ $mail_out = $row["email"]; $code_out = $row["postal_code"]; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <meta http-equiv="X-UA-Compatible" content="IE=Edge" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta name="keywords" content="Riccados, restaurant, diner, chicken, fish, sushi, johannesburg, braamfontein, gauteng, south africa, breakfast, sandwiches, omelettes, soups, burgers, steak, grill, lamb, seafood, poultry, salads, pizza, pasta, sushi, desserts, bakery, drinks, cocktails, shooters, draughts, events, birthdays, celebrations, its your vibe" /><meta name="description" content="Riccados, situated in Braamfontein bringing the ambience and vibe for a perfect end to the day, Riccados promises to be a place for all people to feel welcome." /> <meta name="robots" content="index, follow" /> <title>Riccados Restaurant - It's your vibe</title> <link rel="stylesheet" href="css/font1/droidserif.css" /> <link href="css/riccados.css" type="text/css" rel="stylesheet" /> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" src="js/thickbox.js"></script> <script type="text/javascript"> /*** Simple jQuery Slideshow Script Released by Jon Raasch (jonraasch.com) under FreeBSD license: free to use or modify, not responsible for anything, etc. Please link out to me if you like it ***/ function slideSwitch() { var $active = $('#slideshow IMG.active'); if ( $active.length == 0 ) $active = $('#slideshow IMG:last'); // use this to pull the images in the order they appear in the markup var $next = $active.next().length ? $active.next() : $('#slideshow IMG:first'); // uncomment the 3 lines below to pull the images in random order // var $sibs = $active.siblings(); // var rndNum = Math.floor(Math.random() * $sibs.length ); // var $next = $( $sibs[ rndNum ] ); $active.addClass('last-active'); $next.css({opacity: 0.0}) .addClass('active') .animate({opacity: 1.0}, 1000, function() { $active.removeClass('active last-active'); }); } $(function() { setInterval( "slideSwitch()", 5000 ); }); </script> </head> <body> <div id="main_cnt"> <table style="width:1000px"><tr><td> <div id="left_cnt"> <div id="slideshow"> <img src="images/contact1.jpg" alt="" class="active" /> <img src="images/contact2.jpg" alt="" /> <img src="images/contact3.jpg" alt="" /> <img src="images/contact4.jpg" alt="" /> </div></div> <table width="1000"><tr><td width="300"> <div id="right_cnt"><img src="images/logo.png" id="logo" alt="Riccados" /><br /> <div id="nav_ctr"> <div id='cssmenu'> <ul> <li class='active '><a href='index.php'><span>HOME</span></a></li> <li><a href=''><span>MENU</span></a> <ul> <li><a href='menu.php?menuid=1'><span>BREAKFASTS</span></a></li> <li><a href='menu.php?menuid=2'><span>OMELETTES</span></a></li> <li><a href='menu.php?menuid=3'><span>SANDWICHES</span></a></li> <li><a href='menu.php?menuid=4'><span>STARTERS</span></a></li> <li><a href='menu.php?menuid=5'><span>SALADS</span></a></li> <li><a href='menu.php?menuid=6'><span>PASTAS</span></a></li> <li><a href='menu.php?menuid=7'><span>BEEF MAINS</span></a></li> <li><a href='menu.php?menuid=8'><span>PREGO'S & BURGERS</span></a></li> <li><a href='menu.php?menuid=9'><span>LAMB & RIB MAINS</span></a></li> <li><a href='menu.php?menuid=10'><span>CHICKEN & SEAFOOD MAINS</span></a></li> <li><a href='menu.php?menuid=11'><span>COMBOS</span></a></li> <li><a href='menu.php?menuid=12'><span>PIZZAS</span></a></li> <li><a href='menu.php?menuid=13'><span>SUSHI</span></a></li> <li><a href='menu.php?menuid=14'><span>DESSERTS</span></a></li> <li><a href='menu.php?menuid=15'><span>KIDDIES</span></a></li> <li><a href='menu.php?menuid=16'><span>DRINKS</span></a></li> </ul> <li><a href="bookings.php"><span>BOOKINGS</span></a></li> <li><a href='events.php'><span>EVENTS</span></a> </li> <li><a href='gallery.php'><span>GALLERY</span></a> </li> <li><a href='about.php'><span>ABOUT RICCADOS</span></a></li> <li><a href='contact.php'><span>CONTACT RICCADOS</span></a></li></ul> </div> </div> </div> <br /><br /> <br /><br /> <div id="left_cnt"> <table width="300"><tr><td valign="top"> <div id="contact_body"> <a href="https://www.facebook.com/pages/Riccados/1418413421809723?ref=bookmarks" target="_blank"><img src="images/facebook.png" border="0" alt="Find us on Facebook" /></a> <a href="https://twitter.com/RicardosRestuar" class="twitter-follow-button" data-show-count="false" target="_blank"><img src="images/twitter.png" border="0" alt="Find us on Twitter" /></a> <br /> <a href="" target="_blank"><img src="images/linkedin.png" border="0" alt="Find us on LinkedIn" /></a> <a href="" target="_blank"><img src="images/instagram.png" border="0" alt="Find us on Instagram" /></a><br /><br /> <?php print $address1_out ?><br /> <?php if (!empty($address2_out)) { print $address2_out;print "<br>"; } ?> <?php print $suburb_out ?><br /> <?php print $city_out ?><br /> <?php print $code_out ?><br /> Tel: <?php print $tel_out ?><br /> <!--- Fax: --> <?php /*print $fax_out */?><br /> Email: <a href="mailto:<?php print $mail_out ?>" style="color:white"><?php print $mail_out ?></a> </div> <?php $curr_date = date('Y-m-d'); $query4 = "SELECT * from riccados_events WHERE event_sort_date >= '$curr_date'"; // display the products in each subcat $result4 = mysql_query($query4, $conn); $num_rows = mysql_num_rows($result4); if ($num_rows > 0) { echo '<div id="events_heading"></div><div id="events_text">'; } $query4 = "SELECT * from riccados_events WHERE event_sort_date >= '$curr_date' ORDER BY event_sort_date ASC LIMIT 8"; // display the products in each subcat $result4 = mysql_query($query4, $conn); while ($row4 = mysql_fetch_assoc($result4)){ $description_out = $row4["event_name"]; $date_out = $row4["event_date"]; $event_desc_out = $row4["event_desc"]; echo '<p></p><strong>' . $description_out . '</strong><br />' . $date_out . '<p></p>' . $event_desc_out . '<br /><a href="events.php" style="float: right;margin-right: 10px; color: white;text-decoration: none;font-style:italic">Continue Reading</a><br />'; } if ($num_rows > 0) { echo '<br /><br />'; } ?> </div> </div> </td> <td width="700" style="color: white;font-family:Arial, Helvetica, sans-serif;font-size:14px"><br /> <div id="right_cnt"> <div id="contact_heading_main"></div> <div id="contact_us_cnt"><div id="contact_main_cnt_two_text"><p></p> <?php $qty_out = 1; $qty1 = $qty_out; // This page adds products to the shopping cart if (isset($_POST['Bread'])) { $_SESSION['bread'] = $_POST['Bread']; } if (is_numeric ($_SESSION['prodid'])) { // check for a print id $pid = $_SESSION['prodid']; // check to see if the cart already contains one of these products if (isset ($_session['cart'][$pid])) { $qty_out = $_SESSION['cart'][$pid] + $qty1; } else { $qty = $qty1; } // add to the cart session variable $_SESSION['cart'][$pid] = $qty; // Display a message echo '<table summary="" align="center" border="0" bgcolor="white"><tr><td width="370">'; echo '<p><font face="arial" size="2" color="#666666">Your product has been added to your cart<br></font></td></tr><tr><td><form action="view_cart.php" method="post"><input type="submit" name="view_barrel" value="View Cart"></form></td></tr></table>'; } ?></div></div> </td></tr></table> <div id="footer"><div style="margin-left:50px;font-family:Arial, Helvetica, sans-serif;font-size:11px;color:white;margin-top:35px;display:block"><br />Copyright © 2015 Riccados </div><div style="float: right;margin-right:46px;;font-family:Arial, Helvetica, sans-serif;font-size:11px;color:white;display:inline-block;margin-top:-27px">Website designed and developed by <a href="http://www.it-people.co.za" target="_blank"><img src="images/itpeople.png" alt="IT People" style="margin-top:-10px;width:78px;height:35px" /></a></div> </div> </div> </body> </html> view_cart.php <?php session_start(); include 'includes/conn_db.php'; /*$jobid_out = $_GET['jobid'];*/ $med_year = date('Y'); $byear = $med_year - 60; $ryear = $med_year + 1; $year = range($byear,$med_year); $yearr = range($ryear,$med_year); $query = "SELECT * from config"; $result = mysql_query($query, $conn); while ($row = mysql_fetch_assoc($result)){ $address1_out = $row["address1"]; $address2_out = $row["address2"]; $suburb_out = $row["suburb"]; $city_out = $row["city"]; $tel_out = $row["tel"]; $fax_out = $row["fax"]; /*$cell_out = $row["cell"];*/ $mail_out = $row["email"]; $code_out = $row["postal_code"]; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <meta http-equiv="X-UA-Compatible" content="IE=Edge" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta name="keywords" content="Riccados, restaurant, diner, chicken, fish, sushi, johannesburg, braamfontein, gauteng, south africa, breakfast, sandwiches, omelettes, soups, burgers, steak, grill, lamb, seafood, poultry, salads, pizza, pasta, sushi, desserts, bakery, drinks, cocktails, shooters, draughts, events, birthdays, celebrations, its your vibe" /><meta name="description" content="Riccados, situated in Braamfontein bringing the ambience and vibe for a perfect end to the day, Riccados promises to be a place for all people to feel welcome." /> <meta name="robots" content="index, follow" /> <title>Riccados Restaurant - It's your vibe</title> <link rel="stylesheet" href="css/font1/droidserif.css" /> <link href="css/riccados.css" type="text/css" rel="stylesheet" /> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" src="js/thickbox.js"></script> <script type="text/javascript"> /*** Simple jQuery Slideshow Script Released by Jon Raasch (jonraasch.com) under FreeBSD license: free to use or modify, not responsible for anything, etc. Please link out to me if you like it ***/ function slideSwitch() { var $active = $('#slideshow IMG.active'); if ( $active.length == 0 ) $active = $('#slideshow IMG:last'); // use this to pull the images in the order they appear in the markup var $next = $active.next().length ? $active.next() : $('#slideshow IMG:first'); // uncomment the 3 lines below to pull the images in random order // var $sibs = $active.siblings(); // var rndNum = Math.floor(Math.random() * $sibs.length ); // var $next = $( $sibs[ rndNum ] ); $active.addClass('last-active'); $next.css({opacity: 0.0}) .addClass('active') .animate({opacity: 1.0}, 1000, function() { $active.removeClass('active last-active'); }); } $(function() { setInterval( "slideSwitch()", 5000 ); }); </script> </head> <body> <div id="main_cnt"> <table style="width:1000px"><tr><td> <div id="left_cnt"> <div id="slideshow"> <img src="images/contact1.jpg" alt="" class="active" /> <img src="images/contact2.jpg" alt="" /> <img src="images/contact3.jpg" alt="" /> <img src="images/contact4.jpg" alt="" /> </div></div> <table width="1000"><tr><td width="300"> <div id="right_cnt"><img src="images/logo.png" id="logo" alt="Riccados" /><br /> <div id="nav_ctr"> <div id='cssmenu'> <ul> <li class='active '><a href='index.php'><span>HOME</span></a></li> <li><a href=''><span>MENU</span></a> <ul> <li><a href='menu.php?menuid=1'><span>BREAKFASTS</span></a></li> <li><a href='menu.php?menuid=2'><span>OMELETTES</span></a></li> <li><a href='menu.php?menuid=3'><span>SANDWICHES</span></a></li> <li><a href='menu.php?menuid=4'><span>STARTERS</span></a></li> <li><a href='menu.php?menuid=5'><span>SALADS</span></a></li> <li><a href='menu.php?menuid=6'><span>PASTAS</span></a></li> <li><a href='menu.php?menuid=7'><span>BEEF MAINS</span></a></li> <li><a href='menu.php?menuid=8'><span>PREGO'S & BURGERS</span></a></li> <li><a href='menu.php?menuid=9'><span>LAMB & RIB MAINS</span></a></li> <li><a href='menu.php?menuid=10'><span>CHICKEN & SEAFOOD MAINS</span></a></li> <li><a href='menu.php?menuid=11'><span>COMBOS</span></a></li> <li><a href='menu.php?menuid=12'><span>PIZZAS</span></a></li> <li><a href='menu.php?menuid=13'><span>SUSHI</span></a></li> <li><a href='menu.php?menuid=14'><span>DESSERTS</span></a></li> <li><a href='menu.php?menuid=15'><span>KIDDIES</span></a></li> <li><a href='menu.php?menuid=16'><span>DRINKS</span></a></li> </ul> <li><a href="bookings.php"><span>BOOKINGS</span></a></li> <li><a href='events.php'><span>EVENTS</span></a> </li> <li><a href='gallery.php'><span>GALLERY</span></a> </li> <li><a href='about.php'><span>ABOUT RICCADOS</span></a></li> <li><a href='contact.php'><span>CONTACT RICCADOS</span></a></li></ul> </div> </div> </div> <br /><br /> <br /><br /> <div id="left_cnt"> <table width="300"><tr><td valign="top"> <div id="contact_body"> <a href="https://www.facebook.com/pages/Riccados/1418413421809723?ref=bookmarks" target="_blank"><img src="images/facebook.png" border="0" alt="Find us on Facebook" /></a> <a href="https://twitter.com/RicardosRestuar" class="twitter-follow-button" data-show-count="false" target="_blank"><img src="images/twitter.png" border="0" alt="Find us on Twitter" /></a> <br /> <a href="" target="_blank"><img src="images/linkedin.png" border="0" alt="Find us on LinkedIn" /></a> <a href="" target="_blank"><img src="images/instagram.png" border="0" alt="Find us on Instagram" /></a><br /><br /> <?php print $address1_out ?><br /> <?php if (!empty($address2_out)) { print $address2_out;print "<br>"; } ?> <?php print $suburb_out ?><br /> <?php print $city_out ?><br /> <?php print $code_out ?><br /> Tel: <?php print $tel_out ?><br /> <!--- Fax: --> <?php /*print $fax_out */?><br /> Email: <a href="mailto:<?php print $mail_out ?>" style="color:white"><?php print $mail_out ?></a> </div> <?php $curr_date = date('Y-m-d'); $query4 = "SELECT * from riccados_events WHERE event_sort_date >= '$curr_date'"; // display the products in each subcat $result4 = mysql_query($query4, $conn); $num_rows = mysql_num_rows($result4); if ($num_rows > 0) { echo '<div id="events_heading"></div><div id="events_text">'; } $query4 = "SELECT * from riccados_events WHERE event_sort_date >= '$curr_date' ORDER BY event_sort_date ASC LIMIT 8"; // display the products in each subcat $result4 = mysql_query($query4, $conn); while ($row4 = mysql_fetch_assoc($result4)){ $description_out = $row4["event_name"]; $date_out = $row4["event_date"]; $event_desc_out = $row4["event_desc"]; echo '<p></p><strong>' . $description_out . '</strong><br />' . $date_out . '<p></p>' . $event_desc_out . '<br /><a href="events.php" style="float: right;margin-right: 10px; color: white;text-decoration: none;font-style:italic">Continue Reading</a><br />'; } if ($num_rows > 0) { echo '<br /><br />'; } ?> </div> </div> </td> <td width="700" style="color: white;font-family:Arial, Helvetica, sans-serif;font-size:14px;;<br /> <div id="right_cnt"> <div id="contact_heading_main"></div> <div id="contact_us_cnt"><div id="contact_main_cnt_two_text"><p></p> <?php if (isset($_POST['submit'])) { foreach ($_POST['qty'] as $key => $value) { if (($value == 0) AND (is_numeric($value))) { unset ($_SESSION['cart'][$key]); } elseif (is_numeric($value) AND ($value > 0)) { $_SESSION['cart'][$key] = $value; } } } // check if the shopping cart is empty $empty = TRUE; if (isset($_SESSION['cart'])) { foreach($_SESSION['cart'] as $key => $value) { if (isset($value)) { $empty = FALSE; } } } // Display the cart if it is not empty if (!$empty) { // Retrieve all of the information for the products in the cart $query = 'SELECT * FROM submenu_name WHERE submenu_id IN ('; foreach ($_SESSION['cart'] as $key => $value) { $query .= $key . ','; } $query = substr ($query, 0, -1) . ') ORDER BY submenu_name ASC'; $result = mysql_query($query); $final_item_name = $_SESSION['final_name']; // create a table and a form print <<<TOP <table summary="" width="580" align="center" style="; <tr> <td nowrap align="center">Your Shopping Cart</td></tr></table> <table summary="" align="center" width="580" border="1" style="; <tr> <td> <table border="0" width="580" cellpadding="3"> <tr> <td align="left" width="250"><font face="arial" size="2" color="#666666"><b>Item</b></font></td> <td align="center" width="70"><font face="arial" size="2" color="#666666"><b>Qty</b></font></td> <td align="right" width="120"><font face="arial" size="2" color="#666666"><b>Unit Price</b></font></td> <td align="right" width="120"><font face="arial" size="2" color="#666666"><b>Line Total</b></font></td> </tr> <form action="view_cart.php" method="post"> TOP; // Print each item $total = 0; // total cost of the order while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $list_price_out = $row['item_price']; $list_price_out = number_format($list_price_out, 2, '.', ''); // Calculate the total and subtotals $subtotal = $_SESSION['cart'][$row['submenu_id']] * $list_price_out; $subtotal = number_format($subtotal, 2, '.', ''); $total += $subtotal; $total = number_format($total, 2, '.', ''); // print the row print <<<ROW <tr> <td align="left"><font face="arial" size="2" color="#666666">$final_item_name</font></td> <td align="center"><input type="text" size="3" name="qty[{$row['submenu_id']}]" value="{$_SESSION['cart'][$row['submenu_id']]}"> </td><td align="right"><font face="arial" size="2" color="#666666">R $list_price_out </font></td><td align="right"><font face="arial" size="2" color="#66666">R $subtotal</font></td> </tr> ROW; } // end of the WHILE loop // print the footer and close the table and the form //$finq = $_SESSION['cart'][$row['prod_id']]; print <<<FOOTER <tr> <td></td><td></td> <td align="right" valign="top"><font face="arial" size="2" color="#666666"><b>Sub Total:</b></font></td> <td align="right" valign="top"><font face="arial" size="2" color="#666666"><b> $total</b></font><br></td> </tr> FOOTER; print <<<FOOTER1 </table> <table width="500" align="center" border="1"> <tr><td align="center"><font face="arial" size="2" color="#666666">To change the quantities change the figure in the Qty box, and your Shopping Cart will automatically be updated after clicking on the <strong>Update Cart button</strong>. <br>If you change the quantity to zero, then that item will be deleted from your Shopping Cart.</font></td></tr> </table> <table width="580" align="center"> <tr><br><td width="85"></td><td width="150" valign="top" align="center"><input type="submit" name="submit" value="Update Cart"></form></td><td width="150" align="center"> </td><td width="130" align="center"><form action="checkout.php" method="post"><input type="submit" name="checkout" value="Checkout"></form> </td><td width="85"></td></tr></table> FOOTER1; } else { print <<<EMP <table border="0" width="580" align="center" style="; <tr> <td> <table summary="" width="300" border="1" style="border-color:#960232" bgcolor="#f8f3c2" align="center"> <tr> <td> <table border="0" width="300" cellpadding="3"> <tr><td align="center"><p><font face="arial" size="2" color="#5e5d5d">Your cart is empty!</font></td></tr></table></table> EMP; } ?> </div></div> </tr> </table></table> <div id="footer"><div style="margin-left:50px;font-family:Arial, Helvetica, sans-serif;font-size:11px;color:white;margin-top:35px;display:block"><br />Copyright © 2015 Riccados </div><div style="float: right;margin-right:46px;;font-family:Arial, Helvetica, sans-serif;font-size:11px;color:white;display:inline-block;margin-top:-27px">Website designed and developed by <a href="http://www.it-people.co.za" target="_blank"><img src="images/itpeople.png" alt="IT People" style="margin-top:-10px;width:78px;height:35px" /></a></div> </div> </div> </body> </html>
  2. As for the form part and image upload it's works, I tested it. Are you doing the mysql connection and correct credentials. Is the table name correct and it's column names, what type of data types? You can try to enable error reporting, place this the very top of your script. error_reporting(E_ALL); ini_set('display_errors', '1');
  3. Here is a headstart for you. <form action="" method="post" enctype="multipart/form-data"> <tr> <th width="40%">Nome da categoria</th> <th><input type="text" name="pname"class="form-control" placeholder="Introduz o Titulo da Descrição" onKeyPress="return alpha(event)" style="text-transform:lowercase;" required> <span id="error" style="color: Red; display: none">* Special Characters not allowed</span> <script> function alpha(e) { var k; document.all ? k = e.keyCode : k = e.which; return ((k > 64 && k < 91) || (k > 96 && k < 123) || k == 8 || k == 32 || (k >= 48 && k <= 57)); } </script> </th> </tr> <tr> <th>Descriçao Categoria</th> <td><input type="text" name="pdes" class="form-control" placeholder="Introduz a Descrição da categoria" required></td> </tr> <tr> <th width="40%"><i class="icon_profile"></i>Image</th> <td><input type="file" name="image" required></td> </tr> </tbody> </table> <header class="panel-heading"><div align="center"><button type="submit" name="Submit" class="btn btn-primary">Adicionar</button></div></header> </form> <?php if (isset($_POST['Submit'])) { $pdes = $_POST['pdes']; $pname = $_POST['pname']; if ($_FILES["file"]["error"] > 0) echo "Error: " . $_FILES["image"]["error"] . "<br />"; else { echo "Upload: " . $_FILES['image']['name'] . "<br />"; echo "Type: " . $_FILES['image']['type'] . "<br />"; echo "Size: " . ($_FILES['image']['size'] / 1024) . " Kb<br />"; echo "Stored in: " . $_FILES['image']['tmp_name']; } $result = mysql_query("insert into categorias(pdes, pname, image) values ('$pdes', '$pname', '" . $_FILES['image']['name'] . "')") or die(mysql_error()); if ($result) { echo "<meta http-equiv=\"refresh\" content='0; url=?pg=4&msg=1'>", exit; } else { echo "<meta http-equiv=\"refresh\" content='0; url=?pg=4&msg=2'>"; exit; } } ?> You won't see the image data because you redirect, but it's there. You should be using pdo with prepared statements or mysqli functions using mysqli_real_escape_string This is a minimum should be doing, should also be checking image types,sizes,renaming the images(possibly adding timestamp to prevent duplicates), you can not trust anyone with what they insert in forms. You most likely want to add move_uploaded_file() to place the image in a desired directory.
  4. Will only work when this statement is met. if(isset($_POST['enviar']) && $_POST['enviar']=="guardar"){ I do not see an enviar in the code.
  5. I'll go by your title You show a partial form, insert what to where? Need to show code pertaining to that and explain what is not working.
  6. If is really large can copy the mysql data files themselves and overwrite in new site. In linux or debian based such as ubuntu is located in /var/lib/mysql/ Each database will have it's own folder, it's table will have multiple files. Windows based is usually C:\Program Files\MySQL\MySQL Server 5.7 or simply C:\mysql, depends where mysql was installed. If a table is corrupt use the repair function http://dev.mysql.com/doc/refman/5.7/en/repair-table.html REPAIR TABLE table_name QUICK; If this for some reason it fails try use_frm to repair the myi file REPAIR TABLE table_name USE_FRM; I've done huge databases this way and works much better and faster than exporting and importing large sql files. Edit: I noticed you said free host which limits the folders can access, may need to export and import each table with a sql file. Database management programs such as phpmyadmin can do this.
  7. Because you echo out 2 in the while loop. You have this 2 times in the loop echo "<br><div class=\"col-md-4 \"><ul class=\"list-group\">"; echo "<li class=\"list-group-item\"><strong>Number of Cylinders:</strong> $vehicle[cylender_count]</li>"; echo "<li class=\"list-group-item\"><strong>Displacement:</strong> $vehicle[eng_size]</li>"; echo "<li class=\"list-group-item\"><strong>Horsepower:</strong> $vehicle[eng_hp]</li>"; echo "<li class=\"list-group-item\"><strong>Transmission:</strong> $vehicle[transmission]</li>"; echo "<li class=\"list-group-item\"><strong>Color(extr/intr):</strong> $vehicle[ext_color]/$vehicle[int_color] </li>"; echo "<li class=\"list-group-item\"><strong>Fuel Tank Capacity:</strong> $vehicle[fuel_tank_capacity] Gal.</li>"; echo "</ul></div>";
  8. This is wrapped with form tags...correct? Default method is get in a form, if you use POST for the method would be this. if(isset($_POST['user']) && trim($_POST['user']) !=''){ $user = trim($_POST['user']); } if(isset($_POST['password']) && trim($_POST['password']) !=''){ $password = trim($_POST['password']); } if($user && $password){ //registration: perform new user insert info with hashed password //login: verify that users password same as in database } As for encrypting passwords password_hash() and password_verify() For database functions should be using mysqli or pdo
  9. I'm not saying we are unfriendly talkative people here...but the way we do it here is to paste any relevant code and your problem. The answers should help you see the solution and many times the poster will explain why to do it a certain way. Not sure how you expect to learn without reading, is pretty hard to learn it otherwise. You can ask these specific questions in the forum.
  10. This isn't a php based coding question. Your question is related to ImageMagik itself. There is a cylinderize script for ImageMagik that can help you on your way. Is also cylinderwarp to create multiple angles and rotation for use as a spinning animation.
  11. Might depend a specific browser handling meta redirect. Instead use header() Not sure why would even want to show a message, could just send them new site, will show both ways though. Direct redirect <?php header("Location: http://www.desmond-otoole.co.uk/",TRUE,301); ?> Delayed redirect with message <?php header( "Refresh:10; url=http://www.desmond-otoole.co.uk/",TRUE,301); echo "Unfortunatly this site is closed. You will be shortly re-directed to the new site (www.des-otoole.co.uk) shortly."; ?> Could also do htaccess redirect rules to make old links lead to new links a different domain.
  12. Since we are in the php forum could use array_chunk() to split the array of results into chunks. You can also do this with html or css. Table,style,css...get creative. As simple as can explain it without getting crazy styling it. <?php $html = array(); $mysqli = new mysqli("localhost", "user", "password", "database"); $sql = "SELECT column_name FROM table_name"; $result = $mysqli->query($sql); while ($row = $result->fetch_assoc()) { $html[] = "<td>" . $row['column_name'] . "</td>"; } $html = array_chunk($html, 3); // 3 chunks ?> <!DOCTYPE html> <html> <head> </head> <table> <?php foreach ($html as $chunk) { echo "<tr>" . implode('', $chunk) . "</tr>"; } ?> </table> </html> an array using array_chunk and css <?php //how many display columns $number_columns = 8; //dummy array data $array = range(1, 100); //percentage for css division of page width $percentage = floor(100 / $number_columns); //create chunks from the array calculating amount in array and number of columns $columns = array_chunk($array, ceil(count($array) / $number_columns)); //loop the chunked columns foreach ($columns as $chunk) { //opted to make a divider and style echo "<div style='padding:10px;'>"; //loop each array value within the chunk foreach ($chunk as $values) { //opted to make a paragraph and style echo "<p style='display:block;float:left;width: " . $percentage . "%;'>" . $values . "</p>"; } echo "</div>"; } ?>
  13. Forget the email for the moment, you are doing 600 connections and queries in the for loop.
  14. I would make each unique channel an associative array in the loop, then foreach unique channels saving the file as xml. There is nowhere in the current code that distinguishes one channel from the others in the loop. It's everything. It would be easier for us with an example html. Something along the lines of this: //before loop $array = array(); //inside loop $array[$channel][] = array("name"=>$programname->nodeValue,"time"=>$programtime->nodeValue,"description"=>$descrip->nodeValue); Later on outside the loop foreach($array as $key=>$value){ //make your xml and save }
  15. imagecopymerge() Forgot the link to watermark example. http://php.net/manual/en/image.examples.merged-watermark.php
  16. That's interesting Barand, I always used the different functions depending what was saved as. Way too many date related functions. I prefer to store as datetime for my own work because is human readable , already string formatted, plus not sure what would happen after 2038 if using timestamp. Yeah a long way off but I suppose have to think of the future, the last 20 years zipped right past me. Timestamp has a date range from 1970 to 2038, most likely would make a fix by then, maybe 40 more date related functions.
  17. Since you saved as a timestamp: $query_rsWorkedToday = "SELECT COUNT(*) FROM history WHERE DATE(`history_date`) = CURDATE()"; If it was stored as datetime would use: $query_rsWorkedToday = "SELECT COUNT(*) FROM history DATE_FORMAT(history_date, '%Y-%m-%d') = CURDATE()";
  18. Instead of wasting money upgrading that pc maybe should opt a new one. If can plug a few items together and build your own.... I built a few of this exact barebones kits lately from tigerdirect and they were all extremely happy. Intel Core i5 4690 3.5GHz Quad-Core CPU/Asus H81M-PLUS mATX MB/2 x 4GB DDR3 1600 Adata XPG V1 Memory/1TB WD Blue 7200rpm SATA HDD/Ultra X-Blaster Pro Case w/650W PSUhttp://www.tigerdirect.com/applications/SearchTools/item-details.asp?EdpNo=9687613&CatId=11845 $449 I also like adding the 120mm silent fans, is a 4 pack for $15 Cooler Master Silent Fan 120 SI2 - Case fan - 120 mm - blackhttp://www.tigerdirect.com/applications/SearchTools/item-details.asp?EdpNo=3190904&CatId=494 Need a dvdrom. ASUS Internal 24X DVD Burner - Compatible With Windows 8, Saves Over 50% Of Power Consumption, Disc Encryption II, Password Control, Hides Files Names, Friendly Interface (DRW-24F1ST)http://www.tigerdirect.com/applications/SearchTools/item-details.asp?EdpNo=8324537&CatId=89 $20 This particular motherboard does not have enough fan plugs on it, so I also get a fan controller. AeroCool X-1000 Strike-X-X1000 Fan Controller - Controls 5 Fans, LED, Supports Up To 25W Per Fan Channel, Turns Fans Off, Overheating & fail Alarm, 2xUSB 3.0 Ports, 2xAudio Portshttp://www.tigerdirect.com/applications/SearchTools/item-details.asp?EdpNo=4904466&CatId=501 $14 Will also need new OS. New Windows, or if want to be faster, save money, not get viruses and have no need for windows for gaming or special applications.....Install Ubuntu or Linux Mint
  19. Any 64 bit operating system would struggle with only 2 gig memory. Memory is also being used for the onboard video. While the E5300 was no slouch when was created, it can not even compare the performance of the I5 or I7 quad cores You can look to see what is being used more in task manager, cpu or memory, my guess is memory. Running malwarebytes to ensure is no viruses could help.
  20. Not here to argue but to help, I'm moving on and good luck.
  21. You had lots of typo's,bad,missing,incorrect css in that, pretty sure you saw a white page. In the future can test it here. https://jigsaw.w3.org/css-validator/#validate_by_input+with_options fixed and passes: * { margin: 0px; padding: 0px; } header, section, aside, nav, article, hgroup { display: block; } body { background-image: url("/wp-content/themes/wonderland_designs/background.png"); display:block; background-repeat: repeat; text-align:center; font-family: georgia; font-size: 13px; background-color: #e8d8e1; width: 1000px; height: 1200px; } table { font-family: american typewriter; font-size: 14px; } #header_wrapper { width:1300px; margin:0px; text-align: justify; } #header { width: 1300px; margin:0; } #nav { width: 1300px; height: 200px; text-align: center; text-indent: 10px; } #nav a { font-family: american typewriter; font-size: 14px; letter-spacing: 5px; color: #fed3d3; } #nav a:hover { color: white; } #section { width: 650px; margin: 5px 2px 1px 5px; text-align:left; } #section_top { background-image: url("/wp-content/themes/wonderland_designs/images/section_top.png"); background-repeat: no-repeat; width: 650px; height: 50px; font-family: georgia; font-size: 15px; color: white; text-transform: capitalize; text-align: center; } #section_content { background-image: url("/wp-content/themes/wonderland_designs/images/section_content.png"); background-repeat: repeat-y; padding: 15px; background-color: white; } #section_bottom { background-image:url("/wp-content/themes/wonderland_designs/images/section_bottom.png"); width: 651px; height: 15px; margin-bottom:10px; } #aside { float: left; width: 250px; margin: 5px 7px; text-align: left; } #aside_content { background-image:url("/wp-content/themes/wonderland_designs/themes/images/aside_content.png"); background-repeat:repeat-y; padding: 5px 5px 0px 5px; } #aside_bottom { background-image: url("/wp-content/themes/wonderland_designs/aside_bottom.png"); width:245px; height: 20px; margin-bottom: 5px; } #footer{ font: american typewriter; clear:both; text-align:center; display:block; background-color: #fee4e4; width:100%; margin:0; padding-top:2px; color:#ffffff; text-transform:lowercase; } #footer a { color:#ffffff; } #footer a:hover { color:#e0d3bb; } #posts_info { height:30px; text-align:center; text-transform:lowercase; margin-top:10px; } h1 { font: 14px Georgia; letter-spacing:2px; text-transform:lowercase; text-align:justify; margin-top:0px; } h2 { font: 9px Georgia; text-transform:uppercase; text-align:left; margin-top:0px; } #section_content img { border: 5px solid rgba(0,0,0,.05); margin:0px; -webkit-transition: .4s ease-in-out; -moz-transition: .4s ease-in-out; -o-transition: .4s ease-in-out; transition:.4s ease-in-out; } #section_content img:hover { border: 5px solid #e53c2e; } #section_content img { border: 3px solid rgba(0,0,0,.05); -webkit-transition:.2s ease-in-out; -moz-transition:.2s ease-in-out; -o-transition:.2s ease-in-out; transition:.2s ease-in-out; } #aside_content img:hover { border: 3px solid #e53c2e; } blockquote { font-family:georgia; font-size:12px; line-height:100%; padding:10px; margin:0px 15px; border-left:5px solid white; } input,textarea { color: black; font-family:georgia; font-size:13px; line-height:100%; background-color:rgba(0,0,0,.05); border: 1px solid rgba(0,0,0,.2); } input:hover { border: 1px solid rgba(0,0,0,.05); } textarea:hover { border: 1px solid rgba(0,0,0,.05); } ol { padding: 7px 6px 0px 15px; margin:0px; list-style-type: decimal-leading-zero; font-weight:bold; } li { padding-bottom: 7px; font-weight:normal; font-weight: bold; } a:link, a:active, a:visited{ color:black; font-weight: normal; text-decoration:none; } a:hover{ color:white; }
  22. Now you lost me as to what you want.
  23. You will have to explain what is timing out.
  24. Your one example json is invalid { "currency": "CAD", "email": "toto@gmail.com", "items": [ { "name_title": "pen", "quantity": 2, "price": "20.00", "taxs": [ { "price": "1.00", "rates": 0.15, "name_title": "TaxOne" } ] }, { "name_title": "pensil", "quantity": 3, "price": "10.00", "taxs": [ { "price": "1.00", "rates": 0.15, "name_title": "TaxOne" } ] }, { "name_title": "notebook", "quantity": 2, "price": "5.00", "taxs": [ { "price": "1.00", "rates": 0.15, "name_title": "TaxOne" }, { "price": "1.38", "rates": 0.05, "name_title": "TaxSecond" } ] } ], "shipping_cost": [ { "code": "FDX", "price": "6.23", "name_title": "Fidex", "taxs": [ { "price": "1.55", "rates": 0.25, "name_title": "TaxOne" }, { "price": "2.37", "rates": 0.38, "name_title": "TaxSecond" } ] } ], "billing": { "names": "John Toto" }, "billing": { "names": "John Toto" }, "customers": { "invoce": null, "default_address": { "names": "John Toto" } } Parse error on line 77: ...oto" } } ---------------------^ Expecting '}', ',', ']' You can check your json at jsonlint
  25. Making the work order number the id would be the simplest solution, maybe even 5 years ago. You could try doing MAX on the column and get it's highest value, then a +1 SELECT MAX(work_order) AS work_order_number FROM tablename; Just be aware if is multiple submissions or slow this can mess up, so maybe also set a unique index on the work order column to prevent duplicates
×
×
  • 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.