PHP - Echo P Class And Css Problem
Hi im having trouble getting the below code to listen to my css margin settings.
Just to clear up the server side of things, can anybody tell me wether or not im using the correct syntax in the code below? Code: [Select] else { echo("<p class=\"passed\">Thankyou for submiting your details, you will be added to our directory shortly</p>"); }} Similar TutorialsCan you echo class constants? This does not work for me. echo “here is a class constant: self::CLASS_CONSTANT”; // using double quotesInstead I *must* concatenate it: echo ‘here is a class constant: ‘ . self::CLASS_CONSTANT;But of course I do not have to do this with a normal variable, which will echo a variable fine: echo “my name is $name_variable”;Am I doing something wrong or is this normal behavior? Edited by E_Leeder, 30 October 2014 - 11:04 AM. Hi there i just need to assign a class to my echoed vairable. Code: [Select] echo $test class="somecssclass"; Im sure im missing some braces here or something but i cant seem to find it out. Heres the error: Parse error: syntax error, unexpected T_CLASS, expecting ',' or ';' Please help Thanks This probably doesn't matter much, but I am using a 'Display' class for final output to the browser. The class will display the obvious HTML header and then display either the full site or the mobile site. It also displays the CSS / JS (which is previously selected in the page-specific controller code as there are variations based on server-side checks). Basically it is the ONLY class that actually needs to send anything to the browser. When I begin output and echo inside the class, that is the end of the script - there is no more server-side code to execute. If I shouldn;t echo inside the class, is it that bad to do so? Hello, I have this syntax on my header div Code: [Select] <p><a href="javascript:ajaxpage('shopcart.php', 'content');" class="difflink"><img src="../stock_photos/shopcart.png"><?php echo '<span class="text">'.writeShoppingCart().'</span>'; ?></a></p> but whatever I try it always output my echo in the next line instead of next to my picture file. How can I do it displayed at the same line? Thank you Hi all, I have this problem with an echo I have this code, what is working only not all of it, it request a database (ID) TID which is a catorgy. Now I need to TID to be in a place but can't to seem to get it. Here is the code: Code: [Select] <?php defined('_JEXEC') or die('Restricted access'); // no direct access ?> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"> </script> <script type="text/javascript"> /* function changeActiveCategory(id,show) { var a_categoryname = "a_category"+id; if(show){ document.getElementById(a_categoryname).className = "active"+id; }else{ document.getElementById(a_categoryname).className = ""; } } */ function changeActiveType(id,show) { var a_typename = "a_type"+id; if(show){ document.getElementById(a_typename).className = "active"+id; }else{ document.getElementById(a_typename).className = ""; } } var markerGroups = { "1": [], "2": [], "3": [], "4": [], "5": []}; function toggleGroup(type) { for (var i = 0; i < markerGroups[type].length; i++) { var marker = markerGroups[type][i]; if (marker.getVisible()) { marker.setVisible(false); changeActiveType(type,false); } else { marker.setVisible(true); changeActiveType(type,true); } } } function changeActiveButton(id) { document.getElementById("idmap").className = "map"; document.getElementById("idsatellite").className = "satellite"; document.getElementById("idterrain").className = "terrain"; var dividname = "id"+id; document.getElementById(dividname).className = id+" "+id+"active"; } var map; var goHome = new google.maps.LatLng(<?php echo $DefaultLat;?>, <?php echo $DefaultLng;?>); function HomeControl(controlDiv, map) { controlDiv.style.padding = '0px 5px'; var controlUI = document.createElement('DIV'); controlUI.style.cursor = 'pointer'; controlUI.setAttribute("class","mapType"); controlDiv.appendChild(controlUI); var controlMap = document.createElement('DIV'); if(map.getMapTypeId()=='roadmap'){ controlMap.setAttribute("class","map mapactive"); }else{ controlMap.setAttribute("class","map"); } controlMap.setAttribute("id","idmap"); controlUI.appendChild(controlMap); var controlsatellite = document.createElement('DIV'); if(map.getMapTypeId()=='satellite'){ controlsatellite.setAttribute("class","satellite satelliteactive"); }else{ controlsatellite.setAttribute("class","satellite"); } controlsatellite.setAttribute("id","idsatellite"); controlUI.appendChild(controlsatellite); var controlterrain = document.createElement('DIV'); if(map.getMapTypeId()=='hybrid'){ controlterrain.setAttribute("class","terrain terrainactive"); }else{ controlterrain.setAttribute("class","terrain"); } controlterrain.setAttribute("id","idterrain"); controlUI.appendChild(controlterrain); google.maps.event.addDomListener(controlUI, 'click', function() { /*map.setCenter(goHome);*/ }); google.maps.event.addDomListener(controlMap, 'click', function() { map.setMapTypeId(google.maps.MapTypeId.ROADMAP); changeActiveButton('map'); }); google.maps.event.addDomListener(controlsatellite, 'click', function() { map.setMapTypeId(google.maps.MapTypeId.SATELLITE); changeActiveButton('satellite'); }); google.maps.event.addDomListener(controlterrain, 'click', function() { map.setMapTypeId(google.maps.MapTypeId.HYBRID); changeActiveButton('terrain'); /*map.setMapTypeId(google.maps.MapTypeId.TERRAIN);*/ }); } function initialize() { var latlng = new google.maps.LatLng(<?php echo $DefaultLat;?>, <?php echo $DefaultLng;?>); var myOptions = { zoom: <?php echo $MapDistance;?>, center: latlng, navigationControl:true, scaleControl:true, mapTypeControl: false, mapTypeId: google.maps.MapTypeId.HYBRID }; var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); var homeControlDiv = document.createElement('DIV'); var homeControl = new HomeControl(homeControlDiv, map); homeControlDiv.index = 1; map.controls[google.maps.ControlPosition.RIGHT].push(homeControlDiv); var gmarkers = []; var htmls = []; <?php echo 'var ptooltip=new Array();'; echo 'var showhtml=new Array();'; if($items) { $p=0; foreach ($items as $item) { $link = LinkHelper::getLink('properties','showproperty','',$item->CYslug,$item->Sslug,$item->Lslug,$item->Tslug,$item->Pslug); $item->name=str_replace("'","\'",$item->name); echo "\n"."ptooltip[".$p."]=new Array( '".$item->id."','".$item->ref."','".$item->tid."','".$item->name."','".$link."');"."\n"; /*property details*/ if($item->imagename!=NULL){ $img=$item->imagename;}else{$img='noimage.jpg';} $myHtml=''; $myHtml.='<div id="propertydetail"><div class="title"><a href="'. $link.'" title="'.str_replace('"',' ',$item->name).'">'.$item->name.'</a></div><div class="image"><img src="images/properties/images/thumbs/'.$item->id.'/'.$img.'" alt="'.str_replace('"',' ',$item->name).'" width="100" height="75"></div><div class="text">'; if ($item->name_type) { $myHtml.=JText::_($item->name_type).'<br />'; } if ($item->address) { $myHtml.=JText::_($item->address).'<br />'; } $myHtml.='</div>'; $myHtml.='<div class="property_button">'; $myHtml.='<a class="BottomlnkDetail" href="'.$link.'" title="'.$item->id.'">Lees meer...</a>'; $myHtml.='</div>'; $myHtml.='</div>'; echo "\n"."showhtml[".$p."]='".$myHtml."';"."\n"; $myHtml=''; /*end property details*/ $p++; } } ?> var base_Icon=new Array(); base_Icon = '<?php echo JURI::base();?>modules/mod_prop_googlemap/img/beer.png'; <?php if($items) { $x=0; foreach ($items as $item) { ?> var myLatlng = new google.maps.LatLng(<?php echo $item->lat;?>,<?php echo $item->lng;?>); var marker = new google.maps.Marker({ position: myLatlng, map: map, icon: base_Icon }); /*alert (marker.number);*/ marker.setTitle('Klik voor meer info.'); attachSecretMessage(marker, <?php echo $x;?>); markerGroups[HIER MOET TID KOMEN].push(marker); <?php $x++; } } ?> function attachSecretMessage(marker, number) { var infowindow = new google.maps.InfoWindow( { content: showhtml[number], /* disableAutoPan: true,*/ size: new google.maps.Size(50,50) }); google.maps.event.addListener(marker, 'click', function() { infowindow.open(map,marker); /*showInContentWindow(showhtml[number]);*/ }); google.maps.event.addListener(infowindow, 'closeclick', function() { /*infowindow.close(map,marker); showInContentWindow(''); closeInContentWindow();*/ }); /* google.maps.event.addDomListener(controlterrain, 'click', function() { map.setMapTypeId(google.maps.MapTypeId.HYBRID); changeActiveButton('terrain'); }); */ } function showInContentWindow(text) { var sidediv = document.getElementById('content_window'); sidediv.style.visibility = "visible"; sidediv.innerHTML = text; } function closeInContentWindow() { var sidediv = document.getElementById('content_window'); sidediv.style.visibility = "hidden"; } } </script> <div class="prop_googlemap" style="width:960px; height:510px"> <div class="first"> <div class="second"> <div class="third"> <div id="map_canvas" style="width: 950px; height: 500px"></div> <div id="prop_googlemap_categories_all"> <div id="prop_googlemap_categories"> <ul class="categorys"> <li><a id="a_type1" class="active1" href="javascript:void(0)" onclick="toggleGroup('1');">Kroeg</a></li> <li><a id="a_type2" class="active2" href="javascript:void(0)" onclick="toggleGroup('2');">Discotheek</a></li> <li><a id="a_type3" class="active3" href="javascript:void(0)" onclick="toggleGroup('3');">Zaal</a></li> <li><a id="a_type4" class="active4" href="javascript:void(0)" onclick="toggleGroup('4');">test</a></li> </ul> </div> <div style="clear:both"></div> <div class="prop_googlemap_categories_bottom"></div> </div> <div id="content_window"></div> <div id="side_bar"></div> </div> </div> </div> </div> <script type="text/javascript"> initialize(); </script> <div style="clear:both"></div> As you can see he Code: [Select] markerGroups[THIS IS WHERE THE TID SHOULD COME].push(marker);where now it says: "THIS IS WHERE THE TID SHOULD COME" there needs to be a number ( 1 stands for a bar, 2 stands for a disco, 3 for something else. Now this is where I ask for the TID: Code: [Select] echo "\n"."ptooltip[".$p."]=new Array( '".$item->id."','".$item->ref."','".$item->tid."','".$item->name."','".$link."');"."\n"; But it can be me, but can't seem to get it working.... Can't seem to get the right code for "THIS IS WHERE THE TID SHOULD COME" anyone that could help me? Thanks! I cannot retrieve my records from my table, neither can I display them on my website. I do not even get any errors when I run the script on my site. Any help or tips would be greatly appreciated. My current php script is: // connection to database server $db_selected = mysql_select_db('database1', $dbc); if (!$db_selected) { die ('Can\'t use database1 : ' . mysql_error()); } $query = "SELECT * FROM chesstable ORDER BY chapter, lastname"; $result = mysql_query($query) or die('Could not connect' . mysql_error()); echo mysql_num_rows($result); If (!$result) { $message = 'Invalid query: ' . mysql_error(); $message = 'Whole query: ' . $query; die ($message); } while($row = mysql_fetch_assoc($result)) { echo $row['firstname'] . " " . $row['lastname'] . $row['chapter']; } mysql_free_result($result); mysql_close($dbc); ?> This php file cant echo in the 2nd php code, can anyone help me about this? 1st php code to connect into the 2nd php code Code: [Select] <?php $Total = $Total + $Amount; } ?> </tr> <tr> <td colspan="3" align="Right">Total</td> <td align ="Center"><?php echo number_format($Total,2);?></td> </tr> 2nd php code Code: [Select] <?php $db = mysql_connect("localhost", "root", ""); mysql_select_db("vinnex",$db); $TransNo = $_POST['TransNo']; $Username = $_POST['Username']; $Date = $_POST['Date']; $Total = $_GET['Total']; echo $Total; $sqltransaction = " INSERT INTO transaction (TransNo, Username, Date, Total) VALUES ('$TransNo', '$Username', '$Date', '$Total')"; $resulttransaction = mysql_query($sqltransaction); ?> Having problems with my script echo without form being completed yet. Any help would be appreciated. The echo that is outputting early is "You must enter a Session Name". Code: [Select] <html> <head> <title>ReH-0.1--Create a Session</title> </head> <body bgcolor="575757"> <center> <?php $error = "Could not connect to the database"; mysql_connect('localhost','root','') or die ($error); mysql_select_db('temp') or die ($error); //Set Variables $id = $_POST['id']; $table = $POST['table']; //Check for exsistence if (!$id or !$table) { echo "<font color='#ff0000'>You must enter a Session Name</font>"; } else { echo "Congrats!"; } ?> <h2 style="color:#fff">ReH-0.1 Password Encryption</h2><br><br> <font color="#fff">Before encrypting your password, a session must be started. We need you to enter a personal session name that you will remember so that you password is protected by this session.</font><br><br> <form action="session_start.php" method="POST"> <label for="id" style="color: #fff;">Session Name: <input type="text" maxlength="10" size="10" name="id"></label><br><br> <label for="table" style="color: #fff;">Session Name Confirmation: <input type="text" maxlength="10" size="10" name="table"></label><br><br> <input type="submit" value="Create Session"> </form> </center> </body> </html> Hi, Im pretty new to php but im have trouble understanding why my script is doing this. Forgive me for silly mistakes! Im creating a login/register website and once the person has logged in they get a message saying "Successful login, welcome username!" The php checks against a database of users in an if statement to check if the password is correct and then prints out the message. But at the end of the message the echo is printing out a 1. I get that because the echo is in an if statement its return true or 1 but I cant get it to not print out the 1. code snippet is - if ($username==$dbusername&&$password==$dbpassword) { echo "Successful login, welcome!"; } Hope that makes sense. Thanks for the help. Neil ok im building facebook app and im just back to php after months not touched it. this is the code: $image = $facebook->api_client->photos_get(null,null, echo $uid); print_r ($image); echo "<BR>"; echo $image[0]["src"]; the problem is that echo $uid i tried every variation and it does not work! i maybe forget something that i should have done? the $uid containing user id numbers so what i did wrong and if im not wrong i wanted the numbers($uid) Wrapped in quotation marks so i tried: echo ." $uid ". and alot of other please help tnx Hi Guys, I keep getting the following error: Parse error: syntax error, unexpected T_ECHO in /Applications/XAMPP/xamppfiles/htdocs/pet/petCatalog1.php on line 51 I have copied the code from a tutorial and cannot for the life of me work out what the problem is with line 51???? I have attached the file and pasted the code below. The real problem line is: echo "<tr><td valign='top' width='15%' style='font-weight: bold; font-size: 1.2em'\n" The full code is attached - btw, inserting the ">" does not help to fix it!! <?php /* Programme: PetCatalog.php * Desc: Lists all pet categories with radio buttons */ ?> <html> <head> <title>Select a Pet Category</title> </head> <body> <?php /* Database login info - Move to an Include */ $host="localhost"; $user="root"; $passwd=""; $dbname="information_schema"; /* Establishes a connection with the databse */ $cxn = mysqli_connect ($host, $user, $passwd, $dbname) or die ("Could not connect to the database JAMIE!"); /* SQL Query to select all categories of pet from the petType column in the pet table */ $query = "SELECT * FROM PetCatalog.petType ORDER BY petType"; $result = mysqli_query($cxn,$query) or die ("Unable to connect to the database JAMIE"); /* Echo of H1 & H2 above the pet table */ echo "<div style='margin-left: .lin'>\n <h1 style='text-align: center'>Pet Catalogue</h1>\n <h2 style='text-align: center'>The following categories of pets are now available</h2>\n"; /* Create form to diplay pet categories */ echo "<form action='ShowPets.php' method='POST'>\n"; echo "<table cellpadding='5' border='1'>"; $counter=1; while ($row = mysqli_fetch_assoc($result)) { extract ($row) echo "<tr><td valign='top' width='15%' style='font-weight: bold; font-size: 1.2em'\n" echo "<input type='radio' name='interest' value='$petType'\n"; if( $counter == 1 ) { echo "checked='checked'"; } echo ">$petType</td>"; echo "<td>$typeDescription</td></tr>"; $counter++; } echo "</table>"; echo "<p>input type='submit' value='Select Pet Type'> </form></p>\n"; ?> </body> </html> OK, have no idea what's going on... I've done this a million times... why wont this output!?? I must have a major brain meltdown and dont know it yet!!! Code: [Select] <?php // this echoes just fine: echo $_POST['testfield']; // but this wont echo: echo if (isset($_POST['testfield'])) { $_POST['testfield'] = $test; } echo $test; /// or even this DOESNT echo either!: $_POST['testfield'] = $test; echo $test; ?> the line : echo $form['catcher_id'] gives me a dropdown list when i choose another item from the dropdown i want to do a few things but my code not working: $selected_catcher = $form['catcher_id']; foreach($selected_catcher as $val) { $catcher_name = $val->getName(); echo $catcher_name." ".$val->getId(); if ($catcher_name = "zed-catcher") { echo $form['service_code']->renderLabel(); echo $form['service_code']->renderError(); echo $form['service_code']; } } please help? thanks Hi, this php code not working for some reason Code: [Select] class db { public function connect() { $yhteys = new PDO("mysql:host=*****;dbname=*****", "*******", "******"); } public function get($query, $parameters){ $prepare = $yhteys->prepare($query); $prepare->execute($parameters); $result = $prepare->fetch(); $count = $prepare->rowCount(); return array($result, $count); } } Code: [Select] $db = new db(); $content = $db->get("SELECT * FROM tuotteet WHERE id = ?", array("1")); print $content; It gives error:Parse error: syntax error, unexpected T_OBJECT_OPERATOR Thank you for help! class Z { function foo() { // do somethig } } class X { $x function __contruct() { $this->x = new z(); } function var() { $this->x->foo(); // Fatal error: Using $this when not in object contex } } // Class declaration here class Y { function __contruct() { $z = new z(); $x = new x(); } } Hey guys! I have spent the last 5 and a half hours banging my head up against the wall trying to fix this to no avail so I guess its time to ask the experts!!! I am having a problem with my membership class. Basically, it works perfectly if a user logs in using sessions and not cookies. But when remember is set to 1 (they ticked the remember me checkbox), the mysql query fails on this line when we run $member_class->member_class(); Code: [Select] $result = mysql_fetch_array(mysql_query("SELECT * FROM members WHERE email = '{$email}' AND token ='{$token}' AND ip_address LIKE '{$ip_address}%'"), MYSQL_ASSOC) or DIE ($this->query_error); Everything matches up except for the $token value. Basicly I believe that a new token is updated in the mysql database, before the token value in the cookie is updated as when I print $token, it definitly matches up with the token value in the mysql database. But from reading through the code, it all looks perfectly fine to me which is why i am so confused. If i change $newtoken = $this->token(); // generate a new token to $newtoken = '1234'; the script also works perfectly fine without errors (though not very secure so would like the token to change values! Really appreciate any input! Cheers <?php // member class // handlers member logon class member_class { var $message = ''; var $query_error = 'ERROR: something went wrong when accessing the database. Please consult your webmaster'; function member_class() { //constructor if (!$_SESSION['member_id']) { //fills session with empty values $this->set_session_defaults();; } if ($_SESSION['logged_in']) { //already logged in $this->check_session(); } if ($_COOKIE['remember']) { $this->check_remembered($_COOKIE['remember']); } } function check_login($email,$password,$remember,$redirect) { $email = mysql_escape_string($email); $salt='s+(_v'; $password = mysql_escape_string(hash('sha512', $salt . $password)); $result=mysql_fetch_array(mysql_query("SELECT * FROM members WHERE email = '{$email}' AND password = '{$password}'"), MYSQL_ASSOC); if ($result) { $this->set_session($result,$remember,true); return true; } else { $this->failed = true; $this->logout(); //create error message telling user that either the email address does not exist, or they have entered the wrong password associated with the email address $result=mysql_fetch_array(mysql_query("SELECT email FROM members WHERE email = '{$email}'")); if($result) { $this->message .= 'Incorrect Password. Please try again'; } else { $this->message .= 'The email address '.$email.' does not exist. Please try again or <a href="/register.php" class=" cboxElement">create a new account</a>.'; } return false; } } function logout() { // blowup cookie setcookie('remember',time()-3600); $this->set_session_defaults(); } function set_session($result,$remember,$init = true) { $member_id=$result['member_id']; if ($init) { $session = mysql_escape_string(session_id()); $ip_address = mysql_escape_string($_SERVER['REMOTE_ADDR']); $newtoken = $this->token(); // generate a new token // generate a random token $update = mysql_query("UPDATE members SET session='{$session}', token='{$newtoken}', ip_address='{$ip_address}' WHERE member_id='{$member_id}'") or DIE ($this->query_error); } $_SESSION['member_id'] = $result['member_id']; $_SESSION['email'] = htmlspecialchars($result['email']); $_SESSION['fullname'] = $result['fullname']; $_SESSION['token'] = $newtoken; $_SESSION['logged_in'] = true; if ($remember) { $this->update_cookie($newtoken); } } function update_cookie($token) { $cookie = serialize(array($_SESSION['email'],$token)); //print $token; setcookie('remember',$cookie, time()+12099600); } function check_remembered($cookie) { $serializedArray=$cookie; $serializedArray = stripslashes($serializedArray); list($email,$token) = unserialize($serializedArray); if(empty($email) or empty($token)) { return; } else { $email = mysql_escape_string($email); $token = mysql_escape_string($token); $ip_address = mysql_escape_string($_SERVER['REMOTE_ADDR']); //changed from = '{ip_address} to like '{ipaddress}% so we are not strict in ip address we only limit to first 3 charactors of ip $ip_address = substr($ip_address, 0, 3); $query = "SELECT * FROM members WHERE email = '{$email}' AND token ='{$token}' AND ip_address LIKE '{$ip_address}%'"; print $query; $result = mysql_fetch_array(mysql_query("SELECT * FROM members WHERE email = '{$email}' AND token ='{$token}' AND ip_address LIKE '{$ip_address}%'"), MYSQL_ASSOC) or DIE ($this->query_error); if (!$result) { // $this->set_session($result,false,false); }else{ $this->set_session($result,true,true); } } } function token() { // generate a random token for($i=1;$i<33;$i++) { $seed .= chr(rand(0,255)); } return md5($seed); } function check_session() { $email = mysql_escape_string($_SESSION['email']); $token = mysql_escape_string($_SESSION['token']); $session = mysql_escape_string(session_id()); //if ip address changes it will fail POSSIBLY DO NOT NEED THIS! $ip_address = mysql_escape_string($_SERVER['REMOTE_ADDR']); //check only the first 4 charactors of ip address incase user changes ip in corporate workplace etc ALSO CHANGED = TO LIKE IN MYSQL QUERY AND ADDEED % TO THE END AS WILDCARD $ip_address = substr($ip_address, 0, 3); $result = mysql_fetch_array(mysql_query("SELECT * FROM members WHERE email='{$email}' AND token='{$token}' AND session='{$session}' AND ip_address LIKE '{$ip_address}%'"), MYSQL_ASSOC or DIE ($this->query_error)); if ($result != false){ }else{ $this->logout(); } } }?> So... I have the following code for my rss_reader class: <?php class rss_reader { const USE_CURL = TRUE; private $_userAgent = ''; private $_url = ''; public function __construct($url, $userAgent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1') { $this->_url = $url; $this->_userAgent = $userAgent; } public function writePOST() { $postval= $this->getPOST(); echo $postval; } public function getPOST($format = '<b>%s</b>%s<i>%s</i>') { $xml = $this->getXML(); $script1 = $xml->channel->item->title; $script2 = $xml->channel->item->description; $script3 = $xml->channel->item->pubDate; return sprintf($format, $script1, $script2, $script3); } private function getXML() { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $this->_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_USERAGENT, $this->_userAgent); curl_setopt($ch, CURLOPT_TIMEOUT ,3); $data = curl_exec($ch); curl_close($ch); return new SimpleXMLElement($data); } } Basically, atm it writes the newest post found at the RSS feed. What I wan't to do is extend this to create an array of all of the posts that I can iterate over to "write" ALL of the posts. I will then later work on a method for pagination. Atm though, I am kinda lost and don't really know where to start. Anyone know how I could accomplish this? thanks much. ps: everything else with the rss reader works as intended. Hey guys im just starting to use Prepared Statements in php and i am trying to build a search but i have come across a problem. Hope someone can help or point me to more information on how to resolves this. Ok here is the code below:: public function search($string) { if(strlen($string) > 40) { return "Woow too many words, please shorten your search."; } if(empty($string)) { return "I'm a search, you type things in and I find. Please enter something and try again!"; } if(strlen($string) <= 3) { return "Come on dude, you expect me to find summin with that? Type some more tags in!"; } $x=0; // Teh string could be multiple searches so explode:: $string = explode(" ", $string); foreach($string as $search) { $x++; if($x == 1) { @$sql .= "(blog_tags LIKE '%$search%')"; } else { @$sql .= " OR (blog_tags LIKE '%$search%')"; } } $sql = "SELECT blog_tags FROM subarc_blog WHERE $sql LIMIT 40"; // TODO:: Count how many search results found:: $stmt = $this->conn->prepare($sql); $stmt->execute(); $stmt->bind_result($search); Ok by using the bind_result() i need to know how many result are being returned to add them to a variable is this correct ? if so how can i tell how many results have been returned ? hope this makes sense I have the code as given below: <?php class ABC { function printValue() { print("This value shall be printed" . $this->x); } } class BCD extends ABC { private $x=10; } $bcd=new BCD; $bcd->printValue(); ?> But when I try to access printValue function from the paren class it gives me error... Fatal error: Cannot access private property BCD::$x in /var/www/html/trainingweb/modules/test/TestAtitProblem.php on line 5 As the public method of ABC would be extended to BCD, it shall have access to its own member. please help... |