Jump to content

Search the Community

Showing results for tags 'error'.

  • 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 trying to develop a registration form where the user fill the form and submit it then the status and the id should be displayed. i have used uniq_id function to generate a random id and with the help of this reference id i can retrieve the actual ID and display it back to the user. But unfortunately i am successful with the first registration after the first registration it throws an error that Error: "Warning: mysql_result(): Unable to jump to row 0 on MySQL result index 9". my code: <?php include(conn.php); $id = $_GET['id']; $adv = $_GET['adv']; $name = $_GET['name']; $address = $_GET['address']; $pincode = $_GET['pincode']; $email = $_GET['email']; $fax = $_GET['fax']; $mobile = $_GET['mobile']; $amount = $_GET['amount']; $ddchno = $_GET['ddchno']; $bank = $_GET['bank']; $register = mysql_query( "insert into exbadv ( refid,adv,name,address,pincode,email,fax,mobile,amount,ddchno,bank) values ('$id','$adv','$name','$address','$pincode','$email','$fax','$mobile','$amount','$ddchno','$bank')"); $id = $_GET['id']; $result = mysql_query("SELECT id FROM exbadv WHERE refid = '$id'"); echo 'Your Registration id is ';echo mysql_result($result,0); ?> Plz help me out,thank u.
  2. Hi guys, I'm kinda new to PHP, and I started with developing a site. Now I've a piece of code (check below), it is suppost to edit a page in the database, but the output is "Error updating database1: Unknown column 'title' in 'field list'". But, the column exist! All variables are set, and I don't know what I'm doing wrong, and I hope you guys can help me. Code: $query_update = "UPDATE `pagina` SET `title` = '".addslashes($title)."', `korting`='".$korting."', `volg`='".$volg."', `product` = '".$product."',`product_id`='".$product_id."', `visible` = '".$visible."', `metadescription` = '".addslashes($metadescription)."', `url` = '".$url."', `content` = '".addslashes($content)."', `headerpicture`='".addslashes($headerpicture)."',`picture`='".addslashes($picture)."', form_id = '".$form_id."',`related`='".$related_string."', `datum` = NOW() WHERE `id` = '".$id."'"; mysql_query($query_update)or die('Error updating database1: '.mysql_error()); Column: Greetzz iRoot121.
  3. Could anyone explain why my script just isnt working? I dont understand PHP and would be enterally greatful. Im told Parse error: syntax error, unexpected T_ECHO in /home/content/65/11493065/html/PHP/html_form_send.php on line 265 which is the echo at the end Many thanks <?php /* subject and email variables */ $subject = 'form completion'; $to = 'office@english-centre.co.uk'; /* gathering data variable */ $name = $_POST['name']; $telephone = $_POST['telephone']; $email = $_POST['email']; $type = $_POST['type']; $ability = $_POST['ability']; $previous_lessons = $_POST['previous_lessons']; $comments = $_POST['comments']; $found_site = $_POST['found_site']; $body = <<<EOD <br><hr><br> Client Name: $name <br> Telephone: $telephone <br> Email: $email <br> Intrested in: $type <br> Current ability: $ability <br> Previous lessons: $previous_lessons <br> Any comments: $comments <br> found site through: $found_site <br> EOD; $headers = "From: $email\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail ($to, $subject, $body, $headers); /* results rendered as HTML */ $theResults = <<<EOD <HTML> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <!-- #BeginTemplate "Template.dwt" --> <head> <meta content="en-gb" http-equiv="Content-Language"> <!-- #BeginEditable "doctitle" --> <title>The English Centre 07905080578</title> <!-- #EndEditable --> <title>The English Centre</title> <link rel="stylesheet" href="../JS/gilbitron-Lean-Slider-ffe9a31/demo/style.css" type="text/css" media="screen" /> <script src="../JS/gilbitron-Lean-Slider-ffe9a31/demo/scripts/modernizr-2.6.1.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script> <script src="../JS/gilbitron-Lean-Slider-ffe9a31/lean-slider.js"></script> <link rel="stylesheet" href="../JS/gilbitron-Lean-Slider-ffe9a31/lean-slider.css" type="text/css" /> <link rel="stylesheet" href="../JS/gilbitron-Lean-Slider-ffe9a31/demo/sample-styles.css" type="text/css" /> <link href="../CSS/styles.css" rel="stylesheet" type="text/css" media="screen"> <style type="text/css"> .auto-style1 { margin-bottom: 1em; } </style> </head> <body> <div id="wrapper"> <div id="top"> <div id="logo"> <img alt="English Centre" height="220" src="../Images/book-covered-in-uk.jpg" width="606"></div> <div id="language"> <h3 class="auto-style1">The English Centre </h3><br>07905080578<br> <a href="mailto:Office@english-centre.co.uk"> Office@english-centre.co.uk</a><br><br>Language Select<br><br> </div> </div> <div id="topna"> <ul> <li><a href="../default.html" class="button">Home</a></li> <li><a href="../French/default.html" class="button">About Us</a></li> <li><a href="courses.html" class="button">Courses</a></li> <li><a href="Teachers.html" class="button">Teachers</a></li> <li><a href="FAQ.html" class="button">FAQ</a></li> <li><a href="Contact.html" class="button">Contact</a></li> </ul> </div> <div class="slider-wrapper"> <div id="slider"> <div class="slide1"> <img src="../Images/big ben.jpg" alt="" /> </div> <div class="slide2"> <img src="../Images/main/hills.jpg" alt="" /> </div> <div class="slide3"> <img src="../Images/main/talking people.jpg" alt="" /> </div> <div class="slide4"> <img src="../Images/main/towerbridge.jpg" alt="" /> </div> </div> <div id="slider-direction-nav"></div> <div id="slider-control-nav"></div> </div> <script type="text/javascript"> $(document).ready(function() { var slider = $('#slider').leanSlider({ directionNav: '#slider-direction-nav', controlNav: '#slider-control-nav' }); }); </script> <div id="subbanner"> <marquee behavior="scroll" direction="left"><img alt="English lessons" height="72" src="../Images/main/scroll%20text.jpg" width="1188"></marquee> </div> <!-- #BeginEditable "Content" --> <div id="wrapper0"> <div id="content"> <h1>Contact Us</h1> <p>To find out more information complete the form and we will be in touch soon</p> <div id="form" style="width: 673px"> <form name="feedback" action="../PHP/html_form_send.php" method="post" style="width: 638px"> <ol> <li> <label for="name">Name</label> <input type="text" name="name" id="name"> </li> <li> <label for="telephone">Telephone</label> <input type="tel" name="telephone" id="telephone"> </li> <li> <label for="email">Email</label> <input type="email" name="email" id="email"> </li> <li> <label for="type">Type of Lesson</label> <select name="type"> <option value="single">Single Lessons</option> <option value="package">Lesson Package</option> <option value="friends">Learn with a Friend</option> </select></li> <li> <label for="ability">Current ability</label> <select name="ability"> <option value="beginner">Beginner</option> <option value="beyond beginner">Beyond Beginner</option> <option value="intermediate">Intermediate</option> <option value="fair">Fair</option> <option value="fluent">Fluent</option> </select></li> <li> <label for="previous_lessons">Previous Lessons?</label> <select name="previous_lessons"> <option value="no">No</option> <option value="school only">Learned only in School</option> <option value="over5years">Over 5 Years ago</option> <option value="5years">last 5 Years </option> <option value="2 years">Last 2 Years</option> <option value="pc only">Only on the Computer</option> </select></li> <li> <label for="comments">Comments</label> <textarea name="comments" style="width: 278px; height: 117px"></textarea> </li> <li> <label for="found_site">How did you find us?</label> <select name="found_site"> <option value="google">Google</option> <option value="bing">Bing</option> <option value="yahoo">Yahoo</option> <option value="gumtree">Gumtree</option> <option value="friend">Friend</option> <option value="flyer">Flyer</option> <option value="advert">Advert</option> <option value="other">Other</option> </select></li> <li> <label for="send">Send it</label> <input name="Submit1" type="submit" value="submit" /> </ol> </form> <h2 style="width: 667px"> Our goal is to help you speak fluently!</h2> </div> </div> </div> <div id="wrapper1"> <div id="rightside" style="width: 292px"> <h2> Our Other Services</h2> <ul> <li>Proofreading <li>Dissertation Writing/Proofreading <li>Essay Writing Service <li>CV Writing Service <li>Essay Writing Skills Class <li>Business Plan Writing <li>Marketing Plan Writing <li>PowerPoint Writing </ul> <p> </p> <p>If you require our other services or would like to submit a CV to work for the English Centre please use the email above</p> <img alt="Learn English" height="253" src="../Images/main/students.jpg" width="313"></h3> </div> </div> <!-- #EndEditable --> <!-- #BeginEditable "right%20side" --> <!-- #EndEditable --> <div id="footer"> <p>© Copywrite 2013 - The English Centre, London, UK</p> </div> </div> </body> <!-- #EndTemplate --> </html> EOD echo "$theResults"; ?>
  4. Hi all I have problem with making custom function to deal with my scripts i tried and look on google but cant find here is code i have function errors() { $errors = array(); $_SESSION['errors'] = $key->$errors; foreach ($_SESSION['errors'] as $error) { return $error; } } and i use it like this in my script $error[] = 'Please enter username and password.'; but when i call function i have errors Notice: Undefined variable: key in C:\xampp\htdocs\core\_func.php on line 37 Notice: Trying to get property of non-object in C:\xampp\htdocs\core\_func.phpon line 37 Warning: Invalid argument supplied for foreach() inC:\xampp\htdocs\core\_func.php on line 38 please help me
  5. Hi guys, I was just making a simple login for my website when I came over this bug which I cannot for the life of me work out how to fix. Whenever I enter a password etc. and submit the form it throws up this error, but inserts the information into the database correctly... Strange. Anyway, I will dump my config.php file and the code in question and if anyone would give any hints as to why this is happening it'd be much appreciated. Thanks Config.php <?php $ver = 0.1; $database = "hidden"; // the name of the database. $server = "localhost"; // server to connect to. $db_user = "root"; // mysql username to access the database with. $db_pass = ""; // mysql password to access the database with. $table = "users"; // the table that this script will set up and use. $link = mysql_connect($server, $db_user, $db_pass); mysql_select_db($database,$link); ?> Signup.php: <?php # Grab the info from the config file to connect to the database require 'config.php'; ?> <!DOCTYPE HTML> <html> <head> <title> <?php if(session_id() == "" || !isset($_SESSION)){ echo "Sign Up"; } else{ echo "Re-Directing to the homepage"; } ?> </title> <meta charset="utf-8"> <link rel="stylesheet" href="css/global.css"> </head> <body class="signupPage"> <?php require 'LIP/topbar.php'; # LIP are pages: log in page and the sign up page if(session_id() == "" || !isset($_SESSION)){ } else{ Header ('Location: index.php'); } ?> <div class="title-container"> <h1 class="page-title"> Sign up for hidden </h1> </div> <div class="signup-description"> <p>hidden</p> </div> <div class="form-container"> <form class="" name="" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" autocomplete="on"> <input type="text" class="input-text" name="firstname" placeholder="First name" title="Enter your first name" required autofocus x-webkit-speech /> <br /> <input type="text" name="lastname" class="input-text" placeholder="Last name" title="Enter your last name" required x-webkit-speech /> <br /> <input type="text" name="emailaddress" class="input-text" placeholder="E-Mail Address" title="Enter your E-Mail Address" required x-webkit-speech /> <br /> <input type="password" name="password" class="input-text" placeholder="Password" title="Enter your password" required /> <br /> <input type="submit" class="input-button" name=""> </form> </div> </body> </html> <?php # Start of the code for the login form if(!empty($_POST['firstname']) && !empty($_POST['lastname']) && !empty($_POST['emailaddress']) && !empty($_POST['password'])){ // Above we check if all the fields have been entered // Now we take the input, change it to variables and cleanse it $firstname = $_POST['firstname']; $firstname = ucfirst($firstname); $firstname = htmlentities($firstname); $firstname = stripslashes($firstname); $firstname = mysql_real_escape_string($firstname); $lastname = $_POST['lastname']; $lastname = ucfirst($lastname); $lastname = htmlentities($lastname); $lastname = stripslashes($lastname); $lastname = mysql_real_escape_string($lastname); $eaddr = $_POST['emailaddress']; $eaddr = stripslashes($eaddr); $eaddr = mysql_real_escape_string($eaddr); $passcode = $_POST['password']; $passcode = hash("sha512", $passcode); $check = "SELECT * from emailaddress where eaddr = '".$eaddr."'"; $qry = mysql_query($check); $num_rows = mysql_num_rows($qry); if($num_rows > 0){ echo "The username you have entered is already exist. Please try another username."; echo '<a href="signup.php">Try Again</a>'; exit; } $query = "INSERT INTO users (fname,sname,emailaddress,password) VALUES ('".$firstname."','".$lastname."','".$eaddr."','".$passcode."');"; mysql_query($query); echo "Thank You for Registration."; echo '<a href="register.html">Click Here</a> to login you account.'; exit; } ?>
  6. I'll admit it upfront: I am a total noob to this, so please bare with me. I'm trying to create a simple PHP program with an HTML form to submit an input into PHP which then echos back the user's input but I keep getting an "Object not found!" error when I push the submission button on the page. If you could please tell me what I'm doing wrong, I would really appreciate it. My code is: <form action="index.php" method="post"> <input type="text" name="user_input" size="20"> <input type="submit" name="press" value="Press da button!"> </form> <?php if (isset($_POST['user_input'])) { $post= $_POST['user_input']; echo "You posted $post ."; } ?> Again, thanks a ton.
  7. I've narrowed down my problem to this function... The page won't load, I suspected it was because it was stuck in a loop, but I couldn't see why, checking the error log confirmed this, as there were hundreds of errors for an undeclared variable.... I can't figure out why it is stuck in this loop, and I can't get the undeclared variable to go away, I even renamed it and it is still saying the old name of the variable is undeclared even though it isn't mentioned in the code anywhere I've renamed it.... Can anyone spot what is causing me grief? The only thing that would make sense would be if I wasn't updating the files when I uploaded them, but I am completely certain that I am... error log: code: while ($i<=14) { if($replacement_company_PartNo[$i] = NULL) { //this isn't an item from the database, simply print the description $replacement_Description //write details to new delivery note via 'delnoteitems' $sql = "INSERT INTO `companyorders`.`delnoteitems`(`deliverNote`, `itemDesc`, `itemQuantity`, `itemNotes`, `company_PartNo`) VALUES ('$deliverNote', '$replacement_Part_Name[$i]', '$replacement_Quantity[$i]', '$replacement_Description[$i]', '$replacement_company_PartNo[$i]');" ; $result = mysql_query($sql); if(!$result) {echo "$sql<br>sql error! code: DL4-A031-$i. This isn't an item from the database, skipping write to 'fullnotestock'; however, 'delnoteitems' could not be written to. Round $i."; exit;} } else { //this is an item from the database, the stock listings must be updated as the item is listed onto the delivery note //write details to new delivery note via 'delnoteitems' $sql = "INSERT INTO `companyorders`.`delnoteitems`(`deliverNote`, `itemDesc`, `itemQuantity`, `itemNotes`, `company_PartNo`) VALUES ('$deliverNote', '$replacement_Part_Name[$i]', '$replacement_Quantity[$i]', '$replacement_Description[$i]', '$replacement_company_PartNo[$i]');" ; $result = mysql_query($sql); if(!$result) {echo "$sql<br>sql error! code: DL4-A032-$i. This is an item from the database, havent yet attempted to write to 'fullnotestock'; failed on 'delnoteitems' which could not be written to. Round $i."; exit;} //update the stock listing in 'fullstocklist' $sql = "UPDATE `fullstocklist` SET `Stock`='$stockfromdatabase[$i]' WHERE `company_PartNo`='$replacement_company_PartNo[$i]';" ; $result = mysql_query($sql); if(!$result) {echo "$sql<br>sql error! code: DL4-A033-$i. This is an item from the database, havent yet attempted to write to 'fullnotestock'; failed on 'delnoteitems' which could not be written to. Round $i."; exit;} } $i++; }
  8. Hi, I'm trying to make it so when the whomever enters invalid information into the form, it'll return the error WHICH IT DOES but it also refreshes the page. Now this is a problem for me because the register form is slides down but only when the user presses the 'Register' button. Help will be much appreciated Problem: The pages refreshes when user submits the form and the form returns an error. How it should work: When an error occurs, the page doesn't refresh and should stay where it is and just return an error. The Register Script: <div id="register-container"> <div id="register-wrapper"> <form action="" method="post" name="register_form" id="register_form"> <table border="0" id="table-register"> <th colspan="2"> <h1 class="frm-header-style">Register</h1> <?php if( !(isset( $_POST['register'] ) ) ) { ?> <?php } else { $usr = new Users; $usr->storeFormValues( $_POST ); $errorMessage = ""; $error = false; $username = $_POST['username']; $email = $_POST['email']; $password = $_POST['password']; $cpassword = $_POST['cpassword']; if( strlen($username) < 6 ) { $errorMessage .= "<li class='error'>Username must be more than 6 characters long.</li>"; $error = true; } elseif( strlen($email) < 5 ) { $errorMessage .= "<li class='error'>Email is too short.</li>"; $error = true; } elseif( strlen($password) < 5 ) { $errorMessage .= "<li class='error'>Password must be more than 5 characters long.</li>"; $error = true; } elseif( $password != $cpassword ) { $errorMessage .= "<li class='error'>Password and Confirm password not match.</li>"; $error = true; } elseif(!preg_match('/^[a-zA-Z0-9]{5,}$/', $username)) { $errorMessage .= "<li class='error'>Username can only contain letters & numbers.</li>"; $error = true; } elseif(!preg_match('/^[_A-z0-9-]+((\.|\+)[_A-z0-9-]+)*@[A-z0-9-]+(\.[A-z0-9-]+)*(\.[A-z]{2,4})$/', $email)) { $errorMessage .= "<li class='error'>Email is invalid.</li>"; $error = true; } else { echo $usr->register( $_POST ); $error = false; } if($error) { echo($errorMessage); } } ?> </th> <tr> <td> <p class="frm-text-style">Username:</p> </td> <td> <input type="text" name="username" id="username" class="frm-style" required/> </td> </tr> <tr> <td> <p class="frm-text-style">Email:</p> </td> <td> <input type="text" name="email" id="email" class="frm-style" required/> </td> </tr> <tr> <td> <p class="frm-text-style">Password:</p> </td> <td> <input type="password" name="password" id="password" class="frm-style" required/> </td> </tr> <tr> <td> <p class="frm-text-style">Retype Password:</p> </td> <td> <input type="password" name="cpassword" id="cpassword" class="frm-style" required/> </td> </tr> <tr> <th colspan="2"> <input class="frm-submit-register" name="register" type="submit" value="Submit" /> <input class="frm-submit-close" name="close" id="close-register" type="button" value="Close" /> <th> </tr> </table> </form> </div> </div>
  9. Hi There, My WordPress header.php is giving me some grief. It was working just fine until I went into theme options and tried to specify a new page to appear on the main menu. Then the main menu broke! I get this error message: Warning: implode() [function.implode]: Invalid arguments passed in/nfs/c05/h04/mnt/83132/domains/gwrobinson.com/html/wp/wp-content/themes/gwr/header.php on line 54 Can any of you far superior php experts out there help me figure out how to fix this error message?? Thank you!!! The line of code in question is as follows: <?php $top_pages = get_pages('sort_column=menu_order&include=' . implode(',', get_option('top_navigation', array()))); ?> [/code} The whole header.php file is [code] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>> <head profile="http://gmpg.org/xfn/11"> <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" /> <title><?php wp_title('«', true, 'right'); ?> <?php bloginfo('name'); ?>: Energy Efficient homes for sale in Garison Way & Turnberry Lake</title> <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" /> <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" /> <?php wp_head(); ?> <!--[if lte IE 6]> <style type="text/css" media="screen"> #featured-home .holder .box { background-image: none; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='<?php bloginfo('stylesheet_directory'); ?>/images/featured-home-box.png', sizingMethod='scale'); bottom: -1px; /* height: 250px; /* emulate max-height in ie6 */ } </style> <script type="text/javascript" charset="utf-8"> var isIE6 = true; </script> <![endif]--> <script src="<?php bloginfo('stylesheet_directory'); ?>/js/cufon-yui.js" type="text/javascript" charset="utf-8"></script> <script src="<?php bloginfo('stylesheet_directory'); ?>/js/Trajan_Pro_400.font.js" type="text/javascript" charset="utf-8"></script> <script type="text/javascript" charset="utf-8"> jQuery(function ($) { Cufon.replace('h2, h3, h4'); Cufon.replace('h3 .featuredtitle'); Cufon.replace('span.hthree'); if (typeof isIE6 != "undefined") { var slides_box = $('#featured-home .holder .box'); if ($(slides_box).height() > 250) { $(slides_box).height(250); } var innerpagebox = $('.innerpagebox'); if ($(innerpagebox).height() < 188) { $(innerpagebox ).height(188); } } }); </script> </head> <body <?php body_class(); ?>> <div class="shell"> <div id="header"> <h1 id="logo" class="fl notext"><a href="<?php echo get_option('home'); ?>"><?php bloginfo('name'); ?></a></h1> <div class="header-right"> <?php $top_pages = get_pages('sort_column=menu_order&include=' . implode(',', get_option('top_navigation', array()))); ?> <div id="social"> <div id="facebook"><a href="http://www.facebook.com/pages/GW-Robinson-homes/344500372268786" rel="nofollow" title="Become our fan on Facebook!" onClick="window.open(this.href); return false"></a></div> <div id="twitter"><a href="https://twitter.com/#!/GWRobinsonHomes" rel="nofollow" title="Follow us on Twitter!" onClick="window.open(this.href); return false"></a></div> </div> <p> <?php $i = 1; foreach ($top_pages as $_p): ?> <a href="<?php echo get_permalink($_p->ID); ?>"><?php echo apply_filters('the_title', $_p->post_title); ?></a> <?php if ($i!==count($top_pages)): ?> | <?php endif ?> <?php $i++; endforeach ?> </p> <div id="navigation"> <ul> <?php wp_list_pages('title_li=&sort_column=menu_order&link_before=<span>&link_after=</span>&include=' . implode(',', get_option('header_navigation', array()))) ?> </ul> </div> </div> </div> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-40896628-1', 'gwrobinson.com'); ga('send', 'pageview'); </script> <div id="content">
  10. Greetings, I am new to PHP coding and am currently enrolled in a course at my college that is, well, in my opinion poorly designed. Unfortunately I am stuck with the course so I have to do the best I can with what material they have provided. Working on my second assignment for the course I am having a bit of a problem. This is a very basic script with just enough in it that it should run but I get an error when attempting to test it out. Parse error: syntax error, unexpected 'REQUEST_METHOD' (T_STRING) on line 17 //Initialize pagetitle and include header file $pagetitle = 'David Wilson, IT250 Unit 2'; include('includes/header.php); ?> <form action="unit02.php" method="post"> <fieldset> <label for="gasprice">Gas Price</label> <input type="text" name="gasprice"/> <input type="reset" value="Reset"/> <input type="submit" value="Submit"/> </fieldset> </form> <?php //Check if the form was submitted if ($_SERVER['REQUEST_METHOD'] == 'POST') { if (isset($_POST['gasprice'] && is_numeric($_POST['gasprice']) { $gasprice = $_POST['gasprice']; echo $_POST['gasprice']; } else { echo 'wtf'; } //Include footer file include('includes/footer.php'); ?> The other two pages are as follows. header.php <!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 http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title><?php echo $pagetitle; ?></title> <link rel="stylesheet" href="includes/styles.css" type="text/css" /> </head> <body> footer.php </body> </html> Any help would be appreciated. As I stated before, this is a very simple draft of the actual assignment. I just wanted it to at least allow me to see my form so I can tweak it. Unfortunately I can't even get the form to load. Best Regards, Nightasy
  11. Hi All, When i add a trigger via SQL, i get this error: #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 '' at line 4 The trigger i've tried to import: CREATE TRIGGER updatestock AFTER UPDATE ON ps_stock_available FOR EACH ROW BEGIN UPDATE ps_product_shop SET active=0 WHERE id_product IN (SELECT id_product FROM ps_stock_available WHERE quantity=0); UPDATE ps_product_shop SET active=1 WHERE id_product IN (SELECT id_product FROM ps_stock_available WHERE quantity>0); END i hope someone can help me. Version MySQL: 5.5.21
  12. Hello, This is my first post on the website. Sorry, I din't went to the introduction section straight up. I am getting the following error on the website. The website was working fine before upgrading the php version. It would be a great help if someone could help me sort this out. I have searched many other forum and this seems to be right place to ask for help. You guys seems to have a giant active community. I don't have much knowledge about the php and stuff and I can't pay my developer to fix this Warning: Unknown: Invalid date.timezone value 'Asia/Calcuttaextension', we selected the timezone 'UTC' for now. in Unknown on line 0 Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct() expects exactly 1 parameter, 0 given' in /home/user/public_html/fw/init.php:59 Stack trace: #0 /home/user/public_html/fw/init.php(59): DateTimeZone->__construct() #1 /home/user/public_html/fw/init.php(82): fw::connect(Array) #2 /home/user/public_html/application.php(17): fw::config(Array) #3 {main} thrown in /home/user/public_html/fw/init.php on line 59 # Database require FW.'db'.DIRECTORY_SEPARATOR.DB_ADAPTER.'.php'; db::connect(DB_HOST, DB_USER, DB_PASS); db::select_db(DB_NAME); # Timezone if(class_exists('DateTime')) { $date = new DateTime; if(method_exists($date, 'getOffset')) { $offset = $date->getOffset()/60; $minutes = abs($offset); $hours = floor($minutes/60); $minutes -= $hours*60; db::query('SET time_zone="'.sprintf('%+d:%02d', $hours*($minutes<0?-1:1), $minutes).'"'); } } }
  13. Hello guys, I am trying to run a script but it could not get connected to mysql and I have tried it on 2 different free hosts with different versions of php. I get this error: Warning: mysql_connect(): Unknown MySQL server host 'DB_HOST' (1) in /home/u947202749/public_html/inc/functions.php on line 1918 Couldn't make connection. Here is my function file with line 1917 to 1921 function connect(){ $link = mysql_connect(DB_HOST, DB_USER, DB_PASS) or die("Couldn't make connection."); $db = mysql_select_db(DB_NAME, $link) or die("Couldn't select database"); return $db; } and here is my configuration file which is 100% accurately set according to right details but I wont share them here due to security reasons. $site_url = "http://toorhamza12.fun2pk.com"; $site_name = "Image Hosting"; $site_title = "Image Hosting Script"; $site_meta_description = "Share your images"; $site_meta_keywords = "images, share"; $site_meta_author = "Zamfi"; $site_version = "1.2"; $logo_location = "css/img/logo.png"; // ADMIN CONFIGURATIONS define("ADMIN_EMAIL", "admin@yoursite.com"); // email address for various notifications like IPN's confirmations or error logs, contact form and other administrative things. define("UPLOAD_ONLY_REGISTERED", 0); // 1 = UPLOAD ONLY FOR REGISTERED USERS // 0 = UPLOAD FOR EVERYBODY // DATABASE CONFIGURATIONS define ("hidden", ""); // set database host define ("hidden", ""); // set database user define ("hidden",""); // set database password define ("hidden",""); // set database name and so on. Please help me regarding this issue. Thank You.
  14. ( ! ) SCREAM: Error suppression ignored for ( ! ) Warning: mysql_connect(): php_network_getaddresses: getaddrinfo failed: No such host is known. in C:\wamp\www\widget_corp\includes\connection.php on line 4 Database connection failed: php_network_getaddresses: getaddrinfo failed: No such host is known. I am getting the error. I'm doing the PHP essential training course on Lynda.com. The teacher asked to make a constant.php file and then use constants to store the db user pass etc and then call it via the constant name or whatever and now i'm getting that huge error. I've been stuck for 2 days. Please help.
  15. Hi. Im trying to create a rpg game based on a third party code. But after doing the install.php I get some php errors for the same line on core.php And when I look at the script I get confused as well. This is from the two lines in the script If anybody could help I've would be most grateful Best regards
  16. Hi, I'm in the middle of constructing my registration and login form and I keep getting this error when I try to process the login. Here's the error I'm getting: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'firstname' cannot be null Here's the PHP code: <?php class Users { public $firstname = null; public $lastname = null; public $username = null; public $email = null; public $password = null; public $salt = "Zo4rU5Z1YyKJAASY0PT6EUg7BBYdlEhPaNLuxAwU8lqu1ElzHv0Ri7EM6irpx5w"; public function __construct( $data = array() ) { if( isset( $data['username'] ) ) $this->username = stripslashes( strip_tags( $data['username'] ) ); if( isset( $data['password'] ) ) $this->password = stripslashes( strip_tags( $data['password'] ) ); } public function storeFormValues( $params ) { $this->__construct( $params ); } public function userLogin() { $success = false; try{ $con = new PDO( DB_DSN, DB_USERNAME, DB_PASSWORD ); $con->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION ); $sql = "SELECT * FROM members WHERE username = :username AND password = :password LIMIT 1"; $stmt = $con->prepare( $sql ); $stmt->bindValue( "username", $this->username, PDO::PARAM_STR ); $stmt->bindValue( "password", hash("sha256", $this->password . $this->salt), PDO::PARAM_STR ); $stmt->execute(); $valid = $stmt->fetchColumn(); if( $valid ) { $success = true; } $con = null; return $success; }catch (PDOException $e) { echo $e->getMessage(); return $success; } } public function register() { $correct = false; try { $con = new PDO( DB_DSN, DB_USERNAME, DB_PASSWORD ); $con->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION ); $sql = "INSERT INTO members(firstname, lastname, username, email, password) VALUES(:firstname, :lastname, :username, :email, :password)"; $stmt = $con->prepare( $sql ); $stmt->bindValue( "firstname", $this->firstname, PDO::PARAM_STR ); $stmt->bindValue( "lastname", $this->lastname, PDO::PARAM_STR ); $stmt->bindValue( "username", $this->username, PDO::PARAM_STR ); $stmt->bindValue( "email", $this->email, PDO::PARAM_STR ); $stmt->bindValue( "password", hash("sha256", $this->password . $this->salt), PDO::PARAM_STR ); $stmt->execute(); return "Registration Successful <br/> <a href='index.php'>Login Now</a>"; }catch( PDOException $e ) { return $e->getMessage(); } } } ?> My database layout is as follows Field Type Null Default Comments user_id int(11) No firstname varchar(50) No lastname varchar(50) No username varchar(50) No email varchar(50) No password var(250) No Indexes: Keyname Type Cardinality Field PRIMARY PRIMARY 0 user_id username UNIQUE 0 username email UNIQUE 0 email
  17. hi Guys, I'm trying to get google analytics api libraries to work, I encounter an error that I think has something to do with my server setup - PHP Parse error: syntax error, unexpected T_CONST in /home5/virabhad/public_html/gilzehn/google-api-php-client/examples/analytics/demo/index.php on line 48 when I tried commenting our the "const" declarations and replace them with regular variables the code works (though I get errors on later stages) any help will be apreciated
  18. Hey guys, I am currently trying to finalize my registration page, and i am have some issues with the header() function. i know there are certain rules like no html can be above the header. and what not but i am fairly new to this and can figure out why i am outputting an error. my code is : <?if (isset($_GET['success']) && empty($_GET['success'])) { echo '<h1> Thank you for your registration </h1>'; } else { if (empty($_POST) === false && empty($errors) === true ) { $register_data = array( 'email' => $_POST['register_email'], 'username' => $_POST['register_username'], 'password' => $_POST['password'], 'gender' => $_POST['gender'], 'month' => $_POST['month'], 'date' => $_POST['date'], 'year' => $_POST['year'], 'country' => $_POST['country'], ); user_register($register_data); header('Location: register.php?success'); exit(); } else if ( empty($errors) === false) { echo '<div class="register_errors">'; echo '<span style="color:red"><h3>'; echo output_errors($errors); echo '</h3></span>'; echo '</div>'; } } ?> All of the code works for me until i try to send send the message. The error i get is the following : it directs me to my header.php file <!DOCTYPE html> <div> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="author" content="#"> <meta name="keywords" content="#"> <meta name="description" content="#"> <meta name="robots" content="#"> <meta name="revisit-after" content="7 days"> <link href="css/style.css" rel="stylesheet" type="text/css"> <link href="css/normalize.css" rel="stylesheet" type="text/css"> <script type="text/javascript" src="jscript/sidebar.js"></script> <script type="text/javascript" src="jscript/mootools.js"></script> <body> <div class="top"> Any suggestions ? cant seem to figure this one out
  19. Hello, I am new to mysqli and have a little question. I have tried to find an alternative for a while now but nothing seems to work... maybe somebody could help. So my old code is this function ($email) { $query = mysql_query("SELECT COUNT(`user_id`) FROM users WHERE email = '$email'")or die (mysql_error()); return (mysql_result($query, 0) == 1) ? true : false; } after that the function is used like this : if (login_email_exists($mysqli,$_POST['email']) === true) { $errors[] = 'Sorry this email adress is already in use.'; } And my new code is this function ($mysqli,$email) { $query = $mysqli->query("SELECT COUNT(`user_id`) FROM users WHERE email = '$email'")or die (mysql_error()); return ($query == 1) ? true : false; } Now it seems to always go wrong when I want to check the result and return if it's true or false. If anybody can find an answer or alternative to my problem I would be very happy.
  20. I'm trying to pick out items from an XML file by their titles using Xpath in DOM, but because some have apostrophes, it doesn't work. I've tried replacing the apostrophes using this $query1 = "channel/item[title=$p]/title"; but even that doesn't work. Any advice on how to do this, or alternatives for how to extract elements by their titles in DOM? Here's my code: <?php $q = $_GET["q"]; $q = explode('|^', $q); $counts = count($q); unset($q[$counts-1]); $p = stripslashes($q); $q = stripslashes($p); $dom = new DOMDocument; $dom->preserveWhiteSpace = false; $dom->formatOutput = true; $dom->Load("../$userid.xml"); $xpath = new DOMXPath($dom); foreach ($q as $r) { $p = preg_replace("/'/","",$r); $query1 = "channel/item[title=$p]/title"; $query2 = "channel/item[title=$p]/url"; $query3 = "channel/item[title=$p]"; $entries = $xpath->query($query1); $entries2 = $xpath->query($query2); $entries3 = $xpath->query($query3); foreach ($entries as $entry) { foreach ($entries2 as $entry2) { foreach ($entries3 as $entry3) { $oldchapter = $entry->parentNode->removeChild($entry); $oldchapter2 = $entry2->parentNode->removeChild($entry2); $oldchapter3 = $entry3->parentNode->removeChild($entry3); $dom->preserveWhiteSpace = false; } } } } $dom->formatOutput = true; $dom->save("../$userid.xml") ?> Basically, my code extracts titles from a URL, separated by "|^" (For example title1|^title2|^title3|^). Because the "|^" is appended to the end of each title, I have to remove the empty value from the array. Then, because the titles with apostrophes come in like "Title\\'s", I have to strip slashes twice to get rid of them. Then I load a new DOMdocument, and find the titles from the URL in my existing XML document. Then I want the code to remove the whole items (titles, urls and the item itself) which have the same titles as the ones in the URL, and then save the document.
  21. Hello everyone! I'm adding new fields to the feedback.tpl in DLE. The file is in engine/ajax/feedback.tpl Here is the code: $row['template'] = stripslashes( $row['template'] ); $row['template'] = str_replace( "{%username_to%}", $recipient['fullname'], $row['template'] ); $row['template'] = str_replace( "{%username_from%}", $name, $row['template'] ); $row['template'] = str_replace( "{%text%}", $message, $row['template'] ); $row['template'] = str_replace( "{%ip%}", $_SERVER['REMOTE_ADDR'], $row['template'] ); if(if(empty($_POST[team])) $_POST[team] = "none"; $row['template'] = str_replace( "{%team%}", strip_tags($_POST[team]), $row['template'] ); I'm adding the field, called 'team' and get this error: syntax error, unexpected T_IF But when I remove the first if and bracket, everything works fine, but I always get 'none' result, like the field is empty, but it's not... Help please ^^
  22. Hello, I´m trying to insert data from a form into a mysql table using mysqli and php. I use the code below to connect to the database: $host = "myhost"; $db = "a5066994_tutors"; $user = "a5066994_tutors"; $pass = "mypassword"; $connection = mysqli_connect("$host", "$user", "$pass", "$db"); if ($connection->errno) { printf("Connect failed: %s\n", $connection->error); exit(); and the code below to insert: $stmt = $connection->prepare("INSERT INTO tutorials (Author, Website, Title, Body1, Body2, Body3, Body4, Subtitle1, Subtitle2, Subtitle3, Subtitle4, Category, WTitle, Userid) VALUES ('$author','$website', '$title', '$text1', '$text2', '$text3', '$text4', '$s1', '$s2', '$s3', '$s4', '$cat', '$wtitle', '$userid') "); And it results in this error: Call to a member function execute() on a non-object I have also tried doing a var dump of the connection, which results in: object(mysqli)#1 (0) { } and a var dump of the statement, which results in: bool(false) Any help would be great, thank you!
  23. Hi all, Hi All, I m new with php I m trying to run an open source php script on local host. i m using Easyphp 12.1 apache 2.4.2 php 5.4.6 MySql 5.5.27 1st page of script is load successfully with this url: http://127.0.0.1:8888/phplogin/ when i click on any link "Login" given on page i m facing an error "The connection was reset" and url change with This: http://127.0.0.1/phplogin/login.php/ (no port )
  24. i have found warning message = Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given inC:\xampp\htdocs\articles\artikel.php on line 7 <?php include 'koneksi.php'; $articleid = $_GET['articleid']; $sql_query = 'SELECT ta.*, tca.category_article FROM article_news AS ta INNER JOIN tcategory_article AS tca ON ta.category_article_id = tca.category_article_id WHERE article_id = '.$articleid; $query = mysql_query($sql_query); $row = mysql_fetch_array($query); //--> this is line #7 $msg = $_GET['msg']; if(!empty($msg)){ if($msg = 100){ echo '<h5 style="text-align:center; color:#f00; font-weight: normal">.</h5>'; } } ?> <!--articles--> <a name="TemplateInfo"></a> <input type="hidden" name="prodid" value="<?php echo $row['article_id'];?>" size="1"/> <h1><?php echo $row['judul'];?></h1> <p><a href=""><img src="images/upload/<?php echo $row['photo'];?>" width="100" height="120" class="float-left"></a> <p><?php echo $row['artikel'];?></a>. </p> <!--end of articles--> <p><?php echo $row['category_article'];?></p> <p class="post-footer"> <a href="index.html" class="readmore">Read more</a> <a href="index.html" class="comments">Comments (7)</a> <span class="date"><?php echo $row['tanggal'];?></span> </p> please help me i'm sorry newbie here..
  25. Hi. I am relatively new to php and am trying to code a wordpress theme from scratch. In my header.php I am getting an error: Parse error: syntax error, unexpected ';' in /home/storybou/public_html/wp-content/themes/mint-strawberry/header.php on line 7 Here is the full code for header.php: <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title><?php wp_title('«', true, 'right'); ?><?php bloginfo('name'); ?></title> <link href="<?php bloginfo('sylesheet_url'; ?>")" rel="stylesheet" /> <link href='http://fonts.googleapis.com/css?family=Amatic+SC' rel='stylesheet' type='text/css'> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <!--[if lt IE 9]> <link href="<?php bloginfo('template_url'); ?>/css/ie.css" rel="stylesheet" /> <![endif]--> <!--WP generated header--> <?php wp_head(); ?> <!--End WP generated header--> </head> <body> <div id="container"> <header> <h1><a href="<?php echo get_option('home'); ?>" title="A Story About A Girl">A Story About A Girl</a></h1> <nav role="navigation"> <ul> <li><?php wp_list_pages('title_li=' ); ?> </ul> </nav> </header> I am not sure what is the best way to figure out where the error is. I know a line is given but I can't find anything on that line and know it may not really be relative to what I am seeing. Is there another way to look? A program I can use or a method or something. Any help would be greatly appreciated. Thanks. footer.php.txt
×
×
  • 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.