Search the Community
Showing results for tags 'error'.
-
Respected Users, Few days ago i created a bot site regarding auto comment and response comment etc. but whenever i try to login there using my facebook id and password an error shows up "Login Session Expired". The Problem is with the login script, i am unable to find that errorIts my humble request to you, kindly go through the post and fix me the problem. If u need anything regarding this Error kindly Msg me. Sorry for my poor English. Login PHP Code Posted Below: code removed
-
Think there's some prase error here, but i can't figure out what is wrong. anyone? if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO kommentar (tittel, navn, tekst, tidsstempel, innleggid) VALUES ( %s, %s, %s, NOW(), %s)' GetSQLValueString($_POST['tittel'], "text"), GetSQLValueString($_POST['navn'], "text"), GetSQLValueString($_POST['tekst'], "text"), GetSQLValueString($_GET['innleggid'], "int") ); mysql_select_db($database_bloggkobling, $bloggkobling); $Result1 = mysql_query($insertSQL, $bloggkobling) or die(mysql_error()); } Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in C:\wamp\www\bloggprosjekt\visinnlegg.php on line 50
-
ok i have loaded a .sql file into PHPmyadmin. it is giving me this error :/ what can i do? im using this version: Server version: 5.6.16 - MySQL Community Server (GPL -------------------------------------------------------------------------------- SQL query: /*!40000 ALTER TABLE `group_members` ENABLE KEYS */; -- Dumping structure for table bc.help_subjects CREATE TABLE IF NOT EXISTS `help_subjects` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `caption` varchar(100) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; MySQL said: #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 'CREATE TABLE IF NOT EXISTS `help_subjects` ( `id` int(11) unsigned NOT NULL A' at line 6
- 4 replies
-
- mysql
- phpmyadmin
-
(and 1 more)
Tagged with:
-
//function that takes username and avatar function take_username_avatar() { try{ $results = array(); $query = mysql_query("SELECT username,avatar FROM data WHERE username!='{$_SESSION['username']}'")or die(mysql_error()); while($row = mysql_fetch_assoc($query)) { $results[] = $row; } return $results; } catch (Exception $e){ die("Error showing user list"); } } //page that shows user list $username_avatar = take_username_avatar(); foreach ($username_avatar as $user_avatar ) { ?> <p><a href='index.php?page=profile& username =<?php echo $user_avatar [' username ']; ?>'> <?php echo $kor_avatar[' username '] ?></a></p> <a href='index.php?page=profile&username=<?php echo $ user_avatar ['username']; ?>'> <img src="avatar/<?php echo $kor_avatar['avatar']; ?>" height='100' width='100' alt='avatar'></a> <?php } I have been trying to solve this for some time, even too long and I would really appreciate the help of experienced PHP user. I have made that user can see the list of the other members on the website but I also want to show error message if something goes wrong. I did it with try-catch block but I also been wondering if there is an efficient way to do that. I would also like to know how to make the error to happen because I need to make a print screen for documentation.
-
Hello this error is my problem. help me please $query = "SELECT * FROM car WHERE owner = ".$_POST['owner']."";
-
I found this bug in phpMyAdmin: phpMyAdmin - Errorindex.php: Missing parameter: import_type<a href="./doc/html/faq.html#faqmissingparameters" target="documentation"><img src="themes/dot.gif" title="Documentation" alt="Documentation" class="icon ic_b_help" /></a> index.php: Missing parameter: format<a href="./doc/html/faq.html#faqmissingparameters" target="documentation"><img src="themes/dot.gif" title="Documentation" alt="Documentation" class="icon ic_b_help" /></a> What I did to find it: log in run an SQL statement let the session expire log back in hello ERROR!!!!!
- 1 reply
-
- phpmyadmin
- bug
-
(and 2 more)
Tagged with:
-
Alright, I'm getting this on my website: "Notice: Undefined index: authData in /home/paulmc1/domains/kuarrel.tk/public_html/admin/classes/lib/SessionData.php on line 27 Notice: Undefined index: authData in /home/paulmc1/domains/kuarrel.tk/public_html/admin/classes/lib/SessionData.php on line 29 Notice: Undefined index: HTTP_REFERER in /home/paulmc1/domains/kuarrel.tk/public_html/index.php on line 16 Notice: A session had already been started - ignoring session_start() in /home/paulmc1/domains/kuarrel.tk/public_html/admin/classes/lib/SessionData.php on line 26 Notice: Undefined index: authData in /home/paulmc1/domains/kuarrel.tk/public_html/admin/classes/lib/SessionData.php on line 27 Notice: Undefined index: authData in /home/paulmc1/domains/kuarrel.tk/public_html/admin/classes/lib/SessionData.php on line 29 Fatal error: Class 'MongoClient' not found in /home/paulmc1/domains/kuarrel.tk/public_html/admin/classes/lib/Log.php on line 29" Here's my codes: SessionData.PHP <?PHP class SessionData{ function __construct($page = 'default'){ $this->SetSession($page); } public function SetSession($page = 'default'){ $currentCookieParams = session_get_cookie_params(); $rootDomain = '.kuarrel.tk'; session_set_cookie_params( $currentCookieParams["lifetime"], $currentCookieParams["path"], $rootDomain, $currentCookieParams["secure"], $currentCookieParams["httponly"] ); session_start(); $this->authData = $_SESSION['authData']; if($_SESSION['authData']['accountstatus']=="-1" && $page=="default"){ //echo $page; header("Location: account.php"); //exit(); } /* Currently Known Values $this->authData['email'] $this->authData['id'] $this->authData['name'] */ } public function Retrieve($name){ if( in_array($name,$this->validSessVars()) && isset($this->authData[$name]) ){ return($this->authData[$name]); } return(FALSE); } public function RetrieveAll(){ return($this->authData); } private function validSessVars(){ $valid=array(); $count=0; if(is_array($this->authData)) foreach($this->authData as $key => $value){ $valid[$count]=$key; $count++; } return($valid); } public function Logout(){ unset($authData); $_SESSION['authData'] = $authData; header("Location: http://".$_SERVER["HTTP_HOST"]."/index.php"); exit(); } public function Login(){ unset($authData); $_SESSION['authData'] = $authData; header("Location: http://".$_SERVER["HTTP_HOST"]."/login.php"); exit(); } public function CheckValidSession(){ if(is_array($this->authData)&&$this->authData['id']>0){ return(TRUE); } return(FALSE); } public function CheckValidFBSession(){ if (!$this->CheckValidSession()){ header('location: bind.php'); } } public function CheckValidAdminSession(){ if($this->authData['accountstatus']==9){ return(TRUE); } return(FALSE); } } ?> Index.PHP <?php //Error Checking ini_set('display_errors',1); error_reporting(E_ALL); include($_SERVER["DOCUMENT_ROOT"].'/admin/classes/classes.php'); // Include local class lib $sess = new SessionData(); // Creates session object //$sess->CheckValidFBSession(); if($sess->CheckValidSession()){ header('Location: home.php'); } $log= new log($_SERVER["PHP_SELF"], $_GET, $_POST, $_SERVER['HTTP_REFERER'] ); $stats=new Statistics(); $totalusers=$stats->totalscope(); ?> <html xmlns:fb="//www.facebook.com/2008/fbml"> <script> window.fbAsyncInit = function() { FB.init({ appId : '<?php echo $sess->fbappid; ?>', session : <?php echo json_encode($sess->fbsession); ?>, // don't refetch the session when PHP already has it status : true, // check login status cookie : true, // enable cookies to allow the server to access the session xfbml : true // parse XFBML }); }; (function() { var e = document.createElement('script'); e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js'; e.async = true; document.getElementById('fb-root').appendChild(e); }()); </script> <title>Kuarrel | Welcome to Kuarrel!</title> <meta name="description" content="Kuarrel is an online directory that connects people from throughout the world." /> <meta name="keywords" content="kuarrel, chaibear, chai, sa-mp, sa:mp, 2014" /> <meta name="Generator" content="JB engine designed" /> <meta name="robots" content="index, follow" /> <meta name="OriginalPublicationDate" content="2014/03/12/01:37:22"> <meta name="Headline" content="Kuarrel | Welcome to Kuarrel!"> <meta name="IFS_URL" content="/index.php"> <meta name="contentFlavor" content="PAGE"> <meta name="CPS_SITE_NAME" content="Kuarrel | Welcome to Kuarrel"> <meta name="CPS_SECTION_PATH" content="Index"> <meta name="CPS_ASSET_TYPE" content="STY"> <meta name="CPS_PLATFORM" content="HighWeb"> <meta name="CPS_AUDIENCE" content="US"> <meta property="og:title" content="Kuarrel is an online directory that connects people from throughout the world."> <meta property="og:type" content="website"> <meta property="og:description" content="Kuarrel is an online directory that connects people from throughout the world."> <meta property="og:image" content="http://www.kuarrel.tk/images/logo-right.jpg"> <meta property="og:url" content="http://www.kuarrel.tk/index.php"> <meta property="og:site_name" content="Kuarrel"> <!-- sO3vWw3hwrnxdrwPGTKy2ZOW6yU --> </head> <body> <div id="fb-root"></div> <script> window.fbAsyncInit = function() { FB.Canvas.setAutoResize(); }; (function() { var e = document.createElement('script'); e.async = true; e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js'; document.getElementById('fb-root').appendChild(e); }()); </script> <script src="//connect.facebook.net/en_US/all.js#appId=194568130593245&xfbml=1"></script> <center> <table class="bordertable" cellspacing=0 cellpadding=0 border=0 width=700> <tr><td> <table class="bottomborder" cellspacing=0 cellpadding=0 border=0 width=100%> <tr><td width=350 bgcolor=#3B5998> <img src='images/logo-left.jpg'></td> <td><table cellspacing=0 cellpadding=0 border=0 width=100%><tr><td> <table cellspacing=0 cellpadding=0 border=0 width=100%> <tr><td><a href='register.php'><img alt='Register' src='images/logo-right.jpg' border=0></a></td> <td width=100% bgcolor=#3B5998> </td></tr></table></td></tr> <tr><td><table cellspacing=0 cellpadding=4 border=0 width=100%><tr height=21> <!--<td bgcolor=#3B5998 width=10> </td>--> <?PHP if(!$sess->CheckValidSession()){ include('modules/default/topnav.php'); }else{ include('modules/loggedin/topnav.php'); } ?> <td bgcolor=#3B5998 width=100%> </td> </tr></table></td> </tr></table> </td></tr></table> </td></tr> <tr><td><table cellspacing=0 cellpadding=2 border=0 width=100%> <tr><td valign=top> <table cellspacing=0 cellpadding=0 border=0 width=105> <tr><td> <?PHP if(!$sess->CheckValidSession()){ include('modules/default/leftnav.php'); }else{ include('modules/loggedin/leftnav.php'); } ?> </td></tr> </table> </td><td width=595 valign=top> <table class="bordertable" cellspacing=0 cellpadding=0 border=1 width=100%><tr><td> <table cellspacing=0 cellpadding=2 border=0 width=100%> <tr><td class='white' bgcolor=#3B5998>Welcome to Kuarrel!</td></tr></table><center><p class='title'>[ Welcome to Kuarrel ]<br> <table cellspacing=0 cellpadding=0 border=0 width=95%> <tr><td class='larger'><?=(!empty($_GET['error']));?>"<span style='color:red;font-size:16px;'>Facebook login has been disabled for today, please try again tomorrow.</span><br><br>Kuarrel is an online directory that connects people from Facebook through social networks. <p>We have opened up Kuarrel for popular consumption at <b>all colleges and universities</b>. If you are not part of a college or university, you will be added to the default Kuarrel network. <p>Your account is limited to your own college or university. <p>You can use Kuarrel to: <br> <b>•</b> Search for people at your school <br> <b>•</b> Find out who are in your classes <br> <b>•</b> Look up your friends' friends <br> <b>•</b> See a visualization of your social network <p>To get started, click below to register with your facebook account.<!--<br><font size="+1">Join the <?=$totalusers?> people at Kuarrel today.</font>--> <center> <?php if(strlen($_SESSION['notpartofacollege'])>2){ echo "<b>".$_SESSION['notpartofacollege']."</b>"; } ?> <div id="fb-root"></div> <center><input class='inputsubmit' type="button" value='Register' onclick='javascript:document.location="register.php";'> <input class='inputsubmit' type="button" value=' Login ' onclick='javascript:document.location="login.php";'> <br> </td></tr></table> </td></tr></table> </td></tr></table> <center> <?PHP include('modules/default/bottomnav.php'); ?> </center><br> </td></tr></table> Log.PHP <?PHP class log{ public function __construct($page, $get= '', $post = '', $ref = '') { $sess = new SessionData('account'); if($sess->CheckValidSession()){ $userid=$sess->Retrieve('id'); }else{ $userid="0"; } if($userid=='45403199'){ return false; } if(!$ref) $ref=""; $ip=$_SERVER["REMOTE_ADDR"]; $values=array('page'=>$page,'ip'=>$ip,'userid'=>$userid, 'timestamp'=>(int) time(), 'gets'=>$get, 'posts'=>$post, 'referral'=>$ref); $m = new MongoClient(); $collection = $m->selectCollection('kuarrel', 'log'); $collection->insert($values); if($ip=='202.94.191.47'||$ip=='202.94.191.13'||$ip=='202.94.191.183'){ echo "Your address: ".$ip." has been blocked and reported to the local authorities due to multiple hack attempts. Please contact kuarrelhelpdesk@gmail if you feel this is an error."; die(); } } function lastpage($userid){ $m = new MongoClient(); $collection = $m->selectCollection('thefacebook', 'log'); $cursor = $collection->find(array('userid'=>$userid)); $cursor->sort(array('timestamp'=>-1))->limit(2); $records = iterator_to_array($cursor); return($records[1]['page']); } } ?> Thank you to anyone who can help me!
- 1 reply
-
- php
- undefined index
-
(and 3 more)
Tagged with:
-
[code] <html> <body> <?php include('connect.php'); $ud_NUMB=(int)$_POST["fNumb"]; $ud_PAID=$_POST["fPaid"]; echo $ud_NUMB; echo $ud_PAID; $sql = "UPDATE Teams SET Paid = :paid WHERE Numb = :numb"; $stmt = $db->prepare($sql); $stmt->bindParam(':paid', $_POST['fPaid'], PDO::PARAM_STR); $stmt->bindParam(':numb', $_POST['$fNumb'], PDO::PARAM_STR); $stmt->execute(); echo "\nPDO::errorCode(): "; print $stmt->errorCode(); ?> </br><p><a href='game.php'><H3>Back to main page</H3></a> </body> </html> [/code] My connect works fine, used in other scripts. $db is the connection. My echo of the two passed variables works fine. Example reply from echo is: 8Yes (didn't bother to put in spaces). The only reply on error is: PDO::errorCode(): 00000 I get the prompt to return to the website link at the end. No other error codes. But it does not update my record. It should change record with unique ID of 8 to show Yes in the Paid column. Can someone point me in the right direction here? Thanks
-
Hi, I have this form which debits a user when they sell an item. This is based on a credit system. The script should ideally check the user has enough credits before posting the item, if not then it should redirect the user to purchase more credits. But instead it takes the user into a negative amount of credits and still writes the transaction and sale data to the mysql db. However when I run the script whilst the user has a negative amount, it does come up with the message saying the user does not have enough credits and redirects the user to purchase more credits. Ideally, I need to make credits stop at 0 and not allow the script to work if this would leave the user with a negative balance. Here is the form. Also it can be tested at www.e-quatics.com username aquaman password ozzy2004 <?php include 'core/init.php'; protect_page(); include 'includes/overall/header.php'; if (empty($_POST) === false) { $required_fields = array('username', 'email', 'category', 'listing_title', 'brand', 'model', 'colour', 'quantity', 'price', 'comments', 'postage_type', 'postage_cost'); foreach($_POST as $key=>$value) { if (empty($value) && in_array($key, $required_fields) === true) { $errors[] = 'Fields marked with an asterisk are required'; break 1; } } if (empty($errors) === true) { if(user_exists($_POST['username']) === false) { $errors[] = 'Sorry, the username \'' . $_POST['username'] . '\' does not exist. Have you registered?'; } if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) === false) { $errors[] = 'A valid email address is required'; } if(empty($category) === false) { $errors[] = 'Please select a category'; } if(empty($listing_title) === false) { $errors[] = 'Please enter a title for your listing'; } if(empty($brand) === false) { $errors[] = 'Please enter a brand'; } if(empty($model) === false) { $errors[] = 'Please enter a model'; } if(empty($colour) === false) { $errors[] = 'Please enter a colour'; } if(empty($quantity) === false) { $errors[] = 'Please enter a quantity'; } if(empty($price) === false) { $errors[] = 'Please enter a price'; } if(empty($comments) === false) { $errors[] = 'Please enter some information about your item'; } if(empty($postage_type) === false) { $errors[] = 'Please enter a postage options'; } if(empty($postage_cost) === false) { $errors[] = 'Please enter the postage cost for this item.'; } } $query = "SELECT SUM(amount) FROM transactions WHERE user_id = {$_SESSION['user_id']}"; if ($result = mysql_query($query)) { $row = mysql_fetch_row($result); if ($row[0] <= 0) { echo "You either have no remaining credits or not enough to complete this transaction. You will be redirected to purchase more."; header( "Refresh:5; url=purchase.php", true, 303); exit(); } } } if (isset($_GET['success']) && empty($_GET['success'])) { echo '<h2>Thank you for submitting your listing. Your account has been debited.</h2>'; } else { if (empty($_POST) === false && empty($errors) === true) { $sale_data = array( 'user_id' => $user_data['user_id'], 'username' => $_POST['username'], 'email' => $_POST['email'], 'category' => $_POST['category'], 'listing_title' => $_POST['listing_title'], 'brand' => $_POST['brand'], 'model' => $_POST['model'], 'colour' => $_POST['colour'], 'quantity' => $_POST['quantity'], 'price' => $_POST['price'], 'comments' => $_POST['comments'], 'postage_type' => $_POST['postage_type'], 'postage_cost' => $_POST['postage_cost'], 'bold' => $_POST['bold'], 'rotate' => $_POST['rotate'] ); $bold = $_POST['bold']; $rotate = $_POST['rotate']; $total = $bold + $rotate + 1; $amount = -$total; $memo = "Debit for Item"; registerTransaction($user_id, $amount, $memo); register_saleItem($sale_data); header('Location: other_items.php?success'); exit(); } else if (empty($errors) === false) { echo output_errors($errors); } ?> <script type="text/javascript" src="jquery.js"></script> <form action="" id="sellForm" method="POST"> <input type="hidden" name="username" value="<?php echo $user_data['username']; ?>"></li> <input type="hidden" name="email" value="<?php echo $user_data['email']; ?>"></li> <h2>Sell your item</h2> <p><strong>A basic listing will cost 1 credit - extras will be added to the total cost of your listing</strong></p> <ul> <li>Category*:</br> <select name="category"> <option value="none">--choose--</option> <option value="air_pumps">Air Pumps</option> <option value="air_stones">Air Stones</option> <option value="aquariums">Aquariums</option> <option value="cleaning">Cleaning & Maintenance</option> <option value="equipment">CO2 Equipment</option> <option value="coral">Coral & Live Rock</option> <option value="decorations">Decorations</option> <option value="feeders">Feeders</option> <option value="filter_media">Filter Media & Accessories</option> <option value="food">Food</option> <option value="gravel">Gravel & Substrate</option> <option value="health_care">Health Care</option> <option value="heaters">Heaters & Chillers </option> <option value="lighting">Lighting & Hoods</option> <option value="meters">Meters & Controllers</option> <option value="deionization">Reverse Osmosis & Deionization </option> <option value="tubing">Tubing & Valves</option> <option value="uv">UV Steriliser Water Pumps</option> <option value="water_tests">Water Tests & Treatment</option> <option value="other">Other Fish & Aquarium</option> </select> </li> <li>Listing Title*:</br> <input type="text" name="listing_title"> <li><strong>Would you like your listing displayed in Bold?: <input type="checkbox" name="bold" value="1"/> 1 Credit</strong> </li> <li>Brand*:</br> <select name="brand"> <option>Choose...</option> <option value="AI (Aqua Illumination)">AI (Aqua Illumination)</option> <option value="Algarde">Algarde</option> <option value="API">API</option> <option value="AquaEl">AquaEl</option> <option value="AquaGro">AquaGro</option> <option value="Aquamedic">Aquamedic</option> <option value="Aquarian">Aquarian</option> <option value="Aquarium Systems">Aquarium Systems</option> <option value="Aquatlantis">Aquatlantis</option> <option value="Arcadia">Arcadia</option> <option value="Azoo">Azoo</option> <option value="BiOrb/Reef One">BiOrb/Reef One</option> <option value="Blagdon">Blagdon</option> <option value="Boyu">Boyu</option> <option value="Classica">Classica</option> <option value="Cloverleaf">Cloverleaf</option> <option value="Deltec/D-D">Deltec/D-D</option> <option value="Dennerle">Dennerle</option> <option value="Eheim">Eheim</option> <option value="ESHa">ESHa</option> <option value="Hagen/Fluval">Hagen/Fluval</option> <option value="Hikari">Hikari</option> <option value="Hobby">Hobby</option> <option value="Hugo Kamishi">Hugo Kamishi</option> <option value="Interpet">Interpet </option> <option value="JMC">JMC</option> <option value="Juwel">Juwel</option> <option value="King British">King British</option> <option value="New Era">New Era</option> <option value="Nishikoi">Nishikoi</option> <option value="NT Labs">NT Labs</option> <option value="Oase">Oase</option> <option value="Ocean Nutrition">Ocean Nutrition</option> <option value="Penn Plax">Penn Plax</option> <option value="Pontec">Pontec</option> <option value="Red Sea">Red Sea</option> <option value="Rena">Rena</option> <option value="Salifert">Salifert</option> <option value="Seachem">Seachem</option> <option value="Seneye">Seneye</option> <option value="SuperFish">SuperFish</option> <option value="Tanktests">Tanktests</option> <option value="Tetra">Tetra</option> <option value="TMC">TMC</option> <option value="Tunze">Tunze</option> <option value="Two Little Fishies">Two Little Fishies</option> <option value="Waterlife">Waterlife</option> <option value="Wave Point">Wave Point</option> <option value="other">Other</option> </select> </li> <li>Model*:</br> <input type="text" name="model"> </li> <li>Colour*:</br> <select name="colour"> <option value="">--choose one--</option> <option value="White">White</option> <option value="Grey">Grey</option> <option value="Black">Black</option> <option value="Blue">Blue</option> <option value="Green">Green</option> <option value="Orange">Orange</option> <option value="Red">Red</option> <option value="Multicoloured">Multicoloured</option> <option value="Other">Other</option> </select> </li> <li>Quantity*:</br> <select name="quantity"> <option value="">--choose one--</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> <option value="25">25</option> </select><strong> 1 Credit entitles you to sell up to 25 of the same item. </strong> </li> <li>Price*:<br> <input type="text" name="price"> In UK Pound Sterling </li> <li>Description*:</br> <textarea name="comments"></textarea> </li> <li>Postage Type*:</br> <select name="postage_type"> <option>Choose...</option> <option>Choose...</option> <option disabled>Economy services</option> <option value="UK_CollectPlusTracked">Collect+ Economy Tracked (3 to 5 working days)</option> <option value="UK_HermesTracked">Hermes Tracked (3 to 5 working days)</option> <option value="UK_RoyalMailSecondClassStandard">Royal Mail 2nd Class (2 to 3 working days)</option> <option value="UK_RoyalMailSecondClassRecorded">Royal Mail 2nd Class Signed For (2 to 3 working days)</option> <option value="UK_RoyalMailTracked">Royal Mail Tracked 48 (2 to 3 working days)</option> <option value="UK_RoyalMail48">Royal Mail 48 (2 to 3 working days)</option> <option value="UK_OtherCourier3Days">Other Courier 3 days (3 working days)</option> <option value="UK_OtherCourier5Days">Other Courier 5 days (5 working days)</option> <option value="UK_OtherCourier">Other Courier (3 to 5 working days)</option> <option value="UK_SellersStandardRate">Other Courier 3-5 days (3 to 5 working days)</option> <option disabled>Standard services</option> <option value="UK_RoyalMailFirstClassStandard">Royal Mail 1st Class (1 working day)</option> <option value="UK_RoyalMailFirstClassRecorded">Royal Mail 1st Class Signed For (1 working day)</option> <option value="UK_RoyalMailNextDay">Royal Mail Tracked 24 (1 working day)</option> <option value="UK_RoyalMail24">Royal Mail 24 (1 working day)</option> <option value="UK_CollectPlusStandard">Collect+ Standard (2 working days)</option> <option value="UK_Parcelforce48">Parcelforce 48 (1 to 2 working days)</option> <option value="UK_OtherCourier48">Other 48 Hour Courier (1 to 2 working days)</option> <option disabled>Express services</option> <option value="UK_RoyalMailSpecialDeliveryNextDay">Royal Mail Special Delivery (TM) 1:00 pm (1 working day)</option> <option value="UK_RoyalMailSpecialDelivery9am">Royal Mail Special Delivery (TM) 9:00 am (1 working day)</option> <option value="UK_Parcelforce24">Parcelforce 24 (1 working day)</option> <option value="UK_OtherCourier24">Other 24 Hour Courier (1 working day)</option> <option disabled>Services from outside UK</option> <option value="UK_EconomyShippingFromOutside">Economy Delivery from outside UK (10 to 22 working days)</option> <option value="StandardDeliveryfromOutsideUKwithRoyalMail">Standard Delivery from outside UK with Royal Mail (7 to 13 working days)</option> <option value="UK_StandardShippingFromOutside">Standard Delivery from outside UK (4 to 10 working days)</option> <option value="UK_ExpeditedShippingFromOutside">Express Delivery from outside UK (1 to 3 working days)</option> <option value="UK_FedExIntlEconomy">FedEx International Economy (3 to 4 working days)</option> <option value="UK_TntIntlExp">TNT International Express (2 to 3 working days)</option> <option value="UK_TrackedDeliveryFromAbroad">Tracked delivery from outside UK (2 to 5 working days)</option> <option disabled>Collection</option> <option value="UK_CollectInPerson">Collection in Person </option> </select> </li> <li>Postage Cost*:</br> <input type="text" name="postage_cost"> </li> </ul> <ul> <li>Upload Photo:</br> <input id="file" type="file" name="uploadPhoto"> </li> <li><input type="checkbox" name="rotate" value="10"/><strong>For 10 credits, you can have your listing displayed on our homepage on a rotation basis. </strong> </li> <li> <input type="submit" value="List Item"></li> </ul> </form> <?php } ?> <?php include 'includes/overall/footer.php'; ?> Many Thanks Paul
-
My code is, <?php // This block allows our program to access the MySQL database. // Stores your login information in PHP variables require_once '223login.php'; // Accesses the login information to connect to the MySQL server using your credentials and database $db_server = mysql_connect($db_hostname, $db_username, $db_password); // This provides the error message that will appear if your credentials or database are invalid if (!$db_server) die("Unable to connect to MySQL: " . mysql_error()); mysql_select_db($db_database) or die("Unable to select database: " . mysql_error()); // Store the query string from 2.2.3.A Step 17 $query = "SELECT * FROM requests WHERE model_id=1"; // Searches the database returning results that match the query // Results come in a table stored in $requests_for_model $requests_for_model = mysql_query($query); // The mysql_num_rows function returns an integer representation of number of rows for the table passed as an argument $number_of_requests = mysql_num_rows($requests_for_model); for ($current_row = 0; $current_row < $number_of_requests; $current_row++) { // walker variable (through rows in the table) $request = mysql_fetch_row($requests_for_model); // query directed to get a table containing the one row that has a store matching the store ID in the current request $query = "SELECT * FROM store_info WHERE store_id='" . $request[1] . "'"; $store_requesting = mysql_query($query); // A table containing the store $store = mysql_fetch_row($store_requesting); // Get the only row in the table (unique store ID number guarantees this) echo $store[2]; // output the 2nd item in the row for that store, which is the city if ($current_row < $number_of_requests - 1) // Makes sure commas are only printed after results that are not the last { echo ", "; } } ?> I do not know how to fix this. Help much appreciated.
-
I get this error message via email. I can see that I have session_start() in two places in the same php file I can see what is wrong, but which one do I remove? Hope this is enough.
-
Hey there Wanted to ask a question with my SMTP setting not authenticating I get an error like this : PHP Warning: mail(): SMTP server response: 530 SMTP authentication is required. in file.php on line 190 Even tho i provided all the details for the SMTP to authenticate . <?php include '../header.php'; include '../config2.php'; $thankYouPage = '/success.php'; $allowedFields = array( 'login_email', 'login_password', 'confirm', 'first_name', 'last_name', 'address_one', 'address_two', 'town_city', 'county_option', 'post_code', 'phone_number', 'agree', ); $requiredFields = array( 'login_email'=> '*Email address is required.', 'login_password'=> '*Password is required.', 'confirm'=> '*Please confirm your password(required).', 'first_name'=> '*Your First Name is required.', 'last_name'=> '*Your Last Name is required.', 'address_one'=> '*First Line of your address is required.', 'address_two'=> '*Second Line of your address is required.', 'town_city'=> '*Town/City is required.', 'county_option'=> '*County is required.', 'post_code'=> '*Post Code is required.', 'phone_number'=> '*Phone Number is required.', 'agree'=> '*You must agree with our Terms & Conditions .', ); $errors = array(); foreach($requiredFields as $fieldname => $errorMsg) { if(empty($_POST[$fieldname])) { $errors[] = $errorMsg; } } foreach($_POST AS $key => $value) { if(in_array($key, $allowedFields)) { ${$key} = $value; } } if(count($errors) > 0) { $errorString.= '<ul>'; foreach($errors as $error) { $errorString.= "<li>$error</li>"; } $errorString.= '</ul>'; ?> <html> <div id="title"> <div class="inner"> <h1>Account Registration</h1> </div> </div> <div id="content"> <div class="container inner"> </head> <body> <h1>Error Processing Form</h1> <br></br> <h3>Some Information was not Entered,please return to the form and fill it out </h3> <tr></tr> <?php echo $errorString; ?> <p></p> <p><a href="register.php" class="button">Go Back to the Form</a></p> </body> </div> </div> </html> <?php } else { $email = $_POST['login_email']; $pass = SHA1($_POST['login_password']); $confirm = SHA1($_POST['confirm']); $fname = $_POST['first_name']; $lname = $_POST['last_name']; $addressone = $_POST['address_one']; $addresstwo = $_POST['address_two']; $towncity = $_POST['town_city']; $countyoption = $_POST['county_option']; $postcode = $_POST['post_code']; $phone = $_POST['phone_number']; $Activation = md5(uniqid(rand())); $insert = 'INSERT into users( login_email, login_password, confirm, first_name, last_name, address_one, address_two, town_city, county_option, post_code, phone_number, Activation) VALUES("'.$email.'","'.$pass.'","'.$confirm.'","'.$fname.'","'.$lname.'","'.$addressone.'","'.$addresstwo.'","'.$towncity.'","'.$countyoption.'","'.$postcode.'","'.$phone.'","'.$Activation.'")'; $result2 = mysql_query($insert) or die("Failed Inserting your data"); if($result2) { require("class.phpmailer.php"); $mail = new PHPMailer(); $mail->IsSMTP(); // telling the class to use SMTP $mail->SMTPAuth = true; $mail->Host = "smtp.mysettings.com"; // SMTP server $mail->Username = "support@myhost"; // SMTP account username $mail->Password = "password"; // SMTP account password $mail->From = "myhost@myhost.com"; $mail->FromName = "Admin"; $mail->AddAddress($email,$fname." ".$lname); $mail->Subject = "First PHPMailer Message"; $mail->Body = "Hi! \n\n This is my first e-mail sent through PHPMailer."; $mail->WordWrap = 50; if(!$mail->Send()) { echo 'Message was not sent.'; echo 'Mailer error: ' . $mail->ErrorInfo; } else { echo 'Message has been sent.'; } $to = $email; $subject = "Confirmation from Test to $username"; $header = "Test: Account Confirmation from Test"; $message = "Please click the link below to verify and activate your account."; $message .= "http://www.test.com/account/confirm.php?passkey=$activation"; $sentmail = mail($to,$subject,$message,$header); if($sentmail) { echo "Your Confirmation link Has Been Sent To Your Email Address."; } else { echo "Cannot send Confirmation link to your e-mail address"; } } } header( 'Location: /account/success.php' ) ; include '../footer.php'; ?>
-
Hey guys, I am currently facing an issue with my profile.php page for my website. i have a function that is grabbing information of a logged in user grabbing his ID and his data array combining the 2 and creating a variable that will let me echo out the info for the end user on their profile page. the function that is creating an error : function user_data($user_id){$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) . '`' ; $query = ("SELECT $fields FROM `users` WHERE `user_id` = $user_id"); echo $query . '<br><br>' ; < ---- ADDED FOR DEBUGGING --------- NOT PART OF CODE $run = mysql_query($query); print_r($run); < ---- ADDED FOR DEBUGGING --------- NOT PART OF CODE echo '<br><br>'; < ---- ADDED FOR DEBUGGING --------- NOT PART OF CODE $data = mysql_fetch_assoc($run); print_r($data) . '<br><br>'; < ---- ADDED FOR DEBUGGING --------- NOT PART OF CODE return $data; die(); < ---- ADDED FOR DEBUGGING --------- NOT PART OF CODE } } The function seems to work properly when printing the array and the query , firing the query independently in sql and getting a TRUE; Results: Line 156 of this file is that Function above ^ I dont understand why i am getting this error : I understand that i need the $query to fire correctly and return a resource to the fetch_assoc() , but as it shows above the resource is being provided and is still returning as a string ???. any suggestions ?
-
This is my php code if(mysqli_query($con,"INSERT INTO transactions (ID, Amount, To, From, Description, Type) VALUES ('23', '46', 'hello', 'hello', 'hell1', 'asddsa')")) { return "success"; } echo mysqli_error($con); I get this error 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 'To, From, Description, Type) VALUES ('23', '46', 'hello', 'hello', 'hell1', 'asd' at line 1 What am i doing wrong?
-
Hello, I'm coding a log in page and I keep getting this problem with mysqli_result. It's a mysqli server. My error is: Fatal error: Cannot use object of type mysqli_result as array in /home/a7017672/public_html/login.html on line 34 My code is: <?PHP if(isset($_SESSION['loggedin'])) { die("You are already logged in!"); } if(isset($_POST['submit'])) { $email = mysqli_real_escape_string($con,$_POST['username']); $pass = mysqli_real_escape_string($con,$_POST['password']); $mysql = mysqli_query($con,"SELECT * FROM users WHERE email_address = '{$email}' AND password = '{$pass}'"); $mysql2 = mysqli_fetch_array($mysql); if (!$mysql ||mysqli_num_rows($mysql) < 1) { die("Incorrect password!"); } $_SESSION['loggedin'] = "YES"; $_SESSION['email'] = $email; $_SESSION['fname'] = $mysql['first_name']; $_SESSION['lname'] = $mysql['last_name']; $_SESSION['add1'] = $mysql['address_1']; $_SESSION['add2'] = $mysql['address_2']; $_SESSION['county'] = $mysql['county']; $_SESSION['postcode'] = $mysql['postcode']; $_SESSION['tel'] = $mysql['tel_no']; $_SESSION['mobile'] = $mysql['mobile_no']; $_SESSION['team'] = $mysql['team']; $_SESSION['ismanager'] = $mysql['is_manager']; $_SESSION['isadmin'] = $mysql['is_admin']; $_SESSION['sysadmin'] = $mysql['is_sysadmin']; die("You are now logged in!"); } echo "<form method='POST'> <p style='font-size: 14pt;'>Username (Email): <br><input type='text' name='username' maxlength='50' size='30'> <br /> <p style='font-size: 14pt;'>Password:<br><input type='text' name='password' maxlength='50' size='30'><br /> <input type='submit' name='submit' value='Login'> </form>"; ?> Any help is greatly appreciated!
-
hi i was just wondering how i would go about keeping user input in a field if an error occurs e.g. if i accidentally type in a special character into my form it will display a message saying : is not aloud or something like that but once this is shown all user input is lost so they would have to type it in again, ive tryed going online and i cant seem to find anything that works as it comes up with undifiened index <input type="text" name="clientname" value="<?php echo htmlspecialchars($_post['clientname']);?> > aswell as this im really in need of a message that says success, ive got no clue how i would go about doing it. what i need is a message that says 'form submitted'once you press submit and when no errors occur. greatly apreciate anyone that can help
-
Hello, I've been working on my company site (Wordpress based) on XAMPP, which managed to get confused with the live site (my bad, I didn't update all the links). From the files I downloaded, I am no getting the following error when loading the site - I haven't changed anything in this file, so I'm baffled as to what has happened! line 137 is - $pinfos= get_group ('Page-Info',762); //print_r($pinfos); Any ideas?! I'm new to php, so finding this very trying!!! Many thanks
-
Hi, I have a problem with importing .csv file. The content of file have some rows with invalid culomn number. Can I skip rows with this error? My code is: <?php $addauto = 1; $delimiter = ';'; $csoport_kod = new mysqli('localhost', 'root', '', '2012'); $csoport_kod->query("DELETE FROM gf1"); $i=1; if (($handle = fopen("ftp://2012.com/gf1.csv", "r")) !== FALSE) { while (($data = fgetcsv($handle, 10000, $delimiter)) !== FALSE) { foreach($data as $i => $content) { $data[$i] = $csoport_kod->real_escape_string($content); } $csoport_kod->query ("INSERT ignore INTO gf1 VALUES('" . implode("','", $data) . "');"); } fclose($handle); } echo 'OK' ?> THX!
-
My error codes are not working , i declared them as follow if(isset($_POST['login_submit'])){ $query = mysql_query("SELECT id FROM users WHERE login_email = '". $_POST['login_email'] ."'") or die(mysql_error()); $email_check = mysql_num_rows($query); $email_check_data = mysql_fetch_array($query); if(empty($_POST['login_email']) || empty($_POST['login_password'])){ echo "<div class=\"notification warning\"> Please fill in all the fields below </div>"; } elseif($email_check == 0) { echo "<div class=\"notification error\"> Email address or password . Please check your email! </div>"; is there anything wrong ? If the fields are empty or i input no email or password no erros displayed
-
hi ive encountered around 15 problems at once but just about all of them are on the same row <!DOCTYPE HTML> <html> <head> <style> .error {color: #FF0000;} </style> </head> <body> <?php $con = mysqli_connect("localhost","root","","nib"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } // define variables and set to empty values $companyname = $firstname = $address1 = $address2 = $area = $city = $postcode = $email = $website = $clubphone = $homephone = $mobilephone = $typeofbusiness = ""; if ($_SERVER["REQUEST_METHOD"] == "POST") { if (empty($_POST["companyname"])) {$errors['companyname'] = "please enter your companys name";} else {$companyname = test_input($_POST["companyname"]);} if (empty($_POST["typeofbusiness"])) {$errors['typeofbusiness'] = "please enter your TypeofBusiness";} else {$typeofbusiness = test_input($_POST["typeofbusiness"]);} if (empty($_POST["firstname"])) {$errors['firstname'] = "Please Enter Your First Name";} else {$firstname = test_input($_POST["firstname"]);} if (empty($_POST["address1"])) {$errors['address1'] = "Please Enter Address 1";} else {$address1 = test_input($_POST["address1"]);} if (empty($_POST["address2"])) {$address2 = test_input($_POST["address2"]);} if (empty($_POST["area"])) {$errors['area'] = "Please enter Area";} else {$area = test_input($_POST["area"]);} if (empty($_POST["city"])) {$errors['city'] = "Please Enter City";} else {$city = test_input($_POST["city"]);} if (empty($_POST["postcode"])) {$errors['postcode'] = "Please enter your PostCode";} else {$postcode = test_input($_POST["postcode"]);} if (empty($_POST["email"])) {$errors['email'] = "Please enter your Email";} else {$email = test_input($_POST["email"]);} if (empty($_POST["Website"])) {$errors['Website'] = "Please Enter your Website";} else {$Website = test_input($_POST["Website"]);} if (empty($_POST["ClubNumber"])) {$errors['clubnumber'] = "Please enter your club number";} else {$website = test_input($_POST["clubphone"]);} if (empty($_POST["HomeNumber"])) {$errors['homenumber'] = "Please enter your home number";} else {$website = test_input($_POST["homephone"]);} if (empty($_POST["MobileNumber"])) {$errors['mobilenumber'] = "Please enter your mobile number";} else {$website = test_input($_POST["mobilephone"]);} } function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } ?> <h2>Add Leads</h2> <p><span class="error">* required field.</span></p> <form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"> <table border = "0"> <tr> <td>Company Name:</td><td> <input type="text" name="companyname"></td> <td><span class="error">* <?php if (isset($errors['companyname'])) echo $errors['companyname']; ?></span></td> </tr> <tr> <td>type of business:</td><td> <input type="text" name="typeofbusiness"></td> <td><span class="error">* <?php if (isset($errors['companyname'])) echo $errors['companyname']; ?></span></td> </tr> <tr> <td>First Name:</td><td> <input type="text" name="firstname"></td> <td><span class="error">* <?php if (isset($errors['firstname'])) echo $errors['firstname']; ?></span></td> </tr> <tr> <td>Address 1:</td><td> <input type="text" name="address1"></td> <td><span class="error">* <?php if (isset($errors['address1'])) echo $errors['address1']; ?></span></td> </tr> <tr> <td>Address 2:</td><td><input type="text" name="address2"></td> </tr> <tr> <td>Area:</td> <td><input type="text" name="area"></td> <td><span class="error">* <?php if (isset($errors['area'])) echo $errors['area']; ?></span></td> </tr> <tr> <td>PostCode:</td> <td><input type="text" name="postcode"></td> <td><span class="error">* <?php if (isset($errors['postcode'])) echo $errors['postcode']; ?></span></td> </tr> <tr> <td>City:</td> <td><input type="text" name="city"></td> <td><span class="error">* <?php if (isset($errors['city'])) echo $errors['city']; ?></span></td> </tr> <tr> <td>Email:</td> <td><input type="text" name="email"></td> <td><span class="error">* <?php if (isset($errors['email'])) echo $errors['email']; ?></span></td> </tr> <tr> <td>Website:</td> <td><input type="text" name="website"></td> <td><span class="error">* <?php if (isset($errors['website'])) echo $errors['website']; ?></span></td> </tr> <tr> <td>Club phone:</td> <td><input type="text" name="clubphone"></td> <td><span class="error">* <?php if (isset($errors['clubphone'])) echo $errors['clubphone']; ?></span></td> </tr> <tr> <td>home phone:</td> <td><input type="text" name="homephone"></td> <td><span class="error">* <?php if (isset($errors['homephone'])) echo $errors['homephone']; ?></span></td> </tr> </tr> <tr> <td>mobile phone:</td> <td><input type="text" name="mobilephone"></td> <td><span class="error">* <?php if (isset($errors['mobilephone'])) echo $errors['mobilephone']; ?></span></td> </tr> <tr> <td><input type="submit" name="submit" value="Submit"></td> </tr> <?php if (count($errors)==0) { $con = mysqli_connect("localhost","root","","nib"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $sql="INSERT INTO tbl_club_contacts (CompanyName, FirstName, Address1, Address2, Area, City, PostCode, Email, Website, ClubPhone, HomePhone, MobilePhone ) VALUES ('$_POST[companyname]','$_POST[firstname]','$_POST[address1]','$_POST[address2]','$_POST[area]','$_POST[city]','$_POST[postcode]','$_POST[email]','$_POST[website]','$_POST[clubphone]','$_POST[homephone]','$_POST[mobilephone]','$_POST[typeofbusiness]')"; if (!mysqli_query($con,$sql)) { die('Error: ' . mysqli_error($con)); echo "record added"; } mysqli_close($con); } // end if $errors == 0 ?> </form> </body> </html> and the errors ( ! ) Notice: Undefined variable: errors in C:\wamp\www\AddLeads\addeadstemplate.php on line 161 Call Stack # Time Memory Function Location 1 0.0000 166344 {main}( ) ..\addeadstemplate.php:0 ( ! ) Notice: Undefined index: companyname in C:\wamp\www\AddLeads\addeadstemplate.php on line 172 Call Stack # Time Memory Function Location 1 0.0000 166344 {main}( ) ..\addeadstemplate.php:0 ( ! ) Notice: Undefined index: firstname in C:\wamp\www\AddLeads\addeadstemplate.php on line 172 Call Stack # Time Memory Function Location 1 0.0000 166344 {main}( ) ..\addeadstemplate.php:0 ( ! ) Notice: Undefined index: address1 in C:\wamp\www\AddLeads\addeadstemplate.php on line 172 Call Stack # Time Memory Function Location 1 0.0000 166344 {main}( ) ..\addeadstemplate.php:0 ( ! ) Notice: Undefined index: address2 in C:\wamp\www\AddLeads\addeadstemplate.php on line 172 Call Stack # Time Memory Function Location 1 0.0000 166344 {main}( ) ..\addeadstemplate.php:0 ( ! ) Notice: Undefined index: area in C:\wamp\www\AddLeads\addeadstemplate.php on line 172 Call Stack # Time Memory Function Location 1 0.0000 166344 {main}( ) ..\addeadstemplate.php:0 ( ! ) Notice: Undefined index: city in C:\wamp\www\AddLeads\addeadstemplate.php on line 172 Call Stack # Time Memory Function Location 1 0.0000 166344 {main}( ) ..\addeadstemplate.php:0 ( ! ) Notice: Undefined index: postcode in C:\wamp\www\AddLeads\addeadstemplate.php on line 172 Call Stack # Time Memory Function Location 1 0.0000 166344 {main}( ) ..\addeadstemplate.php:0 ( ! ) Notice: Undefined index: email in C:\wamp\www\AddLeads\addeadstemplate.php on line 172 Call Stack # Time Memory Function Location 1 0.0000 166344 {main}( ) ..\addeadstemplate.php:0 ( ! ) Notice: Undefined index: website in C:\wamp\www\AddLeads\addeadstemplate.php on line 172 Call Stack # Time Memory Function Location 1 0.0000 166344 {main}( ) ..\addeadstemplate.php:0 ( ! ) Notice: Undefined index: clubphone in C:\wamp\www\AddLeads\addeadstemplate.php on line 172 Call Stack # Time Memory Function Location 1 0.0000 166344 {main}( ) ..\addeadstemplate.php:0 ( ! ) Notice: Undefined index: homephone in C:\wamp\www\AddLeads\addeadstemplate.php on line 172 Call Stack # Time Memory Function Location 1 0.0000 166344 {main}( ) ..\addeadstemplate.php:0 ( ! ) Notice: Undefined index: mobilephone in C:\wamp\www\AddLeads\addeadstemplate.php on line 172 Call Stack # Time Memory Function Location 1 0.0000 166344 {main}( ) ..\addeadstemplate.php:0 ( ! ) Notice: Undefined index: typeofbusiness in C:\wamp\www\AddLeads\addeadstemplate.php on line 172 Call Stack # Time Memory Function Location 1 0.0000 166344 {main}( ) ..\addeadstemplate.php:0 Error: Column count doesn't match value count at row 1 if anyone can help please get back to me soon as
-
Hello, I am trying to write a bit of code that will open a different page url depending on whether the value in my 'newsimage' table is set to left, right or centre. There is a news page which contains a list of news snippets and when you click 'read more' it should direct to one of three pages depending on where the 'image' should sit. The PHP is in a seperate file to the news page. This is the code that should display the news snippets. <div id="sectionright"> <div class="sectionhead"> <h2 class="sect editable" id="h2top">Media</h2> </div> <div class="padder18"></div> <?php newsform(); top10news($s,$t,$u,$w); ?> </div> This is the code in the seperate PHP file that displays the content. function top10news($s, $t, $u, $w) { $con = mysqli_connect("ip", "server", "password", "database name"); if (mysqli_connect_errno($con)) { echo "<p class='sect'>Could not connect to DB</p>"; // echo "<p class='sect'>Could not connect to DB " . mysqli_connect_error() . "</p>"; } else { // echo "<p class='sect'>Connected to DB</p>"; $q = "SELECT DISTINCT newsitem.niid,newstitle,newssnippet,sitename,newsimage FROM newsitem,newsbusiness WHERE newsitem.niid=newsbusiness.niid AND newsstatus='enabled' "; if ("$u" == "Any") { } else { $q = $q . "AND sitename='$u' "; } if ("$s" == "Any") { } else { $parts = explode('-', $s); $y = $parts[0]; $m = $parts[1]; $q = $q . "AND YEAR(newsdate) = $y AND MONTH(newsdate) = $m "; } $q = $q . "ORDER BY newsdate DESC LIMIT 0,10"; // echo "<p class='news'>$s</p>"; // echo "<p class='news'>$q</p>"; $result = mysqli_query($con, $q); while ($tnrow = mysqli_fetch_array($result)) { echo " <div class='newssummary'>"; if ("" . $tnrow['newsimage'] . "" == "none") { echo <p class = 'newsmore' > < a href = 'newsitem.php?i=" . $tnrow['niid'] . "' > Read More</a > </p>; }else $radio = mysqli_query("SELECT imageposition FROM newsimage WHERE imageposition EQUALS newsitem.niid=newsimage.niid"); $qresult = mysqli_query($con, $radio); while (($tnrow = mysqli_fetch_array($qresult)); { if ($radio == 'Centre') { echo "<p class='newsmore'> <a href='newsitem3.php?i=" . $tnrow['niid'] . "'>Read More</a></p>"; }else if ($radio == 'Right') { echo "<p class='newsmore'> <a href='newsitem2.php?i=" . $tnrow['niid'] . "'>Read More</a></p>"; }else if ($radio == 'Left') { echo "<p class='newsmore'> <a href='newsitem.php?i=" . $tnrow['niid'] . "'>Read More</a></p>"; } } echo "<div class='newspic'><img src='http://www.nortech.org.uk/news/" . $tnrow['newsimage'] . "' alt='" . $tnrow['newstitle'] . "' /></div>"; } echo " <p><strong>" . $tnrow['newstitle'] . "</strong></p> <p class='news'>" . $tnrow['newssnippet'] . "</p> </div> <div class='padder1'></div> <div class='rtgreengp'></div> "; } } mysqli_close($con); } My problem is that whenever I load the page it just produces a blank page. When I look at the source code on the web all that is displayed is "<!doctype html>" However, when I remove the second query from the file and re-upload it, it all works fine, so from what I can gather there is a problem some where in this bit of code: }else $radio = mysqli_query("SELECT imageposition FROM newsimage WHERE imageposition EQUALS newsitem.niid=newsimage.niid"); $qresult = mysqli_query($con, $radio); while (($tnrow = mysqli_fetch_array($qresult)); { if ($radio == 'Centre') { echo "<p class='newsmore'> <a href='newsitem3.php?i=" . $tnrow['niid'] . "'>Read More</a></p>"; }else if ($radio == 'Right') { echo "<p class='newsmore'> <a href='newsitem2.php?i=" . $tnrow['niid'] . "'>Read More</a></p>"; }else if ($radio == 'Left') { echo "<p class='newsmore'> <a href='newsitem.php?i=" . $tnrow['niid'] . "'>Read More</a></p>"; } } echo "<div class='newspic'><img src='http://www.nortech.org.uk/news/" . $tnrow['newsimage'] . "' alt='" . $tnrow['newstitle'] . "' /></div>"; } echo " <p><strong>" . $tnrow['newstitle'] . "</strong></p> <p class='news'>" . $tnrow['newssnippet'] . "</p> </div> <div class='padder1'></div> <div class='rtgreengp'></div> "; } } mysqli_close($con); } I just can't see why it isn't working.... Whenever I run the debugger I am only receiving this error message "Parse error: syntax error, unexpected '<' in C:\pathway\filename.php on line 32" which isn't really useful because when I look at line 32 there are no added '<' Advice would be much appreciated before I start tearing my hair out lol!
-
I'm trying to query sql to post all new users on my site to the index page. This string: $sql = "SELECT COUNT(id) FROM users WHERE activated='1'"; keeps returning this error: Parse error: syntax error, unexpected T_LNUMBER in /home/******/********/index.php on line 14 I have tried canceling out as suggested on php.net using: $sql = SELECT COUNT(id) FROM users WHERE activated=\'1'; and receive: Parse error: syntax error, unexpected $end in /home/******/********/index.php on line 35 because now it's incomplete. What's the issue? All suggestions I have found online are not working.
-
Hi there. I am new at php and postegresql, I have installed postegreSQL 9.3 and wampserver 2.3. I have already enable the postgreSQL extensions. I am trying to acess a database with the name db where is already created a 3 collumn table (text,text,double). I want to insert a value into it using a php code. The php code that i have is this: $dbconn = pg_connect("host=localhost port=5432 dbname=postgres user=postgres password=passss") or die('It was not possible to connect: ' . pg_last_error()); echo 'Connected: ', pg_dbname($dbconn); $query = "INSERT INTO bd( dia, hora, voltagem) VALUES ('18-9-2013', '17:32:37', 302);"; $linha=pg_query($dbconn,$query); pg_close($dbconn); When opening the file in the browser i get: Connected: postgres ( ! ) Warning: pg_query(): Query failed: ERROR: relation "bd" does not exist LINE 1: INSERT INTO bd( ^ in C:\wamp\www\connectDB.php on line 12 Call Stack # Time Memory Function Location 1 0.0005 246472 {main}( ) ..\connectDB.php:0 2 0.0354 247848 pg_query ( ) ..\connectDB.php:12 What am i doing wrong? i dont get it. Does anyone can give me a little help? Thanks in advance
- 1 reply
-
- postgresql
- php
-
(and 2 more)
Tagged with:
-
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.