Jump to content

Search the Community

Showing results for tags 'mysql'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

  1. I am new to PHP, i started developing application using php, please look into my code index.php <?php require_once('./config.php'); ?> <?php /* * Following code will get single product details * A product is identified by product id (pid) */ // array for JSON response $response = array(); // check for required fields if (isset($_POST['name'])) { $title = $_POST['name']; $company = $_POST['company']; require_once('./db_connect.php'); // connecting to db $db = new DB_CONNECT(); // mysql inserting a new row $result = mysql_query("INSERT INTO user(name,company) VALUES('$title','$company')"); } ?> <html> <head> <link type="text/css" rel="Stylesheet" href="style.css" /> <script type="text/javascript" src="jquery-1.7.2.js"></script> <script type="text/javascript"> $(window).load(function () { var tabContents = $(".tab_content").hide(), tabs = $("ul.tabs li"); tabs.first().addClass("active").show(); tabContents.first().show(); tabs.click(function() { var $this = $(this), activeTab = $this.find('a').attr('href'); if(!$this.hasClass('active')){ $this.addClass('active').siblings().removeClass('active'); tabContents.hide().filter(activeTab).fadeIn(); } return false; }); $(".tabbutton").click(function () { var nextTab = parseInt($("li.active").attr("id"), 10) + 1; if (nextTab === 4) { nextTab = 1; } tabs.removeClass("active"); $("#" + nextTab).addClass("active"); tabContents.hide(); $("#tab" + nextTab).fadeIn("slow"); }); }); </script> <script type="text/javascript" src="https://js.stripe.com/v1/"></script> <!-- jQuery is used only for this example; it isn't required to use Stripe --> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> <script type="text/javascript"> // this identifies your website in the createToken call below Stripe.setPublishableKey("<?php echo $stripe['publishable_key']; ?>"); function stripeResponseHandler(status, response) { if (response.error) { // re-enable the submit button $('.submit-button').removeAttr("disabled"); // show the errors on the form $(".payment-errors").html(response.error.message); } else { var form$ = $("#payment-form"); // token contains id, last4, and card type var token = response['id']; // insert the token into the form so it gets submitted to the server form$.append("<input type='hidden' name='stripeToken' value='" + token + "' />"); // and submit form$.get(0).submit(); } } $(document).ready(function() { $("#payment-form").submit(function(event) { // disable the submit button to prevent repeated clicks $('.submit-button').attr("disabled", "disabled"); // createToken returns immediately - the supplied callback submits the form if there are no errors Stripe.createToken({ number: $('.card-number').val(), cvc: $('.card-cvc').val(), exp_month: $('.card-expiry-month').val(), exp_year: $('.card-expiry-year').val() }, stripeResponseHandler); return false; // submit from callback }); }); <body> <ul class="tabs clearfix"> <li id="1"><a href="#tab1">Tab1</a></li> <li id="2"><a href="#tab2">Tab2</a></li> <li id="3"><a href="#tab3">Tab3</a></li> </ul> <div class="tab_container"> <div id="tab1" class="tab_content"> <form method="post"> <p> <label>Name:</label> <input type="text" name="name"> </p> <p> <label>Company:</label> <input type="text" name="company"> </p> <input type="submit" value="SAVE" class="tabbutton"/> </form> </div> <div id="tab2" class="tab_content"> <form id="payment-form" action="charge.php" method="post"> <h3>Purchase a quote by Oscar Wilde today! Only $535! Limited supply and going fast, buy now!!</h3> <!-- to display errors returned by createToken --> <span class="payment-errors"></span> <form action="charge.php" method="POST" id="payment-form"> <div class="form-row"> <label>Card Number</label> <input type="text" size="20" autocomplete="off" class="card-number" /> </div> <div class="form-row"> <label>CVC</label> <input type="text" size="4" autocomplete="off" class="card-cvc" /> </div> <div class="form-row"> <label>Expiration (MM/YYYY)</label> <input type="text" size="2" class="card-expiry-month"/> <span> / </span> <input type="text" size="4" class="card-expiry-year"/> </div> <button type="submit" class="submit-button">Buy!</button> </form> </form> </div> <div id="tab1" class="tab_content"> <p>Tab 3 Content Goes Here...</p> </div> </div> </body> </html> In Tab1 I'm saving data into database. Whenever user clicks on the save button the data needs to be saved into database and it will go to Tab2. I am successful while saving the data. My problem is it is not going to Tab2 after saving the data. When we click on the save button, the tab2 is just blinking but the page is still showing tab1 content. I want that whenever the user clicks on the save button the data needs to be saved in database and it will go to Tab2 content. Any suggestions?
  2. prolife

    Sql issue

    Hello please i dont know what went wrong ;this SQL is meant to count provided that this conditions are true. i want to count the total number of rooms that were booked for in a particular month. Please what is the right syntax to use when selecting from two different tables and then counting the total number of occurance. Here is the SQL i came up with but its messig up. SELECT (SELECT COUNT(*) FROM `rooms`) (SELECT COUNT(*) FROM `order`) AS `total_rooms` FROM `rooms` WHERE `order`.`checkin`>'$real_date' AND `rooms`.`cond` ='available'
  3. I'm trying to pass a NULL to a stored procedure in a PHP script to MySQL, and I am scrubbing the variables using mysql_real_escape_string, but the NULLs that are passed are giving me problems. My script should look like this: call spMyStoredProc(1,2,NULL,'username'); but unfortunately I get: call spMyStoredProc(1,2,,'username'); I am wondering if I want to move away from using mysql_real_escape_string, and possibly write my own function? Anybody have any ideas? thanks, Frank C
  4. I wrote this at the end of all the function in a class but then why i am getting a parse error of "?>" ??? public function international_list_display() { $international_categories = $_GET['international_categories']; $query = 'SELECT * FROM tourDB WHERE categories = "$international_categories"'; $result = mysql_query( $query ) or die ( mysql_error() ); if ( $result !== false && mysql_num_rows($result) > 0 ) { while ( $ilist = mysql_num_rows( $result ) > 0) { $tour_id = stripslashes( $ilist[ 'tour_id' ] ); $tour_type = stripslashes( $ilist[ 'tour_type' ] ); $tour_name = stripslashes( $ilist[ 'tour_name' ] ); $day = stripslashes( $ilist[ 'day' ] ); $nights = stripslashes( $ilist[ 'nights' ] ); $tour_price = stripslashes( $ilist[ 'tour_price' ] ); $overview = stripslashes( $ilist[ 'overview' ] ); $itinerary = stripslashes( $ilist[ 'itinerary' ] ); $terms_conditons = stripslashes( $ilist[ 'terms_conditons' ] ); $inclusions = stripslashes( $ilist[ 'inclusions' ] ); $exclusions = stripslashes( $ilist[ 'exclusions' ] ); $twin_triple_sharing = stripslashes( $ilist[ 'twin_triple_sharing' ] ); $single_occcupancy = stripslashes( $ilist[ 'single_occcupancy' ] ); $child_with_no_bed = stripslashes( $ilist[ 'child_with_no_bed' ] ); $inf_below = stripslashes( $ilist[ 'inf_below' ] ); $pricing_details = stripslashes( $ilist[ 'pricing_details' ] ); $url = stripslashes( $ilist[ 'url' ] ); $international_list_cat .= <<<INTERNATIONAL_LIST_CAT <div class="domestic-tours"> <ul> <li><a href="#overview_$url">Overview</a></li> <li><a href="#itinerary_$url">Itinerary</a></li> <li><a href="#inclusions_$url">Inclusions</a></li> <li><a href="#terms_$url">Terms And Conditions</a></li> <li><a href="#price_$url">Tour Price</a></li> </ul> <div id="overview_$url"> <!-- <div id="dest-thumb-nail" class="dest-thumb-nail"> <ul class="bjqs"> <li><img src="img/bangkok/1.jpg" /></li> <li><img src="img/bangkok/2.jpg" /></li> <li><img src="img/bangkok/3.jpg" /></li> <li><img src="img/bangkok/4.jpg" /></li> <li><img src="img/bangkok/5.jpg" /></li> <li><img src="img/bangkok/6.jpg" /></li> <li><img src="img/bangkok/6.jpg" /></li> </ul> </div> --> <div class="overview"> <span class="overview-heading">$tour_name</span><br /><br /> <span class="overview-duration">$nights Nights , $day Days</span><br /><br /> $overview </div> </div> <div id="itinerary_$url"> <div class="itin-content"> <span class="overview-heading">$tour_name</span><br /><br /> <span class="overview-duration">$nights Nights, $day Days</span><br /><br /><br /> $itinerary </div> </div> <div id="inclusions_$url"> <div class="inclusions-exclusions"> <span class="inclusions">Inclusions</span><br /><br /> $inclusions <br /> <br /> <span class="exclusions">Exclusions</span><br /><br /> $exclusions <br /> <br /> </div> </div> <div id="terms_$url"> <div class="terms" > <span class="terms-and-conditions" >Terms And Conditions </span><br /><br /> $terms_conditons </div> </div> <div id="price_$url"> <div class="price-tab" > <div class="price-tab-row" > <div class="price-tab-element"> <b>Pax Type</b> </div> <div class="price-tab-element"> <b>Tour Price Total in INR</b> </div> </div> <div class="price-tab-row" > <div class="price-tab-element" > Twin/Triple Sharing </div> <div class="price-tab-element" > <span class="rupee">`</span> $twin_triple_sharing </div> </div> <div class="price-tab-row" > <div class="price-tab-element" > Single Occupancy </div> <div class="price-tab-element" > <span class="rupee">`</span> $single_occcupancy </div> </div> <div class="price-tab-row"> <div class="price-tab-element" > Child With No Bed </div> <div class="price-tab-element"> <span class="rupee" >`</span> $child_with_no_bed </div> </div> <div class="price-tab-row"> <div class="price-tab-element"> Infant below 2 years </div> <div class="price=tab-element" > FREE </div> </div> <button id="book-now">Book Now !</button> <button id="call" >call your travel expert</button> </div> </div> </div> <div class="price-tag-domestic"><span class="pricy-price" >` $tour_price</span></div> <div class="cleaner"></div> INTERNATIONAL_LIST_CAT; } } else { $international_list_cat = <<<INTERNATIONAL_LIST_CAT <div class="domestic-tours"> <ul> <li><a href="#notice">Notice</a></li> </ul> <div id="notice" > <h2> This Page Is Under Construction </h2> <p> No entries have been made on this page. Please check back soon, or click the link below to add an entry! </p> </div> </div> INTERNATIONAL_LIST_CAT; } return $international_list_cat; }// end of international_list_display();
  5. SELECT * FROM tourDB WHERE tour_type = insta_deals I want to get the row where the column tour_type has a value of 'insta_deals'
  6. Please guys help me. I have a site with high traffic. Sometimes over 1k people online. I just got this brand new server because my other server was crashing all the time. I need to configure my.cnf and appache to handle the traffic without issues. Server stats. Dual Intel Xeon 5639 2.13Ghz - 2 Processors 12 Cores / 24 Threads 24GB DDR3 RAM Current My.cnf config: [mysqld] key_buffer=32M myisam_sort_buffer_size=64M join_buffer=2M sort_buffer=2M table_cache=2048 thread_cache_size=512 connect_timeout=60 wait_timeout=500 interactive_timeout=500 max_allowed_packet=16M tmp_table_size=128M max_heap_table_size=128M query_cache_limit = 2M query_cache_size = 512M query_cache_type = 1 #open_files_limit = 20000 thread_concurrency=16 max_connections=1000 log-slow-queries local-infile=0 connect_timeout = 60 Current httpd.conf config <IfModule prefork.c> StartServers 20 MinSpareServers 15 MaxSpareServers 35 ServerLimit 2000 MaxClients 2000 MaxRequestsPerChild 10000 </IfModule> <IfModule worker.c> StartServers 20 MaxClients 2000 ServerLimit 2000 MinSpareThreads 30 MaxSpareThreads 305 ThreadsPerChild 355 MaxRequestsPerChild 10000 </IfModule> Thanks in advance for the help.
  7. cdmafra

    ID to GUID

    Hello. I'm writing this post to ask a question: how to "transform" ID fields to GUID? Is there any solution? If not, how can I create a GUID field/column in my MySQL table?
  8. before i a had a bit of problem with MySQL but now i dont know what went wrong the script works fine , in genral but its first post is always double ..??? why so ?? i haven't repeated any thing .. did I ?? any guidance will be helpful. codes: index.php <link rel="stylesheet" type="text/css" href="css/bjqs.css" /> <link rel="stylesheet" type="text/css" media="only screen and (max-device-width: 990px)" href="css/mobile.css" /> <link rel="stylsheet" type="text/css" media="print" href="css/print.css" /> <link rel="stylesheet" type="text/css" href="css/jquery-ui-1.10.3.custom.css" /> <link href="style.css" rel="stylesheet" type="text/css" /> <link rel="stylesheet" href="css/jquery.wysiwyg.css" type="text/css"/> <script type="text/javascript" src="js/jquery-1.9.1.js"></script> <script type="text/javascript" src="js/bjqs-1.3.js"></script> <script type="text/javascript" src="js/jquery-ui-1.10.3.custom.js"></script> <script type="text/javascript" src="js/jquery.validate.js" ></script> <script type="text/javascript" src="js/jquery.wysiwyg.js"></script> <script type="text/javascript" src="js/wysiwyg.image.js"></script> <script type="text/javascript" src="js/wysiwyg.link.js"></script> <script type="text/javascript" src="js/wysiwyg.table.js"></script> <script type="text/javascript"> $(function domestic_boxes(){ $('.domestic-tours').tabs(); $('#book-now').button(); $('#call').button(); $('#submit').button(); }); $(function icons(){ // Hover states on the static widgets $( "#dialog-link, #icons li" ).hover( function() { $( this ).addClass( "ui-state-hover" ); }, function() { $( this ).removeClass( "ui-state-hover" ); } ); }); $(function slideslide() { $('#slider-inner').bjqs({ height : 400, width : 620, responsive : true }); $('#dest-thumb-nail').bjqs({ height : 200, width : 250, responsive : true }); $('#dest-thumb-nail-2').bjqs({ height : 200, width : 250, responsive : true }); }); $(function TourInput(){ $('#tour-package').tabs(); $('#days').keyup(function pickdays() { if (this.value != this.value.replace(/[^0-9\.]/g, '')) { this.value = this.value.replace(/[^0-9\.]/g, ''); } }); $('#nights').keyup(function picknights() { if (this.value != this.value.replace(/[^0-9\.]/g, '')) { this.value = this.value.replace(/[^0-9\.]/g, ''); } }); $('#twin_triple_shareing').keyup(function picknights() { if (this.value != this.value.replace(/[^0-9\.]/g, '')) { this.value = this.value.replace(/[^0-9\.]/g, ''); } }); $('#single_occupancy').keyup(function picknights() { if (this.value != this.value.replace(/[^0-9\.]/g, '')) { this.value = this.value.replace(/[^0-9\.]/g, ''); } }); $('#child_no_bed').keyup(function picknights() { if (this.value != this.value.replace(/[^0-9\.]/g, '')) { this.value = this.value.replace(/[^0-9\.]/g, ''); } }); $('#infbelow').keyup(function picknights() { if (this.value != this.value.replace(/[^0-9\.]/g, '')) { this.value = this.value.replace(/[^0-9\.]/g, ''); } }); $('#transportation').wysiwyg({ autoGrow: true, maxHeight: 600 }); $('#payment-norms').wysiwyg({ autoGrow: true, maxHeight: 600 }); $('#overview').wysiwyg({ autoGrow: true, maxHeight: 600 }); $('#inclusions').wysiwyg({ autoGrow: true, maxHeight: 600 }); $('#exclusions').wysiwyg({ autoGrow: true, maxHeight: 600 }); $('#itinerary').wysiwyg({ autoGrow: true, maxHeight: 600 }); $('#pricingdetails').wysiwyg({ autoGrow: true, maxHeight: 600 }); }); </script> <script type="text/javascript"> function removeSpaces(string) { return string.split(' ').join(''); } </script> </head> <body> <!--Header End --> <div id="header-inner"> <div class="header-top"> <div class="head-left"><a href="index.html" ><img src="img/site-logo.png" /></a></div> <div class="contact"><div class="head-left"><img height="50" width="55" src="img/telephone.png" /></div><div class="head-right">+919830042523</div></div> <div class="contact"><div class="head-left"><img height="50" width="55" src="img/email.png" /></div><div class="head-right">support@excitetrips.com</div></div> </div> <div class="cleaner"></div> </div> <!--Header End --> <!--Container --> <div id="container"> <div class="cleaner"></div> <div class="package-part-left" > <div class="domestic-tour-lists"> <?php include_once('_class/tourCMS.php'); $obj = new tourCMS(); /* SETTINGS FOR DATABASE */ $obj->host = 'localhost'; $obj->username = 'sim'; $obj->password = 'simptech'; $obj->table = 'sim'; $obj->connect(); if ( $_POST ) { /* printf('<pre>POST %s</pre>', print_r($_POST, true)); echo 'post initiated !!'; */ $obj->write($_POST); } /* if ( $_SERVER['REQUEST_METHOD'] == 'POST') { echo 'Request initiated for post !'; if($obj->write($_POST) === false) { echo 'Sorry, no data added to database'; } else { echo 'data has been added to database'; } } */ echo ( $_GET['admin'] == 1 ) ? $obj->display_admin() : $obj->display_public(); ?> </div> <div class="package-part-right" > <div class="international-tours-panel"> <div class="international-packages-header"> International Tour Packages </div> <a class="international-tour-box-element" href="#">Singapore Tour Packages</a> <a class="international-tour-box-element" href="#">Malasiya Tour Packages</a> <a class="international-tour-box-element" href="#">Thailand Tour Packages</a> <a class="international-tour-box-element" href="#">Japan Tour Packages</a> </div> <div class="domestic-tours-panel" > <div class="domestic-packages-header"> Holidays In India </div> <a class="domestic-tour-box-element" href="#">Kashmir Tour Packages</a> <a class="domestic-tour-box-element" href="#">Kerela Tour Packages</a> <a class="domestic-tour-box-element" href="#">West Bengal Tour Packages</a> </div> <div class="insta-deals-panel" > <div class="insta-deals-packages-header"> Insta Holidays Deals </div> <a class="insta-deals-box-element" href="#">Cheap Mauritius </a> <a class="insta-deals-box-element" href="#">Amazing Thailand</a> </div> <!-- <div class="international-tour-box" > <h3>International Tour Packages</h3> <div class="international-tour-element" > <a href="#">Singapore Tour Packages</a> </div> </div> <div class="domestic-tour-box" > <h3>Holidays In India</h3> </div> <div class="insta-deals-box" > <h3>Insta deals </h3> </div> --> </div> <!--container end --> </div> <div class="cleaner" ></div> <div class="cleaner"></div> <div class="ms_bottomWrap" ><div class="ms_bottomWrap_inner"><div class="hk_default00"> <div class="lfta"> <ul> <li><a href="#">Home</a></li> <li><a href="#">About Us</a></li> <li><a href="#">Blog</a></li> </ul> </div> <div class="lfta"> <ul> <li><a href="#">Car Rentals</a></li> <li><a href="#">Kolkata City tour</a></li> <li><a href="#">Gangasagar Day Tour</a></li> </ul> </div> <div class="lfta"> <ul> <li><a href="#"> Terms and Conditions</a></li> <li><a href="#"> Privacy Policy</a></li> <li><a href="#">Terms of Use</a></li> <li><a href="#">FAQ</a></li> </ul> </div> and tourCMS.php file : <?php class tourCMS { var $host; var $username; var $password; var $table; public function display_public() { $show = $_GET['show'] + 5; $q = "SELECT * FROM tourDB ORDER BY tour_id DESC LIMIT $show"; $r = mysql_query($q); if ($r !== false){ echo 'r is not false !'; } if ( $r !== false && mysql_num_rows($r) > 0 ) { while ( $a = mysql_fetch_assoc($r) ) { $tour_id = stripslashes($a['tour_id']); $tour_type = stripslashes($a['tour_type']); $tour_name = stripslashes($a['tour_name']); $day = stripslashes($a['day']); $nights = stripslashes($a['nights']); $tour_price = stripslashes($a['tour_price']); $overview = stripslashes($a['overview']); $itinerary = stripslashes($a['itinerary']); $terms_conditons = stripslashes($a['terms_conditons']); $inclusions = stripslashes($a['inclusions']); $exclusions = stripslashes($a['exclusions']); $twin_triple_sharing = stripslashes($a['twin_triple_sharing']); $single_occcupancy = stripslashes($a['single_occcupancy']); $child_with_no_bed = stripslashes($a['child_with_no_bed']); $inf_below = stripslashes($a['inf_below']); $pricing_details = stripslashes($a['pricing_details']); $url = stripslashes($a['url']); $entry_display .= <<<ENTRY_DISPLAY <div class="domestic-tours"> <ul> <li><a href="#overview_$url">Overview</a></li> <li><a href="#itinerary_$url">Itinerary</a></li> <li><a href="#inclusions_$url">Inclusions</a></li> <li><a href="#terms_$url">Terms And Conditions</a></li> <li><a href="#price_$url">Tour Price</a></li> </ul> <div id="overview_$url"> <!-- <div id="dest-thumb-nail" class="dest-thumb-nail"> <ul class="bjqs"> <li><img src="img/bangkok/1.jpg" /></li> <li><img src="img/bangkok/2.jpg" /></li> <li><img src="img/bangkok/3.jpg" /></li> <li><img src="img/bangkok/4.jpg" /></li> <li><img src="img/bangkok/5.jpg" /></li> <li><img src="img/bangkok/6.jpg" /></li> <li><img src="img/bangkok/6.jpg" /></li> </ul> </div> --> <div class="overview"> <span class="overview-heading">$tour_name</span><br /><br /> <span class="overview-duration">$nights Nights , $day Days</span><br /><br /> $overview </div> </div> <div id="itinerary_$url"> <div class="itin-content"> <span class="overview-heading">$tour_name</span><br /><br /> <span class="overview-duration">$nights Nights, $day Days</span><br /><br /><br /> $itinerary </div> </div> <div id="inclusions_$url"> <div class="inclusions-exclusions"> <span class="inclusions">Inclusions</span><br /><br /> $inclusions <br /> <br /> <span class="exclusions">Exclusions</span><br /><br /> $exclusions <br /> <br /> </div> </div> <div id="terms_$url"> <div class="terms" > <span class="terms-and-conditions" >Terms And Conditions </span><br /><br /> $terms_conditons </div> </div> <div id="price_$url"> <div class="price-tab" > <div class="price-tab-row" > <div class="price-tab-element"> <b>Pax Type</b> </div> <div class="price-tab-element"> <b>Tour Price Total in INR</b> </div> </div> <div class="price-tab-row" > <div class="price-tab-element" > Twin/Triple Sharing </div> <div class="price-tab-element" > <span class="rupee">`</span> $twin_triple_sharing </div> </div> <div class="price-tab-row" > <div class="price-tab-element" > Single Occupancy </div> <div class="price-tab-element" > <span class="rupee">`</span> $single_occcupancy </div> </div> <div class="price-tab-row"> <div class="price-tab-element" > Child With No Bed </div> <div class="price-tab-element"> <span class="rupee" >`</span> $child_with_no_bed </div> </div> <div class="price-tab-row"> <div class="price-tab-element"> Infant below 2 years </div> <div class="price=tab-element" > FREE </div> </div> <button id="book-now">Book Now !</button> <button id="call" >call your travel expert</button> </div> </div> </div> <div class="price-tag-domestic"><span class="pricy-price" >` $tour_price</span></div> <div class="cleaner"></div> ENTRY_DISPLAY; } } else { $entry_display = <<<ENTRY_DISPLAY <div class="domestic-tours"> <ul> <li><a href="#notice">Notice</a></li> </ul> <div id="notice" > <h2> This Page Is Under Construction </h2> <p> No entries have been made on this page. Please check back soon, or click the link below to add an entry! </p> </div> </div> ENTRY_DISPLAY; } $entry_display .= <<<ADMIN_OPTION </div> <div class="pager-items" > <div class="pager-display-element"> <ul id="icons" class="ui-widget ui-helper-clearfix"> <li class="ui-state-default ui-corner-all">View more Excite Trips</li> <li class="ui-state-default ui-corner-all"><a href="{$_SERVER['PHP_SELF']}?show=0">5</a></li> <li class="ui-state-default ui-corner-all"><a href="{$_SERVER['PHP_SELF']}?show=5">10</a></li> <li class="ui-state-default ui-corner-all"><a href="{$_SERVER['PHP_SELF']}?show=15">20</a></li> <li class="ui-state-default ui-corner-all"><a href="{$_SERVER['PHP_SELF']}?show=45">50</a></li> </ul> </div> </div> <!-- <p class="admin_link"> <a href="{$_SERVER['PHP_SELF']}?admin=1">Add a New Entry</a> <a href="{$_SERVER['PHP_SELF']}?show=0">Show 5</a> <a href="{$_SERVER['PHP_SELF']}?show=5">Show 10</a> <a href="{$_SERVER['PHP_SELF']}?show=15">Show 20</a> <a href="{$_SERVER['PHP_SELF']}?show=35">Show 40</a> <a href="{$_SERVER['PHP_SELF']}?show=45">Show 50</a> <a href="{$_SERVER['PHP_SELF']}?next_end=2">Next</a> </p> --> ADMIN_OPTION; return $entry_display; } public function display_admin() { return <<<ADMIN_FORM <form action="{$_SERVER['PHP_SELF']}" method="post" > <div id="tour-package" > <ul> <li><a href="#genral">General Information</a></li> <li><a href="#picture">Picture And Meta Info</a></li> <li><a href="#tour-inclusions">Tour Inclusions</a></li> <li><a href="#tour-feature">Itinerary</a></li> <!--<li><a href="#availibility">Availability and Others</a></li>--> <li><a href="#billing">Billing And Prices</a></li> </ul> <div id="genral"> <div class="package-element"> <p><span class="left" >Tour Name: <input type="text" name="tour_name" id="tour_name" /></span></p> </div> <div class="package-element"> <p>Tour Type: <select id="tour_type" name="tour_type" > <option value="null-category" checked="checked" >Select Tour Type</option> <option value="international" >International Tours</option> <option value="domestic" > Domestic Tours </option> <option value="insta_deals" >Insta Deals</option> </select> </p> </div> <div class="package-element"> <p>No. of Days: <input type="text" size="2" id="day" name="day" /> </p> </div> <div class="package-element"> <p> No. of Nights: <input type="text" name="nights" id="nights" size="2" /> </p> </div> <div class="package-element" > <p> Sub categories <input type="text" name="categories" id="categories" size="5" /> </p> </div> <div class="package-element"> <div class="package-element-head"> <p>Overview of the package :</p> </div> <br /> <div class="package-element"> <textarea rows="10" cols="70" id="overview" name="overview" ></textarea> </div> </div> <div class="cleaner"></div><br /> </div> <div id="picture" > <div class="chavi" > <div class="package-element-head" > <p>Pictures To upload (.jpg, .png) :</p> </div> <div class="cleaner"></div> <div class="chavi-element" > <span class="left">1st Image</span><span class="right"><input type="file" accept ="image/gif, image/jpeg" name="pic1" id="pic1" /></span> </div> <div class="chavi-element" > <span class="left">2nd Image</span><span class="right"><input type="file" accept ="image/gif, image/jpeg" name="pic2" id="pic2" /></span> </div> <div class="chavi-element"> <span class="left" > 3rd Image</span><span class="right"><input type="file" accept ="image/gif, image/jpeg" name="pic3" id="pic3" /></span> </div> <div class="chavi-element" > <span class="left" >4th Image</span><span class="right"><input type="file" accept ="image/gif, image/jpeg" name="pic4" id="pic4" /></span> </div> <div class="chavi-element" > <span class="left" >5th Image</span><span class="right"><input type="file" accept ="image/gif, image/jpeg" name="pic5" id="pic5" /></span> </div> </div> <div class="meta-info"> <div class="package-element-head" > <p>Title:</p> </div> <div class="package-element" > <input type="text" size="30" id="title" name="title" /> </div> <div class="package-element-head-2" > Keywords: </div> <div class="package-element" > <textarea rows="5" cols="28" id="keywords" name="keywords" ></textarea> </div> </div> <div class="meta-info" > <div class="package-element-head" > Description: </div> <div class="package-element" > <textarea rows="5" cols="30" name="description" id="description"></textarea> </div> <div class="package-element-head-2" > URL of the page: </div> <div class="package-element" > <input type="text" size="30" name="url" id="url" onblur="this.value=removeSpaces(this.value);" /> </div> </div> <div class="cleaner"></div> </div> <div id="tour-inclusions"> <div class="inclusions-exclusions"> <div class="package-element-head" > Inclusions: </div> <div class="package-element" > <textarea rows="10" cols="70" name="inclusions" id="inclusions"></textarea> </div> </div> <div class="inclusions-exclusions"> <div class="package-element-head" > Exlcusions: </div> <div class="package-element"> <textarea rows="10" cols=70" name="exclusions" id="exclusions"></textarea> </div> </div> <div class="cleaner"></div> </div> <div id="tour-feature"> <div class="package-element-head"> Itinerary: </div> <div class="package-element" > <textarea rows="30" cols="75" name="itinerary" id="itinerary"></textarea> </div> <div class="cleaner"></div> </div> <!--<div id="availability">availibility</div>--> <div id="billing"> <div class="price-tab" > <div class="price-tab-row" > <div class="price-tab-element"> <b>Pax Type</b> </div> <div class="price-tab-element"> <b>Tour Price Total in INR</b> </div> </div> <div class="price-tab-row" > <div class="price-tab-element" > Twin/Triple Sharing </div> <div class="price-tab-element" > <span class="rupee">`</span> <input typ="text" size="7" name="twin_triple_sharing" id="twin_triple_sharing" /> </div> </div> <div class="price-tab-row" > <div class="price-tab-element" > Single Occupancy </div> <div class="price-tab-element" > <span class="rupee">`</span> <input type="text" size="7" name="single_occcupancy" id="single_occcupancy" /> </div> </div> <div class="price-tab-row"> <div class="price-tab-element" > Child With No Bed </div> <div class="price-tab-element"> <span class="rupee" >`</span> <input type="text" size="7" name="child_with_no_bed" id="child_with_no_bed" /> </div> </div> <div class="price-tab-row"> <div class="price-tab-element"> Infant below 2 years </div> <div class="price-tab-element" > <span class="rupee" >`</span> <input type="text" size="7" name="inf_below" id="inf_below" /> </div> </div> <div class="package-element-head-2">Pricing Details:</div> <div class="cleaner"></div> <div class="package-element" > <textarea rows="10" cols="70" id="pricing_details" name="pricing_details" ></textarea> </div> <input type="submit" id="submit" value="Create This Entry!" /> <div class="cleaner" ></div> </div> </div> </div> </form> <!-- <form action="{$_SERVER['PHP_SELF']}" method="post"> <label for="title">Title:</label><br /> <input name="title" id="title" type="text" maxlength="150" /> <div class="clear"></div> <label for="bodytext">Body Text:</label><br /> <textarea name="bodytext" id="bodytext"></textarea> <div class="clear"></div> --> </form> <br /> </div> ADMIN_FORM; } public function write($p) { if ($_POST['tour_name'] ) $tour_name = mysql_real_escape_string($_POST['tour_name']); if ( $_POST['tour_type'] ) $tour_type = mysql_real_escape_string($_POST['tour_type']); if ( $_POST['day'] ) $day = mysql_real_escape_string($_POST['day']); if ( $_POST['nights'] ) $nights = mysql_real_escape_string($_POST['nights']); if ( $_POST['twin_triple_sharing'] ) $twin_triple_sharing = mysql_real_escape_string($_POST['twin_triple_sharing']); if ( $_POST['overview'] ) $overview = mysql_real_escape_string($_POST['overview']); if ( $_POST['itinerary'] ) $itinerary = mysql_real_escape_string($_POST['itinerary']); if ( $_POST['inclusions'] ) $inclusions = mysql_real_escape_string($_POST['inclusions']); if ( $_POST['exclusions'] ) $exclusions = mysql_real_escape_string($_POST['exclusions']); if ( $_POST['single_occcupancy'] ) $single_occcupancy = mysql_real_escape_string($_POST['single_occcupancy']); if ( $_POST['child_with_no_bed'] ) $child_with_no_bed = mysql_real_escape_string($_POST['child_with_no_bed']); if ( $_POST['inf_below'] ) $inf_below = mysql_real_escape_string($_POST['inf_below']); if ( $_POST['keywords'] ) $keywords = mysql_real_escape_string($_POST['keywords']); if ( $_POST['title'] ) $title = mysql_real_escape_string($_POST['title']); if ( $_POST['description'] ) $description = mysql_real_escape_string($_POST['description']); if ( $_POST['url'] ) $url = mysql_real_escape_string($_POST['url']); if ( isset($tour_name) && isset($day) && isset($nights) && isset($twin_triple_sharing) && isset($overview) && isset($itinerary) && isset($inclusions) && isset($exclusions) && isset($single_occcupancy) && isset($child_with_no_bed) && isset($inf_below) && isset($keywords) && isset($title) && isset($description)) { $sql = "INSERT INTO tourDB (tour_name, tour_type, day, nights, overview, itinerary, inclusions, exclusions, twin_triple_sharing, single_occcupancy, child_with_no_bed, inf_below, keywords, title, description, url) VALUES ('$tour_name', '$tour_type', '$day', '$nights', '$overview', '$itinerary', '$inclusions', '$exclusions', '$twin_triple_sharing', '$single_occcupancy', '$child_with_no_bed', '$inf_below', '$keywords', '$title' , '$description', '$url')"; return mysql_query($sql) or die(mysql_error()); } else { return false; } } public function connect() { mysql_connect($this->host,$this->username,$this->password) or die("Could not connect. " . mysql_error()); mysql_select_db($this->table) or die("Could not select database. " . mysql_error()); return $this->buildDB(); } private function buildDB() { $sql = <<<MySQL_QUERY CREATE TABLE IF NOT EXISTS tourDB ( tour_id INTEGER NOT NULL AUTO_INCREMENT, tour_type VARCHAR(11) NOT NULL, tour_name VARCHAR(255) NOT NULL, day INTEGER NOT NULL, nights INTEGER NOT NULL, tour_price VARCHAR(25) NOT NULL, overview TEXT NOT NULL, itinerary TEXT NOT NULL, terms_conditons TEXT NOT NULL, inclusions TEXT NOT NULL, exclusions TEXT NOT NULL, twin_triple_sharing INTEGER NOT NULL, single_occcupancy INTEGER NOT NULL, child_with_no_bed INTEGER NOT NULL, inf_below INTEGER NOT NULL, pricing_details TEXT, keywords VARCHAR(155) NOT NULL, title VARCHAR(25) NOT NULL, description VARCHAR(136) NOT NULL, url VARCHAR(500) NOT NULL, PRIMARY KEY (tour_id) ) ENGINE="MyISLAM" MySQL_QUERY; return mysql_query($sql) or die(mysql_error()); } } ?>
  9. Hello to all!! I really have a problem and i can t find any solution on the web. I'M trying to import in mysql database (using phpmyadmin on windows) a .BIN file. but it doesnt work. I receive this error : MySQL a répondu: Documentation #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' A?S' at line 1 Any suggestion? thanks a lot
  10. function user_data($user_id){ Global $dbc; $data=array(); $user_id = (int)$user_id; $func_num_args=func_num_args(); $func_get_args=func_get_args(); if($func_num_args >=1){ unset($func_get_args[0]); $fields=' ` '.implode(' ` , ` ' , $func_get_args).' ` '; $data=mysqli_query($dbc," SELECT '$fields' FROM `users` WHERE `user_id` = '$user_id'"); //mysqli_error($dbc); if ($data === false) { die("error on mysqli_query: ". mysqli_error($dbc)); } $data=mysqli_fetch_assoc($data); print_r ($data); //return $data; } } function logged_in(){ return(isset($_SESSION['user_id'])) ? true :false; } when i print above to screen i get this below Array ( [` user_id ` , ` username ` , ` password ` , ` name ` , ` surname ` , ` email ` ] => ` user_id ` , ` username ` , ` password ` , ` name ` , ` surname ` , ` email ` ) when i change the $fields in the in the query to * it displays the correct info but when i use the file below to echo a the user_id nothing echo's out this is the file that suppose to work but it doe not echo anything . this file is called init.php contains all functions ect. <?php session_start(); require('connect.php'); require('functions/general.php'); require('functions/users.php'); // to be accessed by every page to check errors for login if(logged_in()===true){ $session_user_id=$_SESSION['user_id']; $user_data = user_data($session_user_id,'user_id','username','password', 'name' , 'surname' ,'email' ); echo $user_data['user_id']; } else echo "cannot retreive data";
  11. I was working on a small script which gets inputs from the user and posts them to the website , the data is stored in the MySQL database but , the script is not working and its not posting any data to the database also it is not giving me any error .. could someone look into this ?? codes : index.php <link rel="shortcut icon" type="image/x-icon" href="img/favicon.ico" /> <link rel="stylesheet" type="text/css" href="css/bjqs.css" /> <link rel="stylesheet" type="text/css" media="only screen and (max-device-width: 990px)" href="css/mobile.css" /> <link rel="stylsheet" type="text/css" media="print" href="css/print.css" /> <link rel="stylesheet" type="text/css" href="css/jquery-ui-1.10.3.custom.css" /> <link href="style.css" rel="stylesheet" type="text/css" /> <link rel="stylesheet" href="css/jquery.wysiwyg.css" type="text/css"/> <script type="text/javascript" src="js/jquery-1.9.1.js"></script> <script type="text/javascript" src="js/bjqs-1.3.js"></script> <script type="text/javascript" src="js/jquery-ui-1.10.3.custom.js"></script> <script type="text/javascript" src="js/jquery.validate.js" ></script> <script type="text/javascript" src="js/jquery.wysiwyg.js"></script> <script type="text/javascript" src="js/wysiwyg.image.js"></script> <script type="text/javascript" src="js/wysiwyg.link.js"></script> <script type="text/javascript" src="js/wysiwyg.table.js"></script> <script type="text/javascript"> $(function domestic_boxes(){ $('.domestic-tours').tabs(); $('#book-now').button(); $('#call').button(); $('#submit').button(); }); $(function icons(){ // Hover states on the static widgets $( "#dialog-link, #icons li" ).hover( function() { $( this ).addClass( "ui-state-hover" ); }, function() { $( this ).removeClass( "ui-state-hover" ); } ); }); $(function slideslide() { $('#slider-inner').bjqs({ height : 400, width : 620, responsive : true }); $('#dest-thumb-nail').bjqs({ height : 200, width : 250, responsive : true }); $('#dest-thumb-nail-2').bjqs({ height : 200, width : 250, responsive : true }); }); $(function TourInput(){ $('#tour-package').tabs(); $('#days').keyup(function pickdays() { if (this.value != this.value.replace(/[^0-9\.]/g, '')) { this.value = this.value.replace(/[^0-9\.]/g, ''); } }); $('#nights').keyup(function picknights() { if (this.value != this.value.replace(/[^0-9\.]/g, '')) { this.value = this.value.replace(/[^0-9\.]/g, ''); } }); $('#twintriple').keyup(function picknights() { if (this.value != this.value.replace(/[^0-9\.]/g, '')) { this.value = this.value.replace(/[^0-9\.]/g, ''); } }); $('#singleocc').keyup(function picknights() { if (this.value != this.value.replace(/[^0-9\.]/g, '')) { this.value = this.value.replace(/[^0-9\.]/g, ''); } }); $('#childnobed').keyup(function picknights() { if (this.value != this.value.replace(/[^0-9\.]/g, '')) { this.value = this.value.replace(/[^0-9\.]/g, ''); } }); $('#infbelow').keyup(function picknights() { if (this.value != this.value.replace(/[^0-9\.]/g, '')) { this.value = this.value.replace(/[^0-9\.]/g, ''); } }); $('#transportation').wysiwyg({ autoGrow: true, maxHeight: 600 }); $('#payment-norms').wysiwyg({ autoGrow: true, maxHeight: 600 }); $('#overview').wysiwyg({ autoGrow: true, maxHeight: 600 }); $('#inclusions').wysiwyg({ autoGrow: true, maxHeight: 600 }); $('#exclusions').wysiwyg({ autoGrow: true, maxHeight: 600 }); $('#itinerary').wysiwyg({ autoGrow: true, maxHeight: 600 }); $('#pricingdetails').wysiwyg({ autoGrow: true, maxHeight: 600 }); }); </script> </head> <body> <!--Header End --> <div id="header-inner"> <div class="header-top"> <div class="head-left"><a href="index.html" ><img src="img/site-logo.png" /></a></div> <div class="contact"><div class="head-left"><img height="50" width="55" src="img/telephone.png" /></div><div class="head-right">+919830042523</div></div> <div class="contact"><div class="head-left"><img height="50" width="55" src="img/email.png" /></div><div class="head-right">support@excitetrips.com</div></div> </div> <div class="cleaner"></div> </div> <!--Header End --> <!--Container --> <div id="container"> <div class="cleaner"></div> <div class="package-part-left" > <div class="domestic-tour-lists"> <?php include_once('_class/tourCMS.php'); $obj = new tourCMS(); /* SETTINGS FOR DATABASE */ $obj->host = 'mysql.1freehosting.com'; $obj->username = 'u694861683_sim'; $obj->password = 'simple'; $obj->table = 'u694861683_sim'; $obj->connect(); if ( $_POST ) $obj->write($_POST); echo ( $_GET['admin'] == 1 ) ? $obj->display_admin() : $obj->display_public(); ?> </div> and tourCMS.php :- class tourCMS { var $host; var $username; var $password; var $table; public function display_public() { $show = $_GET['show'] + 5; $q = "SELECT * FROM tourDB ORDER BY created DESC LIMIT $show"; $r = mysql_query($q); if ( $r !== false && mysql_num_rows($r) > 0 ) { while ( $a = mysql_fetch_assoc($r) ) { $tour_id = stripslashes($a['tour_id']); $tour_type = stripslashes($a['tour_type']); $tour_name = stripslashes($a['tour_name']); $day = stripslashes($a['day']); $nights = stripslashes($a['nights']); $tour_price = stripslashes($a['tour_price']); $overview = stripslashes($a['overview']); $itinerary = stripslashes($a['itinerary']); $terms_conditons = stripslashes($a['terms_conditons']); $inclusions = stripslashes($a['inclusions']); $exclusions = stripslashes($a['exclusions']); $twin_triple_sharing = stripslashes($a['twin_triple_sharing']); $single_occcupancy = stripslashes($a['single_occcupancy']); $child_with_no_bed = stripslashes($a['child_with_no_bed']); $inf_below = stripslashes($a['inf_below']); $pricing_details = stripslashes($a['pricing_details']); $entry_display .= <<<ENTRY_DISPLAY <div class="domestic-tours"> <ul> <li><a href="#overview_$tour_name">Overview</a></li> <li><a href="#itinerary_$tour_name">Itinerary</a></li> <li><a href="#inclusions_$tour_name">Inclusions</a></li> <li><a href="#terms_$tour_name">Terms And Conditions</a></li> <li><a href="#price_$tour_name">Tour Price</a></li> </ul> <div id="overview_$tour_name"> <div id="dest-thumb-nail" class="dest-thumb-nail"> <ul class="bjqs"> <li><img src="img/bangkok/1.jpg" /></li> <li><img src="img/bangkok/2.jpg" /></li> <li><img src="img/bangkok/3.jpg" /></li> <li><img src="img/bangkok/4.jpg" /></li> <li><img src="img/bangkok/5.jpg" /></li> <li><img src="img/bangkok/6.jpg" /></li> <li><img src="img/bangkok/6.jpg" /></li> </ul> </div> <div class="overview"> <span class="overview-heading">$tour_name</span><br /><br /> <span class="overview-duration">$nights Nights , $day Days</span><br /><br /> $overview </div> </div> <div id="itinerary_$tour_name"> <div class="itin-content"> <span class="overview-heading">$tour_name</span><br /><br /> <span class="overview-duration">$nights Nights, $day Days</span><br /><br /><br /> $itinerary </div> </div> <div id="inclusions_$tour_name"> <div class="inclusions-exclusions"> <span class="inclusions">Inclusions</span><br /><br /> $inclusions <br /> <br /> <span class="exclusions">Exclusions</span><br /><br /> $exclusions <br /> <br /> </div> </div> <div id="terms_$tour_name"> <div class="terms" > <span class="terms-and-conditions" >Terms And Conditions </span><br /><br /> $terms_conditons </div> </div> <div id="price_$tour_name"> <div class="price-tab" > <div class="price-tab-row" > <div class="price-tab-element"> <b>Pax Type</b> </div> <div class="price-tab-element"> <b>Tour Price Total in INR</b> </div> </div> <div class="price-tab-row" > <div class="price-tab-element" > Twin/Triple Sharing </div> <div class="price-tab-element" > <span class="rupee">`</span> $twin_triple_sharing </div> </div> <div class="price-tab-row" > <div class="price-tab-element" > Single Occupancy </div> <div class="price-tab-element" > <span class="rupee">`</span> $single_occcupancy </div> </div> <div class="price-tab-row"> <div class="price-tab-element" > Child With No Bed </div> <div class="price-tab-element"> <span class="rupee" >`</span> $child_with_no_bed </div> </div> <div class="price-tab-row"> <div class="price-tab-element"> Infant below 2 years </div> <div class="price=tab-element" > FREE </div> </div> <button id="book-now">Book Now !</button> <button id="call" >call your travel expert</button> </div> </div> </div> <div class="price-tag-domestic"><span class="pricy-price" >` $tour_price</span></div> ENTRY_DISPLAY; } } else { $entry_display = <<<ENTRY_DISPLAY <div class="domestic-tours"> <ul> <li><a href="#notice">Notice</a></li> </ul> <div id="notice" > <h2> This Page Is Under Construction </h2> <p> No entries have been made on this page. Please check back soon, or click the link below to add an entry! </p> </div> </div> ENTRY_DISPLAY; } $entry_display .= <<<ADMIN_OPTION </div> <div class="pager-items" > <div class="pager-display-element"> <ul id="icons" class="ui-widget ui-helper-clearfix"> <li class="ui-state-default ui-corner-all">View more Excite Trips</li> <li class="ui-state-default ui-corner-all"><a href="{$_SERVER['PHP_SELF']}?show=0">5</a></li> <li class="ui-state-default ui-corner-all"><a href="{$_SERVER['PHP_SELF']}?show=5">10</a></li> <li class="ui-state-default ui-corner-all"><a href="{$_SERVER['PHP_SELF']}?show=15">20</a></li> <li class="ui-state-default ui-corner-all"><a href="{$_SERVER['PHP_SELF']}?show=45">50</a></li> </ul> </div> </div> <!-- <p class="admin_link"> <a href="{$_SERVER['PHP_SELF']}?admin=1">Add a New Entry</a> <a href="{$_SERVER['PHP_SELF']}?show=0">Show 5</a> <a href="{$_SERVER['PHP_SELF']}?show=5">Show 10</a> <a href="{$_SERVER['PHP_SELF']}?show=15">Show 20</a> <a href="{$_SERVER['PHP_SELF']}?show=35">Show 40</a> <a href="{$_SERVER['PHP_SELF']}?show=45">Show 50</a> <a href="{$_SERVER['PHP_SELF']}?next_end=2">Next</a> </p> --> ADMIN_OPTION; return $entry_display; } public function display_admin() { return <<<ADMIN_FORM <form action="{$_SERVER['PHP_SELF']}" method="post" > <div id="tour-package" > <ul> <li><a href="#genral">General Information</a></li> <li><a href="#picture">Picture And Meta Info</a></li> <li><a href="#tour-inclusions">Tour Inclusions</a></li> <li><a href="#tour-feature">Itinerary</a></li> <!--<li><a href="#availibility">Availability and Others</a></li>--> <li><a href="#billing">Billing And Prices</a></li> </ul> <div id="genral"> <div class="package-element"> <p><span class="left" >Tour Name: <input type="text" name="tour_name" id="tour_name" /></span></p> </div> <div class="package-element"> <p>Tour Type: <select id="tour_type" name="tour_type" > <option value="null-category" checked="checked" >Select Tour Type</option> <option value="international" >International Tours</option> <option value="domestic" > Domestic Tours </option> <option value="insta_deals" >Insta Deals</option> </select> </p> </div> <div class="package-element"> <p>No. of Days: <input type="text" size="2" id="day" name="day" /> </p> </div> <div class="package-element"> <p> No. of Nights: <input type="text" name="nights" id="nights" size="2" /> </p> </div> <div class="package-element" > <p> Sub categories <input type="text" name="tour_type" id="tour_type" size="5" /> </p> </div> <div class="package-element"> <div class="package-element-head"> <p>Overview of the package :</p> </div> <br /> <div class="package-element"> <textarea rows="10" cols="70" id="overview" name="overview" ></textarea> </div> </div> <div class="cleaner"></div><br /> </div> <div id="picture" > <div class="chavi" > <div class="package-element-head" > <p>Pictures To upload (.jpg, .png) :</p> </div> <div class="cleaner"></div> <div class="chavi-element" > <span class="left">1st Image</span><span class="right"><input type="file" accept ="image/gif, image/jpeg" name="pic1" id="pic1" /></span> </div> <div class="chavi-element" > <span class="left">2nd Image</span><span class="right"><input type="file" accept ="image/gif, image/jpeg" name="pic2" id="pic2" /></span> </div> <div class="chavi-element"> <span class="left" > 3rd Image</span><span class="right"><input type="file" accept ="image/gif, image/jpeg" name="pic3" id="pic3" /></span> </div> <div class="chavi-element" > <span class="left" >4th Image</span><span class="right"><input type="file" accept ="image/gif, image/jpeg" name="pic4" id="pic4" /></span> </div> <div class="chavi-element" > <span class="left" >5th Image</span><span class="right"><input type="file" accept ="image/gif, image/jpeg" name="pic5" id="pic5" /></span> </div> </div> <div class="meta-info"> <div class="package-element-head" > <p>Title:</p> </div> <div class="package-element" > <input type="text" size="30" id="title" name="title" /> </div> <div class="package-element-head-2" > Keywords: </div> <div class="package-element" > <textarea rows="5" cols="28" id="keywords" name="keywords" ></textarea> </div> </div> <div class="meta-info" > <div class="package-element-head" > Description: </div> <div class="package-element" > <textarea rows="5" cols="30" name="description" id="description"></textarea> </div> <div class="package-element-head-2" > URL of the page: </div> <div class="package-element" > <input type="text" size="30" name="url" id="url" onblur="this.value=removeSpaces(this.value);" /> </div> </div> <div class="cleaner"></div> </div> <div id="tour-inclusions"> <div class="inclusions-exclusions"> <div class="package-element-head" > Inclusions: </div> <div class="package-element" > <textarea rows="10" cols="70" name="inclusions" id="inclusions"></textarea> </div> </div> <div class="inclusions-exclusions"> <div class="package-element-head" > Exlcusions: </div> <div class="package-element"> <textarea rows="10" cols=70" name="exclusions" id="exclusions"></textarea> </div> </div> <div class="cleaner"></div> </div> <div id="tour-feature"> <div class="package-element-head"> Itinerary: </div> <div class="package-element" > <textarea rows="30" cols="75" name="itinerary" id="itinerary"></textarea> </div> <div class="cleaner"></div> </div> <!--<div id="availability">availibility</div>--> <div id="billing"> <div class="price-tab" > <div class="price-tab-row" > <div class="price-tab-element"> <b>Pax Type</b> </div> <div class="price-tab-element"> <b>Tour Price Total in INR</b> </div> </div> <div class="price-tab-row" > <div class="price-tab-element" > Twin/Triple Sharing </div> <div class="price-tab-element" > <span class="rupee">`</span> <input typ="text" size="7" name="twin_triple_sharing" id="twin_triple_sharing" /> </div> </div> <div class="price-tab-row" > <div class="price-tab-element" > Single Occupancy </div> <div class="price-tab-element" > <span class="rupee">`</span> <input type="text" size="7" name="single_occcupancy" id="single_occcupancy" /> </div> </div> <div class="price-tab-row"> <div class="price-tab-element" > Child With No Bed </div> <div class="price-tab-element"> <span class="rupee" >`</span> <input type="text" size="7" name="child_with_no_bed" id="child_with_no_bed" /> </div> </div> <div class="price-tab-row"> <div class="price-tab-element"> Infant below 2 years </div> <div class="price-tab-element" > <span class="rupee" >`</span> <input type="text" size="7" name="inf_below" id="inf_below" /> </div> </div> <div class="package-element-head-2">Pricing Details:</div> <div class="cleaner"></div> <div class="package-element" > <textarea rows="10" cols="70" id="pricing_details" name="pricing_details" ></textarea> </div> <input type="submit" id="submit" value="Create This Entry!" /> <div class="cleaner" ></div> </div> </div> </div> </form> <!-- <form action="{$_SERVER['PHP_SELF']}" method="post"> <label for="title">Title:</label><br /> <input name="title" id="title" type="text" maxlength="150" /> <div class="clear"></div> <label for="bodytext">Body Text:</label><br /> <textarea name="bodytext" id="bodytext"></textarea> <div class="clear"></div> --> </form> <br /> </div> ADMIN_FORM; } public function write($p) { if ( $_POST['tour_name'] ) $tour_name = mysql_real_escape_string($_POST['tour_name']); if ( $_POST['day']) $day = mysql_real_escape_string($_POST['day']); if ( $_POST['nights'] ) $nights = mysql_real_escape_string($_POST['nights']); if ( $_POST['tour_price'] ) $tour_price = mysql_real_escape_string($_POST['tour_price']); if ( $_POST['overview'] ) $overview = mysql_real_escape_string($_POST['overview']); if ( $_POST['terms_conditons'] ) $terms_conditons = mysql_real_escape_string($_POST['terms_conditons']); if ( $_POST['inclusions'] ) $inclusions = mysql_real_escape_string($_POST['inclusions']); if ( $_POST['exclusions'] ) $exclusions = mysql_real_escape_string($_POST['exclusions']); if ( $_POST['twin_triple_sharing'] ) $twin_triple_sharing = mysql_real_escape_string($_POST['twin_triple_sharing']); if ( $_POST['single_occcupancy']) $single_occcupancy = mysql_real_escape_string($_POST['single_occcupancy']); if ( $_POST['child_with_no_bed'] ) $child_with_no_bed = mysql_real_escape_string('child_with_no_bed'); if ( $_POST['pricing_details'] ) $pricing_details = mysql_real_escape_string('pricing_details'); if ( $tour_name && $day && $nights && $tour_price && $overview && $terms_conditons && $inclusions && $exclusions && $twin_triple_sharing && $single_occcupancy && $child_with_no_bed && $pricing_details) { // $created = time(); $sql = "INSERT INTO tourDB (tour_name, day, nights, tour_price, overview, itinerary, terms_conditons, inclusions, exclusions, twin_triple_sharing, single_occcupancy, child_with_no_bed, inf_below, pricing_details) VALUES('$tour_name','$day', '$nights', '$tour_price', '$overview', '$itinerary', '$terms_conditons', '$inclusions', '$exclusions', '$twin_triple_sharing', '$single_occcupancy', '$child_with_no_bed', '$inf_below', '$pricing_details')"; return mysql_query($sql) or die(mysql_error()); } else { return false; } } public function connect() { mysql_connect($this->host,$this->username,$this->password) or die("Could not connect. " . mysql_error()); mysql_select_db($this->table) or die("Could not select database. " . mysql_error()); return $this->buildDB(); } private function buildDB() { $sql = <<<MySQL_QUERY CREATE TABLE IF NOT EXISTS tourDB ( tour_id INTEGER NOT NULL AUTO_INCREMENT, tour_type INTEGER NOT NULL, tour_name VARCHAR(255) NOT NULL, day INTEGER NOT NULL, nights INTEGER NOT NULL, tour_price VARCHAR(25) NOT NULL, overview TEXT NOT NULL, itinerary TEXT NOT NULL, terms_conditons TEXT NOT NULL, inclusions TEXT NOT NULL, exclusions TEXT NOT NULL, twin_triple_sharing INTEGER NOT NULL, single_occcupancy INTEGER NOT NULL, child_with_no_bed INTEGER NOT NULL, inf_below INTEGER NOT NULL, pricing_details TEXT, keywords VARCHAR(155) NOT NULL, title VARCHAR(25) NOT NULL, description VARCHAR(136) NOT NULL, PRIMARY KEY (tour_id) ) ENGINE="MyISLAM" MySQL_QUERY; return mysql_query($sql) or die(mysql_error()); } } ?> thanks in advance
  12. Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given its a login form here is my code thats producing the error .i need to test if user_is true. function login($username , $password){ GLOBAL $dbc; //database $user_id= user_id_from_username($username); $username = sanatize($username); $password = md5($password); $query= mysqli_query($dbc,"SELECT COUNT(`user_id`) FROM `users` WHERE `username` = '$username' AND `password ` = '$password'"); $check= mysqli_fetch_array( $query , MYSQLI_BOTH); // even if i add this set of code the query still gives the above error. return ($check[0]==1)? $user_id : false; }
  13. its a login form here is my code thats producing the error . I am really new to php. this is for a project . thanks for the help. function login($username , $password){ GLOBAL $dbc; //database $user_id= user_id_from_username($username); $username = sanatize($username); $password = md5($password); $query= mysqli_query($dbc,"SELECT COUNT(`user_id`) FROM `users` WHERE `username` = '$username' AND `password ` = '$password'"); MYSQLI_ERROR($query); $check= mysqli_fetch_array( $query , MYSQLI_BOTH); // even if i add this set of code the query still gives the above error. }
  14. <?php $user="root"; $password=""; $database="base"; $host="localhost"; $table="com"; mysql_connect($host, $user, $password) or die("error"); mysql_select_db($database) or die("error"); $name = $_POST['name']; $lastname = $_POST['lastname']; $email = $_POST['email']; $coment= $_POST['coment']; $error = ''; if(empty($name) || empty($lastname) || empty($email) || empty($coment)) { $error .= 'error. '; } if(!preg_match("/^[a-zA-A]+$/i", $name)) { $error .= 'Error '; } if(!preg_match("/^[a-zA-A]+$/i", $lastname)) { $error .= 'Error '; } if(!preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i", $email)) { $error .= 'errorl. '; } if(!preg_match("/^[a-zA-z0-9.,?!]+$/i", $comment)) { $error .= 'Error '; } if($error == '') { $result = "INSERT INTO com (name, lastname, email, coment) VALUES('$name', '$lastname', '$email','$coment')"; echo "<script type='text/javascript'>alert('Thanks.'); window.close();</script>";} else{ echo"<script type='text/javascript'>alert ('$error'); window.close(); </script>";} Errors seems to be working its just it won't insert data in table in mysql database.... Thank you so much.
  15. i was making a short php program , and I am stuck in the middle of a error which displays : "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE TOUR.tour_type = u43022694_type.tourtype_id AND tour_year > 1990 ' at line 5" Here is my php code: // select the tour titles titles and there posted from 1990 $query = 'SELECT tour_name, tourtype_lable FROM TOUR LEFT JOIN u43022694_type ON tour_type = tourtype_id AND WHERE TOUR.tour_type = u43022694_type.tourtype_id AND tour_year > 1990 ORDER BY tour_type'; $result = mysql_query($query, $db) or die(mysql_error($db)); //show results echo '<table border="1">'; while ($row = mysql_fetch_assoc($result)) { echo '<tr>'; foreach ($row as $value) { echo '<td>' . $value . '</td>'; } echo '</tr>'; } echo '</table>'; where is my syntax error ??? i checked it many times
  16. Hey, Xyphon here. I have known PHP now for over 5 years and I have been freelancing on and off for about 3. I've created many websites and am capable of doing nearly anything that PHP can do. I am experienced with MySQL and databases as well. I'm not much of a "designer" but I can design your website if you'd like as well. I also have some basic knowledge in JavaScript and jquery. I work for fairly cheap comparatively speaking and am pretty flexible as well. If you need to contact me either shoot me a pm or email me at dbgt525@gmail.com Thanks.
  17. Hey everyone. I am farly new to PHP and MySQL so I do say sorry in advance for any stupid lines of code I have written. But I am stuck at a point in a website im making for a friend. I have a database with a unknown amount of entries. I have currently found a way to make a list of entries appear in a table. and add a edit button to edit each entry separately on another page however what I would like is a table with all the entries in so they can admin all the entries without having to go though phpmyadmin I know it has something to do with arrays. But i cant seem to find a simple explanation for what im wanting to do So im hoping someone here can either give me a link to something that will help. or explain it to me in simple terms. Thanks in advance PomTom I can provide code if required from my other working pages but i figured since its a new page im making theres no code written to provide
  18. Hi All I have the following code which works great but i can't seem to figure out how to get the "result" from the database to be displayed in a alert box. Please could someone point me in the right direction or sugguest some way i could achieve this. <?php $dbhost = 'localhost:3036'; $dbuser = 'Dbuser'; $dbpass = 'Mypassword'; $conn = mysql_connect($dbhost, $dbuser, $dbpass); if(! $conn ) { die('Could not connect: ' . mysql_error()); } $sql = 'SELECT page_id FROM page WHERE page_id=112'; mysql_select_db('my_wiki'); $retval = mysql_query( $sql, $conn ); if(! $retval ) { die('Could not get data: ' . mysql_error()); } while($row = mysql_fetch_array($retval, MYSQL_ASSOC)) { echo "Page ID :{$row['page_id']} <br> ". "--------------------------------<br>"; } echo "Fetched data successfully\n"; mysql_close($conn); ?>
  19. Hello. I have a problem with my website. When I introduce the symbols " or ' through text editor (PHP based), the database adds a / to the code. The problem happens in text, but also in pictures or embeded iframes, etc.. Example: Correct snipet of code to go to DB: Felipe Nasr: "seria ótimo chegar à F1 com o António Félix da Costa" How it goes to DB: Felipe Nasr: "/seria ótimo chegar à F1 com o António Félix da Costa/" I have localhost, and two different hosts to my website (.cwahi.net and .atspace.eu). The files are the same in the three cases, but this problem only happens in atspace.eu... Can it be a server problem? Thank you in advance!
  20. Hi Folks, Netbiz Group have 2 vacancies within the development department - Front End Developer and PHP Developer. Netbiz Group are a leading provider of website design, development and Internet Marketing, based in Newcastle Under Lyme, Staffordshire. We are not interested in outsourcing or using freelancers as this is an internal post based in our offices. Please can you send me your CV with examples of your work. Great packages available to the right candidates! Regards Susan 0845 456 7617 susan@netbizweb.co.uk
  21. I am having the search form query a inner joined table from multiple other tables in MySQL. I am using a local intranet with Xampp/Apache with When I run the SQL in PHPMyAdmin, it runs Perfect and produces the results exactly as I want them to appear on my website. My database name is: loodt My tables are: ee, er, aa, adjuster and attorney. I have foreign keys on the ee table for the other tables (ee.er_id = er.id) etc... However, when I try to run a search on my website, it pops up an error saying "Could not query database for search results, MYSQL ERROR Table 'loodt.ee a" doesn't exist." So I tried taking away the shortcut letters [referenced below in code] (A, B, C, D< E, & F) and typing in ee.name, er.name, etc... instead of assigning these letters and it didnt work either. I was using the search engine already to query results from a single table before I started to modify it a few days ago, So I know it works and has to be an issue with the "temporary" table and my lack of knowledge of course. Here is the search engine javascript: $(function(){ //Hide the result list on load $('#results-list').hide(); //Click event when search button is pressed $('#search').click(function(){ doSearch(); }); //Keypress event to see if enter was pressed in text input $('#text').keydown(function(e){ if(e.keyCode == 13){ doSearch(); } }); }); > function doSearch() { var searchText = $('#text').val(); //Rehide the search results $('#results-list').hide(); $.ajax({ url: './search.php', type: 'POST', data: { 'text': searchText }, beforeSend: function(){ //Lets add a loading image $('#results-holder').addClass('loading'); }, success: function(data) { //Take the loading image away $('#results-holder').removeClass('loading'); //Was everything successful, no errors in the PHP script if (data.success) { //Clear the results list $('#results-list').empty(); //Display the results //Check to see if there are any results to display if(data.results.length > 0) { //Loop through each result and add it to the list $.each(data.results, function(){ //Give the list element a rel with the data results ID incase we want to act on this later, like selecting from the list $('#results-list').append( "<li rel='" + this.A_name + "'>" + this.D_name + " | " + this.A_file_no + " | " + this.A_claim_no + " | " + this.A_adj_no + " | " + this.F_acronym + " | " + this.A_doi + " | " + this.A_opened + " | " + this.A_status + " | " + this.A_redwells + " | " + this.E_firm_name + " | " + this.B_name + " | " + this.C_initials + " </li>"); }); } else { //If there are no results, inform the user - add 'no-results' class so we can style it differently $('#results-list').append("<li class='no-results'>Your search did not return any results</li>"); } //Show the results list $('#results-list').fadeIn(); } else { //Display the error message alert(data.error); } } }); } The javascript file above is called from my index page in the header, not sure if that is important. And this is the search.php file that is called inside the javascript code above. > <?php //Prepare an array to hold data we are going to send back to the jQuery $data = array( 'results' => array(), 'success' => false, 'error' => '' ); //Has the text been posted? if (isset($_POST['text'])) { //Connect to the database > $dbhost = 'localhost'; //hostname $dbuser = 'xxxx'; //database username $dbpass = 'xxxxx'; //database password $dbname = 'loodt'; //database name > //Create the connection to the mySQL database or catch the exception if there is an error $db = new mysqli($dbhost, $dbuser, $dbpass); > $db->select_db($dbname); > if($db->connect_errno > 0){ die('ERROR! - COULD NOT CONNECT TO mySQL DATABASE: ' . $db->connect_error); } > > //Escape the text to prevent SQL injection $text = $db->real_escape_string($_POST['text']); //Run a LIKE query to search for titles that are like the entered text > $q = "SELECT `A.name AS A_name`, `D.name AS D_name`, `A.file_no AS A_file_no`, `A.claim_no AS A_claim_no`, `A.adj_no AS A_adj_no`, `F.acronym AS F_acronym`, `A.doi AS A_doi`, `A.opened AS A_opened`, `A.status AS A_status`, `A.redwells AS A_redwells`, `C.initials AS C_initials`, `B.name AS B_name`, `E.firm_name AS E_firm_name` FROM `ee A` INNER JOIN `adjuster B` ON `A.adjuster_id` = `B.id` INNER JOIN `attorney C` ON `A.attorney_id` = `C.id` INNER JOIN `er D` ON `A.er_id` = `D.id` INNER JOIN `aa E` ON `A.aa_id` = `E.id` INNER JOIN `wcab F` ON `A.wcab_id` = `F.id` > WHERE `A_name` LIKE '%{$text}%' OR `A_file_no` LIKE '%{$text}%' OR `A_claim_no` LIKE '%{$text}%' OR `A_adj_no` LIKE '%{$text}%' OR `A_doi` LIKE '%{$text}%'";; $result = $db->query($q); //Did the query complete successfully? if (!$result) { //If not add an error to the data array $data['error'] = "Could not query database for search results, MYSQL ERROR: " . $db->error; } else { //Loop through the results and add to the results array while ($row = $result->fetch_assoc()) { $data['results'][] = array( 'A_name' => $row['A_name'], 'D_Name' => $row['D_name'], 'A_file_no' => $row['A_file_no'], 'A_claim_no' => $row['A_claim_no'], 'A_adj_no' => $row['A_adj_no'], 'F_acronym' => $row['F_acronym'], 'A_doi' => $row['A_doi'], 'A_opened' => $row['A_opened'], 'A_status' => $row['A_status'], 'A_redwells' => $row['A_redwells'], 'C_initials' => $row['C_initials'], 'B_name' => $row['B_name'], 'E_firmname' => $row['E_firmname'] ); } //Everything went to plan so set success to true $data['success'] = true; } } //Set the content type for a json object and ensure charset is UTF-8. NOt utf8 otherwise it will not work in IE (Darn IE! >.<) header("Content-Type: application/json; charset=UTF-8"); //json encode the data and cast to an object so we can reference items like this.id in the javascript instead of this['id'] etc. echo json_encode((object)$data); ?>
  22. Hi. I am having trouble embedding a swf file from a database on a php page. I know how to embed a swf file using just php with the help of swfobject.js but I am having trouble being able to actually show the file from a db. I am not storing the actual file on the database but the path to the flash file (eg games/flashgame1.swf) I am properly connected to the db so there is no problem there. The table is called games and has two columns for now: id | path Here is my code: <?php require_once('config.php'); if (!session_id()) session_start(); ?> <!DOCTYPE html> <html> <head> <meta content="text/html; charset=UTF-8" http-equiv="content-type"> <meta name="author" content="Onyx"> <link rel="stylesheet" type="text/css" href="<?php echo HTTP_STYLE;?>layout.css" /> <link href="<?php echo HTTP_IMAGES;?>favicon.ico" rel="icon" type="image/x-icon" /> </head> <body> <div id="wrapper2"> <div id="container"> <?php $result = mysql_query("SELECT * FROM games"); while($row = mysql_fetch_array($result)) { $path = $row['1']; $id = $row['0']; $width = "546"; $height = "431"; $version = "9.0.0"; } echo "<script type=text/javascript src=swfobject.js></script>"; echo "<script type=text/javascript>"; echo "swfobject.embedSWF('$path','$id', '$width', '$height', '$version')";echo "</script>"; ?> </div> </div> </body> </html> Any ideas what i am doing wrong?
  23. Hi If I create example section and under section category linking to each other how can I do and this is my tables $inf_newtable[1] = "".$db_prefix."section ( `id` int(10) NOT NULL auto_increment, `name` varchar(255) NOT NULL default '', `photo` varchar(255) NOT NULL default 'no-photo.jpg', PRIMARY KEY (`id`) ) ENGINE=MyISAM;"; $inf_newtable[2] = "".$db_prefix."category ( `id` int(10) NOT NULL auto_increment, `name` varchar(255) NOT NULL default '', `section_id` int(10) NOT NULL default '0', PRIMARY KEY (`id`) ) ENGINE=MyISAM;";
  24. Right now these are my tables.. i have create a page that list all the users and there is an edit button.. My question is when i click the edit button, how to view the name of the user and a select box option where the options are my course and subject that been stored? Then, when i fill the course and subject from the select box, it will stored to user_subject and user_course table.. <?php session_start(); require_once('function.php'); //Set this to what ever page you include that holds all your functions so that we can use the checkUserStatus() checkUserStatus('admin'); ?> <html> <head> <title> View Users </title> </head> <body> <h2 align='right'><a href='admin.php'>Home</a></h2> <center><h2>Users Information</h2><center> <table width='800' align='center' border='5'> <tr bgcolor='yellow'> <th>No.</th> <th>Full Name</th> <th>Matrix No.</th> <th>Username</th> <th>Password</th> <th>User Type</th> <th>Edit User</th> <th>Delete User</th> </tr> <?php mysql_connect("localhost","root",""); mysql_select_db("class_attendance"); $query = "select * from user"; $run = mysql_query($query); while ($row=mysql_fetch_array($run)){ $id = $row[0]; $full_name = $row[1]; $matrix_no = $row[2]; $username = $row[3]; $pass = $row[4]; $type = $row[5]; ?> <tr align='center'> <td><?php echo $id; ?></td> <td><?php echo $full_name; ?></td> <td><?php echo $matrix_no; ?></td> <td><?php echo $username; ?></td> <td><?php echo $pass; ?></td> <td><?php echo $type; ?></td> <td><a href='edit.php?del=<?php echo $id;?>'>Edit</a></td> <td><a href='delete.php?del=<?php echo $id;?>'>Delete</a></td> </tr> <?php } ?> </table> </body> </html>
  25. i want to know that how can i create a trigger in mysql integrated with php.
×
×
  • 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.