PHP - Migrating To Mysqli - Not Fetching Data
Hi,
I am trying to migrate my project from mysql to mysqli but with little knowledge of the later. Among the noticeable errors is that the code is no longer fetching data from the database, and I am also getting UNDEFINED VARIABLE errors on the in the mysqli statement that should be binding results to variables. Here is the code if you can help: //set connection variables $host = "localhost"; $username = "root"; $password = "password"; $db_name = "mydb"; //database name //connect to mysql server $mysqli = new mysqli($host, $username, $password, $db_name); //check if any connection error was encountered if(mysqli_connect_errno()) { echo "Error: Could not connect to database."; exit; } //Just counting ...required for pagination... $query = "SELECT COUNT(*) FROM t_persons"; $result = mysqli_query($mysqli,$query) or die(mysqli_connect_errno()); $num_rows = mysqli_fetch_row($result); $pages = new Paginator; $pages->items_total = $num_rows[0]; $pages->mid_range = 9; // Number of pages to display. Must be odd and > 3 $pages->paginate(); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } if ($stmt = $mysqli->prepare("SELECT p.PersonID, p.ImagePath, p.FamilyName, p.FirstName, p.OtherNames, p.Gender, p.CountryID, p.StatusID, i.IncidentDate, i.IncidentCountryID, i.AgencyID, i.KeywordID FROM t_incidents i INNER JOIN t_incident_persons ip ON ip.IncidentID = i.IncidentID INNER JOIN t_persons p ON ip.PersonID = p.PersonID WHERE p.PersonID>0" . $likes . " ORDER BY p.PersonID DESC $pages->limit")) { /* Execute the prepared Statement */ $stmt->execute(); /* Bind results to variables */ $stmt->bind_result($PersonID,$ImagePath,$FamilyName,$FirstName,$OtherNames,$Gender,$CountryID,$StatusID,$IncidentDate,$IncidentCountryID,$AgencyID,$KeywordID); /* fetch values */ while ($rows = $stmt->fetch()) { // display records in a table // $PersonID=$row[0]; ?> <div class="thumbnail"> <a href=details.php?PersonID=<?php echo $PersonID ?> target=gallery><img src="./Persons_Images/<?php echo $row[1]; ?>" width="100" height="130" alt="" /></a><br> <a href="details.php?PersonID=<?php echo $PersonID; ?>"> <?php echo $row[2]; ?> <?php echo $row[3]; ?></a> </div> <?php }?> <?php } /* Close the statement */ $stmt->close(); /* close our connection */ $mysqli->close(); ?>I will appreciate. Joseph Similar TutorialsHi guys, I am using a search form that's supposed to pull data out of database and display them. I managed to to do that using the following: while($rows = mysql_fetch_assoc($result)) { echo "-Title: " . $rows['title'] . "<br/>" . "-Author: " . $rows['author'] . "<br />"; Displays something like this: -Title: Young One -Author: Edwards Bonnie. ---------------------------------- I have links related to each book in a folder and I want to make the title clickable and each title should take me to the corresponding book page. I know that I have to do something like <a href=\"...........\">$rows['title']</a>", but as far as I know all titles will take me to one page using that! please help and thank you. Can you add a WHERE clause in $row? For example: $row['city_display'] WHERE city_display = 1 $row['city_display'] WHERE city_display = 2 etc... How can this be done? Hi, My name is stefan and I've been trying to develop a php/mysql based CRM for private use. I've stumbled upon a problem a few days ago and I just can't figure it out, so if you could help me, I'd really appreciate it. The problem is the following: I have 1 database which contains 5 tables. Each table has info in it but the primary key always is 'ID' 4 Tables are named; Zendingen | Klanten | Manden | Bestemmeling The last table, named 'Combination' has the unique ID of each of those 4 in it. The example will be given below. What I want to do now is create a page that shows all stored rows in 'Combination'-table, but gets the proper client_name or product_info out of the corresponding table. I have searched for it myself but I have no clue where to begin and how to define my searches so they all stranded. This is the piece of code. Code: (php) [Select] $Shipm1 = mysql_query("SELECT * FROM Shipments where Zending_ID = 9") or die(mysql_error()); while($row = mysql_fetch_assoc($Shipm1)) { echo "<br />"; echo $row["ID"]; echo "<br />"; echo $row["Zending_ID"]; echo "<br />"; echo $row["Klant_ID"]; echo "<br />"; echo $row["Mand_ID"]; echo "<br />"; echo $row["Bestemmeling_ID"]; echo "<br />"; }This code returns: Quote 3 ---- the ID of the 'combination' table and thus primary key 9 ---- Zending_ID 47 --- Klant_ID 17 --- Mand_ID 2 ---- Bestemmeling_ID 4 This is another row from the combinations table, 9 notice that it only returns the Zending_ID = 9. 49 21 4 Now this gives me the info I want, but it doesn't displays them how I need it to. I want it to search up each ID in the proper table and return me the product name, client name etc... Anyone who can help or point me in the right direction? Kind regards Stefan Hello everyone, I am trying to submit a comment in a comment box and send it to the DB but is not happening. The connection is good as I am logging in and all but no data is sent to the DB when I post the comment. It doesn't show in my comment section either.
Form <!--comment section--> <?php if(isset($_SESSION['id'])) { echo "<form method='POST' action='" . setComments($conn) . "'> <input type='hidden' name='uidUsers' value='".$_SESSION['id']."'> <input type='hidden' name='posted' value='" . date('Y-m-d H:i:s') . "'> Comments: <textarea rows = '5' cols = '15' name='body'></textarea><br><br> <button name='commentSubmit' type='submit'>Comment</button> </form>"; }else { echo "Log in to comment!"; } getComments($conn);
Function to set and get comments function setComments($conn) { if (isset($_POST['commentSubmit'])){ $user_id = $_POST['uidUsers']; $body = $_POST['body']; $posted = $_POST['posted']; $sql = "INSERT INTO comments (uidUsers, posted, body) VALUES ('$user_id', '$posted', '$body')"; $result = mysqli_query($conn, $sql); } } function getComments($conn) { $sql = "SELECT * FROM comments"; $result = mysqli_query($conn, $sql); while ($row = $result->fetch_assoc()){ $id = $row['uidUsers']; $sql2 ="SELECT * FROM users WHERE uidUsers='$id'"; $result2 = mysqli_query($conn, $sql2); if($row2 = $result2->fetch_assoc()){ echo "<div class='comment-box'><p>"; echo $row2['uidUsers'] . "<br>"; echo $row['posted'] . "<br>"; echo nl2br($row['body']); echo "</p></div>"; } } }
how i can make a insert using this fuctions I m learning php, as using this functions (mysqli abstract) but after update wont work any more.
/** insert data array */ public function insert(array $arr) { if ($arr) { $q = $this->make_insert_query($arr); $return = $this->modifying_query($q); $this->autoreset(); return $return; } else { $this->autoreset(); return false; } }complement /** insert query constructor */ protected function make_insert_query($data) { $this->get_table_info(); $this->set_field_types(); if (!is_array(reset($data))) { $data = array($data); } $keys = array(); $values = array(); $keys_set = false; foreach ($data as $data_key => $data_item) { $values[$data_key] = array(); $fdata = $this->parse_field_names($data); foreach ($fdata as $key => $val) { if (!$keys_set) { if (isset($this->field_type[$key])) { $keys[] = '`' . $val['table'] . '`.`' . $val['field'] . '`'; } else { $keys[] = '`' . $val['field'] . '`'; } } $values[$data_key][] = $this->escape($val['value'], $this->is_noquotes($key), $this->field_type($key), $this->is_null($key), $this->is_bit($key)); } $keys_set = true; $values[$data_key] = '(' . implode(',', $values[$data_key]) . ')'; } $ignore = $this->ignore ? ' IGNORE' : ''; $delayed = $this->delayed ? ' DELAYED' : ''; $query = 'INSERT' . $ignore . $delayed . ' INTO `' . $this->table . '` (' . implode(',', $keys) . ') VALUES ' . implode(',', $values); return $query; }before update this class i used to insert data like this $db = Sdba::table('users'); $data = array('name'=>'adam'); $db->insert($data);this method of insert dont works on new class. if i try like this i got empty columns and empty values. thanks for any help complete class download http://goo.gl/GK3s4E Hi all, please be nice my php is poor! I operate a website which uses the JS menue from Milonic, As part of the package from Milonic there is a function to output the menu as a site map this uses some clever php jiggery pokery.... I have recently changed hosts to a new host offering only php v5.3, i have noticed that the sitemap now will not run, to my unknowledgeable eyes it seems to get part way through the code then output the rest as text.... see... www.tugtracker.co.uk/menu/extras/php_sitemap/index.php Code: [Select] html> <body> This file needs to be executed under PHP from a webserver and will take the <br> contents of any Milonic menu data file and output the results as either a <br> NoScript menu or as a Sitemap <? //$menuDataFile[]="http://www.milonic.com/menu_data.php"; // Can execute a WWW File $menuDataFile[]="http://www.tugtracker.co.uk/menu/embedded_main_menu.js"; // Or can execute a local file //$menuDataFile[]="/main_menu_data.php"; // You can also add more than one file //$menuDataFile[]="/menu_data.php"; // For main and sub menus if you need to $useMenuStyles=false; include("http://www.tugtracker.co.uk/menu/extras/php_sitemap/mm_dataminer.php"); echo "<Pre>".outputAsSiteMap($menuDataFile)."</Pre>"; // Can output as a Sitemap //echo "<PRE>".outputAsNoScript($menuDataFile)."</PRE>"; // Or output as a NoScript Sitemap ?> </body> </html> The dataminer code file is Code: [Select] <? /* Milonic DHTML/PHP Menu Sitemap builder version 2.0 - September 1 2006 mm_dataminer.php */ //$globalValues=Array(); //$menus=Array(); //$styles=Array(); //$filedata=""; $dataRetrieved=0; $_S=Array(); $_M=Array(); $_I=Array(); function extractStyleName($data) { global $filedata; $pos=miner_getInnerStrpos($data, "(", "="); $text=substr($data,$pos[0]+1, $pos[1]-2); $pos=miner_getInnerStrpos($data, "with(", "mm_style("); $filedata=substr($filedata,0,$pos[0]).substr($filedata,$pos[1]+9,strlen($filedata)); return $text; } function extractMenuName($data){ if(substr($data,0,1)=="(")$data=substr($data,1,strlen($data)); $pos=miner_getInnerStrpos($data, "(\"", "\")"); $text=substr($data,$pos[0]+1, $pos[1]-2); $text=ereg_replace("\"", "", $text); return $text; } function getThisFile(){ $getThisFile=$_SERVER['SCRIPT_NAME']; $pos=strrpos($getThisFile,"/"); if($pos)$getThisFile=substr($getThisFile,$pos+1); return $getThisFile; } function getThisFolder(){ $thisfile=getThisFile(); $thisFolder=$_SERVER['SCRIPT_NAME']; if(strlen($thisfile)>0)$thisFolder=ereg_replace($thisfile,"",$thisFolder); return $thisFolder; } function createMenuStyleCSS() { global $styles; $cssoutput="<style>"; $styleproperties=""; foreach ($styles as $key => $value) { foreach ($value as $cssproperty => $cssvalue) { if($cssproperty=="stylename")$stylename=$cssvalue; if($cssproperty=="offcolor")$styleproperties.="color:$cssvalue;"; if($cssproperty=="offbgcolor")$styleproperties.="background-color:$cssvalue;"; if($cssproperty=="fontfamily")$styleproperties.="font-family:$cssvalue;"; if($cssproperty=="fontsize")$styleproperties.="font-size:$cssvalue;"; } $cssoutput.= ".".$stylename."{".$styleproperties."}"; } $cssoutput.="</style>"; echo $cssoutput; } $RitemsArray=Array(); function getRecursiveItemsByMenuname($menuname, $datafile, $level=0, $counter=1){ global $menus,$RitemsArray; $menus=getMenusFromData($datafile); //echo "<HR>".count($menus)."<HR>"; for($a=0;$a<count($menus);$a++){ if($menus[$a]['menuname']==$menuname){ for($b=0;$b<count($menus[$a]['items']);$b++){ $RitemsArray[]['level']=$level; $RitemsArray[count($RitemsArray)-1]['data']=$menus[$a]['items'][$b]; $RitemsArray[count($RitemsArray)-1]['data']['menu']=$a; if(isset($menus[$a]['items'][$b]['showmenu'])&& $menus[$a]['items'][$b]['showmenu']) { getRecursiveItemsByMenuname($menus[$a]['items'][$b]['showmenu'],$datafile,$level+1, $counter,$datafile); } } } } return $RitemsArray; } function getFormatedMenuDataFromFile($menufile){ global $globalValues, $styles, $menus, $filedata; $menus=Array(); if(!$menufile)$menufile="menu_data.js"; if (ereg("://", $menufile)){ $handle = fopen($menufile, "rb"); $contents = ''; if($handle){ while (!feof($handle)){ $contents .= fread($handle, 8192); } } fclose($handle); $filedata=$contents; } else{ $menufile=$_SERVER['DOCUMENT_ROOT'].$menufile; $contents = ''; if ($handle=fopen($menufile, "rb")){ while(!feof($file)){ $contents .= fread($handle, 8192); } } fclose($handle); $filedata=$contents; } if(strlen($filedata)>1) { $filedata=stripslashes($filedata); $filedata=ereg_replace("://",":",$filedata); $filedata=miner_replaceInnerText($filedata, "\"", "\"", ";", "", 1); $filedata=miner_chopInnerText($filedata, "/*", "*/", 1, 0); $filedata=miner_chopInnerText($filedata, "//", "\r", 1, 0); $filedata=ereg_replace("\t","",$filedata); $filedata=miner_replaceInnerText($filedata, "\"", "\"", "with", "_H_T_I_W_", 1); $filedata=miner_replaceInnerText($filedata, "\"", "\"", "{", "_OPEN_CUR_BRA_CKET_", 1); $filedata=miner_replaceInnerText($filedata, "\"", "\"", "}", "_CLOSE_CUR_BRA_CKET_", 1); $filedata=ereg_replace("\n",";",$filedata); $filedata=ereg_replace("\r",";",$filedata); $filedata=ereg_replace(" {2,}", " ", $filedata); $filedata=ereg_replace(" ;",";",$filedata); $filedata=ereg_replace("; ",";",$filedata); $filedata=ereg_replace("= ","=",$filedata); $filedata=ereg_replace(" =","=",$filedata); $filedata=ereg_replace(":","://",$filedata); $globalValues["_menuCloseDelay"]=extractPair("_menuCloseDelay",$filedata); $globalValues["_menuOpenDelay"]=extractPair("_menuOpenDelay",$filedata); $globalValues["_subOffsetTop"]=extractPair("_subOffsetTop",$filedata); $globalValues["_subOffsetLeft"]=extractPair("_subOffsetLeft",$filedata); $globalValues["disableMouseMove"]=extractPair("disableMouseMove",$filedata); $globalValues["ignoreCollisions"]=extractPair("ignoreCollisions",$filedata); $globalValues["horizontalMenuDelay"]=extractPair("horizontalMenuDelay",$filedata); $globalValues["retainClickValue"]=extractPair("retainClickValue",$filedata); $globalValues["closeAllOnClick"]=extractPair("closeAllOnClick",$filedata); $globalValues["noSubImageSpacing"]=extractPair("noSubImageSpacing",$filedata); $globalValues["includeTabIndex"]=extractPair("includeTabIndex",$filedata); $globalValues["buildAllMenus"]=extractPair("buildAllMenus",$filedata); $globalValues["_CFix"]=extractPair("_CFix",$filedata); $globalValues["blankPath"]=extractPair("blankPath",$filedata); $globalValues["_scrollUpImage"]=extractPair("_scrollUpImage",$filedata); $globalValues["_scrollDownImage"]=extractPair("_scrollDownImage",$filedata); $globalValues["_scrollAmount"]=extractPair("_scrollAmount",$filedata); $globalValues["_scrollDelay"]=extractPair("_scrollDelay",$filedata); $data=split("with",$filedata); $stylecount=0; $menucount=0; //echo count($data); for($a=0;$a<count($data);$a++) { if(eregi("new mm_style\(\)", $data[$a])) { $stylename=extractStyleName($data[$a]); $styles[$stylecount]["stylename"]=$stylename; $props=miner_getInnerText($data[$a], "{", "}"); $propsar=split(";",$props); for($b=0;$b<count($propsar);$b++){ $pos=strpos($propsar[$b],"="); if($pos){ $key=substr($propsar[$b],0,$pos); $styles[$stylecount][$key]=extractPair($key,$data[$a]); } } $stylecount++; } if(eregi("new menuname\(", $data[$a])) { $menuname=extractMenuName($data[$a]); $menus[$menucount]["menuname"]=$menuname; $props=miner_getInnerText($data[$a], "{", "}"); $propsar=split(";",$props); $itemnumber=0; for($b=0;$b<count($propsar);$b++){ if(substr($propsar[$b],0,3)=="aI("){ $aitext=substr(miner_getInnerText($propsar[$b], "\"", "\""),1,strlen($propsar[$b])-6); $aiparts=split("",$aitext); for($c=0;$c<count($aiparts);$c++){ $pos=strpos($aiparts[$c],"="); if($pos){ $key=substr($aiparts[$c],0,$pos); $val=substr($aiparts[$c],$pos+1,strlen($aiparts[$c])); $menus[$menucount]['items'][$itemnumber][$key]=$val; $lastGoodItem=$itemnumber; $lastGoodKey=$key; } else{ if($aiparts[$c]){ $menus[$menucount]['items'][$lastGoodItem][$lastGoodKey].=";".$aiparts[$c]; } } } $itemnumber++; } else{ $pos=strpos($propsar[$b],"="); if($pos){ $key=substr($propsar[$b],0,$pos); $menus[$menucount][$key]=extractPair($key,$data[$a]); } } } $menucount++; } } } return $filedata; } function getMenusFromData($datafile) { global $_M; $menus=Array(); $menucount=0; $data=split("with",$datafile); for($a=0;$a<count($data);$a++) { if(eregi("new menuname\(", $data[$a])) { $menuname=extractMenuName($data[$a]); $menus[$menucount]["menuname"]=$menuname; $props=miner_getInnerText($data[$a], "{", "}"); $propsar=split(";",$props); $itemnumber=0; for($b=0;$b<count($propsar);$b++){ if(substr($propsar[$b],0,3)=="aI("){ $aitext=substr(miner_getInnerText($propsar[$b], "\"", "\""),1,strlen($propsar[$b])-6); $aiparts=split("",$aitext); $menus[$menucount]['items'][$itemnumber]['menu']=$menucount+count($_M); for($c=0;$c<count($aiparts);$c++){ $pos=strpos($aiparts[$c],"="); if($pos){ $key=substr($aiparts[$c],0,$pos); $val=substr($aiparts[$c],$pos+1,strlen($aiparts[$c])); $val=ereg_replace("_H_T_I_W_","with",$val); $menus[$menucount]['items'][$itemnumber][$key]=$val; $lastGoodItem=$itemnumber; $lastGoodKey=$key; } else{ if($aiparts[$c]){ $menus[$menucount]['items'][$lastGoodItem][$lastGoodKey].=";".$aiparts[$c]; } } } $itemnumber++; } else{ $pos=strpos($propsar[$b],"="); if($pos){ $key=substr($propsar[$b],0,$pos); $menus[$menucount][$key]=extractPair($key,$data[$a]); } } } $menucount++; } } return $menus; } function getSiteMapData($datafile) { global $globalValues, $styles, $menus, $useMenuStyles; $oldlevel=0; $menus=""; $data=getFormatedMenuDataFromFile($datafile); echo "<PRE style='color:red;background:#c0c0c0'>$data</PRE>"; $output=""; $mainmenus=getMainMenus(); //echo count($mainmenus)."<HR>"; if($useMenuStyles)createMenuStyleCSS(); for($a=0;$a<count($mainmenus);$a++)$items=getRecursiveItemsByMenuname($mainmenus[$a]); //echo count($items)."<HR>"; $output.="<UL>"; for($a=0;$a<count($items);$a++) { $leveldifference=$items[$a]['level']-$oldlevel; if($leveldifference>0)for($x=0;$x<$leveldifference;$x++)$output.= "<UL>\n"; if($leveldifference<0)for($x=0;$x>$leveldifference;$x--)$output.= "</UL>\n"; $item=$items[$a]['data']; $itemHTML=""; if($item['text']) { $itemHTML=ereg_replace("_H_T_I_W_","with",$item['text']); if(isset($item['image'])&&$item['image'])$itemHTML="<img src=".$item['image']." border=0>".$itemHTML; } else { } if(isset($item['url'])&&$item['url'])$itemHTML="<a href=".$item['url'].">".$itemHTML."</a>"; $mstyle=$menus[$item['menu']]['style']; $output.= "<LI class=$mstyle>$itemHTML\n"; $oldlevel=$items[$a]['level']; } $output.="</UL>"; return $output; } function getGlobalsFromData($datafile) { $menuGlobals=Array(); $menuGlobals["_menuCloseDelay"]=extractPair("_menuCloseDelay",$datafile); $menuGlobals["_menuOpenDelay"]=extractPair("_menuOpenDelay",$datafile); $menuGlobals["_subOffsetTop"]=extractPair("_subOffsetTop",$datafile); $menuGlobals["_subOffsetLeft"]=extractPair("_subOffsetLeft",$datafile); $menuGlobals["disableMouseMove"]=extractPair("disableMouseMove",$datafile); $menuGlobals["ignoreCollisions"]=extractPair("ignoreCollisions",$datafile); $menuGlobals["horizontalMenuDelay"]=extractPair("horizontalMenuDelay",$datafile); $menuGlobals["retainClickValue"]=extractPair("retainClickValue",$datafile); $menuGlobals["closeAllOnClick"]=extractPair("closeAllOnClick",$datafile); $menuGlobals["noSubImageSpacing"]=extractPair("noSubImageSpacing",$datafile); $menuGlobals["includeTabIndex"]=extractPair("includeTabIndex",$datafile); $menuGlobals["buildAllMenus"]=extractPair("buildAllMenus",$datafile); $menuGlobals["_CFix"]=extractPair("_CFix",$datafile); $menuGlobals["blankPath"]=extractPair("blankPath",$datafile); $menuGlobals["_scrollUpImage"]=extractPair("_scrollUpImage",$datafile); $menuGlobals["_scrollDownImage"]=extractPair("_scrollDownImage",$datafile); $menuGlobals["_scrollAmount"]=extractPair("_scrollAmount",$datafile); $menuGlobals["_scrollDelay"]=extractPair("_scrollDelay",$datafile); return $menuGlobals; } ################################################################################ function getStylesFromData($datafile) { $styles=Array(); $stylecount=0; $data=split("with",$datafile); for($a=0;$a<count($data);$a++) { if(eregi("new mm_style\(\)", $data[$a])) { $stylename=extractStyleName($data[$a]); $styles[$stylecount]["stylename"]=$stylename; $props=miner_getInnerText($data[$a], "{", "}"); $propsar=split(";",$props); for($b=0;$b<count($propsar);$b++){ $pos=strpos($propsar[$b],"="); if($pos){ $key=substr($propsar[$b],0,$pos); $styles[$stylecount][$key]=extractPair($key,$data[$a]); } } $stylecount++; } } return $styles; } function extractPair($data, $filedata){ if(!strpos($filedata, $data))return ""; $data=ereg_replace(" =","=",$data); $data=ereg_replace("= ","=",$data); $text=miner_getInnerText($filedata, $data."=", ";"); $text=substr($text,strlen($data)+1,strrpos($text,";")-strlen($data)-1); $filedata=miner_chopInnerText($filedata, $data, ";", 0,0); $text=ereg_replace("\"", "", $text); return $text; } function miner_replaceInnerText($haystack, $startNeedle, $endNeedle, $needle, $newneedle, $loopthru=0) { /* This function replaces text inside a specified block of text */ $pstr=$haystack; $pos=miner_getInnerStrpos($haystack,$startNeedle, $endNeedle); if(is_numeric($pos[0]) && is_numeric($pos[1])){ if($loopthru){ $tstr=$haystack; $pstr=""; while(is_numeric($pos[0]) && is_numeric($pos[1])){ $istr=substr($tstr,$pos[0],$pos[1]); $istr=ereg_replace($needle,$newneedle,$istr); $pstr.=substr($tstr,0,$pos[0]).$istr; $tstr=substr($tstr,$pos[0]+$pos[1],strlen($tstr)); $pos=miner_getInnerStrpos($tstr, $startNeedle, $endNeedle); } $pstr.=substr($tstr,0,strlen($tstr)); } else{ $pstr=substr($haystack,$pos[0],$pos[1]); $pstr=ereg_replace($needle,$newneedle,$pstr); $pstr=substr($haystack,0,$pos[0]).$pstr.substr($haystack,$pos[1]+$pos[0],strlen($haystack)); } } return $pstr; } function miner_getInnerStrpos($haystack, $startNeedle, $endNeedle) { $pos1=strpos($haystack, $startNeedle); $startNeedleWidth=strlen($startNeedle); $tstr=substr($haystack,$pos1+$startNeedleWidth,strlen($haystack)); $pos2=strpos($tstr, $endNeedle); if(is_numeric($pos2))$pos2=$pos2+strlen($startNeedle)+strlen($endNeedle); $spos[0]=$pos1; $spos[1]=$pos2; return $spos; } function miner_chopInnerText($haystack, $startNeedle, $endNeedle, $loopthru=1, $keepvars=0) { $pstr=$haystack; $pos=miner_getInnerStrpos($haystack, $startNeedle, $endNeedle); if(is_numeric($pos[0]) && is_numeric($pos[1])){ if($loopthru){ $tstr=$pstr; $pstr=""; while(is_numeric($pos[0]) && is_numeric($pos[1])){ if($keepvars){ $pstr.=substr($tstr,0,$pos[0]+strlen($startNeedle)); $tstr=substr($tstr,$pos[0]+$pos[1],strlen($tstr)); } else{ $pstr.=substr($tstr,0,$pos[0]); $tstr=substr($tstr,$pos[0]+$pos[1],strlen($tstr)); } $pos=miner_getInnerStrpos($tstr, $startNeedle, $endNeedle); } $pstr.=substr($tstr,0,strlen($tstr)+1); } else{ if($keepvars){ $pstr=substr($haystack,0,$pos[0]+strlen($startNeedle)); $pstr.=substr($haystack,$pos[1]+$pos[0]-strlen($endNeedle),strlen($haystack)); } else{ $pstr=substr($haystack,0,$pos[0]); $pstr.=substr($haystack,$pos[1]+$pos[0],strlen($haystack)); } } } return $pstr; } function miner_getInnerText($haystack, $startNeedle, $endNeedle, $includeNeedles=1) { $pos=miner_getInnerStrpos($haystack,$startNeedle, $endNeedle); $pstr=substr($haystack,$pos[0],$pos[1]); if(!$includeNeedles){ $pstr=substr($pstr,strlen($startNeedle),strlen($pstr)); $pstr=substr($pstr,0,strlen($pstr)-strlen($endNeedle)); } return $pstr; } function getDocumentRoot(){ $docRoot=$_SERVER['DOCUMENT_ROOT']; if(substr($docRoot,-1)!="/")$docRoot.="/"; return $docRoot; } function getMenuTextFromDataFile($filename) { $filedata=""; if (ereg("://", $filename)){ $handle = fopen($filename, "rb"); } else { //$filename=getDocumentRoot().$filename; //echo $filename; $handle = fopen($filename, "rb"); } $contents=""; if ($handle){ while(!feof($handle)) { $contents .= fread($handle, 8192); } } else { echo "<br><b>Couldn't open file: $filename</b><br>"; return; } fclose($handle); $filedata=$contents; if(strlen($filedata)>1) { $filedata=stripslashes($filedata); $filedata=ereg_replace("://",":",$filedata); $filedata=miner_replaceInnerText($filedata, "\"", "\"", ";", "", 1); $filedata=miner_chopInnerText($filedata, "/*", "*/", 1, 0); $filedata=miner_chopInnerText($filedata, "//", "\r", 1, 0); $filedata=ereg_replace("\t","",$filedata); $filedata=miner_replaceInnerText($filedata, "\"", "\"", "with", "_H_T_I_W_", 1); $filedata=miner_replaceInnerText($filedata, "\"", "\"", "{", "_OPEN_CUR_BRA_CKET_", 1); $filedata=miner_replaceInnerText($filedata, "\"", "\"", "}", "_CLOSE_CUR_BRA_CKET_", 1); $filedata=ereg_replace("\n",";",$filedata); $filedata=ereg_replace("\r",";",$filedata); $filedata=ereg_replace(" {2,}", " ", $filedata); $filedata=ereg_replace(" ;",";",$filedata); $filedata=ereg_replace("; ",";",$filedata); $filedata=ereg_replace("= ","=",$filedata); $filedata=ereg_replace(" =","=",$filedata); $filedata=ereg_replace(":","://",$filedata); $filedata=ereg_replace(";{2,}", ";", $filedata); } return $filedata; } function getMenuData($reset=0) { global $_S; global $_M; global $_I; global $dataRetrieved; global $menuDataFile; if(!$dataRetrieved||$reset==1) { $_M = Array(); $_S = Array(); $_I = Array(); $menuCounter=0; $styleCounter=0; $itemCounter=0; for($df=0;$df<count($menuDataFile);$df++) { $dataText=getMenuTextFromDataFile($menuDataFile[$df]); $styles=getStylesFromData($dataText); for($a=0;$a<count($styles);$a++) { $_S[$styleCounter]=Array(); foreach ($styles[$a] as $key => $value) { $_S[$styleCounter][$key]=$value; } $styleCounter++; } $menus=getMenusFromData($dataText); for($a=0;$a<count($menus);$a++){ $_M[$menuCounter]=Array(); foreach ($menus[$a] as $key => $value) { $_M[$menuCounter][$key]=$value; } $menuCounter++; } } } $dataRetrieved=1; } function getItemsByMenu($mnu) { global $_M, $_S, $_I; $items=$_M[$mnu]['items']; for($a=0;$a<count($items);$a++) { echo "$items[$a]<br>"; } } function getMenuByName($menuname) { global $_M, $_S, $_I; for($a=0;$a<count($_M);$a++) { if($menuname==$_M[$a]['menuname'])return $a; } return -1; } $dataMinerOutput=""; // Global Variable for containing details of output function outputSitemapItems($mnu) { global $_M,$dataMinerOutput; $dataMinerOutput.="<UL>\n"; $items=$_M[$mnu]['items']; for($a=0;$a<count($items);$a++) { $dataMinerOutput.="<li>\n"; if(isset($items[$a]['showmenu'])&&$items[$a]['showmenu']) { //Changed www.snipperdag.com aI(text showmenu and url 16 September 2007 if(isset($items[$a]['url'])&&$items[$a]['url']) { $dataMinerOutput.="<a href=".$items[$a]['url'].">".$items[$a]['text']."</a>\n"; } else{ $dataMinerOutput.=$items[$a]['text']."\n"; } //Changed www.snipperdag.com aI(text showmenu and url) url was not linked 16 September 2007 outputSitemapItems(getMenuByName($items[$a]['showmenu'])); } else { if(isset($items[$a]['url'])&&$items[$a]['url']) { $dataMinerOutput.="<a href=".$items[$a]['url'].">".$items[$a]['text']."</a>\n"; } else { $dataMinerOutput.="".$items[$a]['text']."\n"; } } } $dataMinerOutput.="</UL>\n"; }unction outputSitemapItems($mnu) { global $_M,$dataMinerOutput; $dataMinerOutput.="<UL>\n"; $items=$_M[$mnu]['items']; for($a=0;$a<count($items);$a++) { $dataMinerOutput.="<li>\n"; if(isset($items[$a]['showmenu'])&&$items[$a]['showmenu']) { //Changed www.snipperdag.com aI(text showmenu url 16 September 2007 if(isset($items[$a]['url'])&&$items[$a]['url']) { $dataMinerOutput.="<a href=".$items[$a]['url'].">".$items[$a]['text']."</a>\n"; } else{ $dataMinerOutput.=$items[$a]['text']."\n"; } //Changed www.snipperdag.com I(text showmenu url) url was not linked 16 September 2007 outputSitemapItems(getMenuByName($items[$a]['showmenu'])); } else { if(isset($items[$a]['url'])&&$items[$a]['url']) { $dataMinerOutput.="<a href=".$items[$a]['url'].">".$items[$a]['text']."</a>\n"; } else { $dataMinerOutput.="".$items[$a]['text']."\n"; } } } $dataMinerOutput.="</UL>\n"; } function outputNoScriptItems($mnu) { global $_M,$dataMinerOutput; $items=$_M[$mnu]['items']; $dataMinerOutput.=""; for($a=0;$a<count($items);$a++) { if(isset($_M[$mnu]['orientation'])&& $_M[$mnu]['orientation']) { if($a==0)$dataMinerOutput.="<table border=0 cellpadding=0 cellspacing=0><tr>"; $lnk=$items[$a]['text']; if(isset($items[$a]['url'])&&$items[$a]['url']) { $lnk="<a href=".$items[$a]['url'].">".$items[$a]['text'].""; } $dataMinerOutput.="<td valign=top><b>$lnk</b>"; if(isset($items[$a]['showmenu'])&&$items[$a]['showmenu']) { outputSitemapItems(getMenuByName($items[$a]['showmenu'])); } $dataMinerOutput.="</td>"; if($a==count($items))$dataMinerOutput.="</tr></table>"; } } $dataMinerOutput.=""; } function outputAsNoScript($datafile=null) { global $_M,$dataMinerOutput; $mainmenus=getMainMenus(); for($a=0;$a<count($mainmenus);$a++) { // Need to get system to scan through menus see if they are horiz or vert and draw TABLE for horiz or UL for vertical $dataMinerOutput=""; outputNoScriptItems($mainmenus[$a]); echo $dataMinerOutput; echo "<HR>"; } } function getStyles() { global $_S; getMenuData(); return $_S; } function showStyles($datafile) { global $_M, $_S, $_I; $styles=getStyles(); for($a=0;$a<count($styles);$a++) { echo "<b>".$_S[$a]['stylename']."</b><br>"; foreach ($_S[$a] as $key => $value) { if(!is_numeric($value))$value="\"".$value."\""; echo "<b>$key</b>=$value;<br />\n"; } echo "<HR>"; } } function getMainMenus() { global $_M, $_S, $_I; getMenuData(); $mainmenus = Array(); for($a=0;$a<count($_M);$a++) { if(isset($_M[$a]['alwaysvisible'])&&$_M[$a]['alwaysvisible'])$mainmenus[]=$a; } return $mainmenus; } function showMainMenus() { global $_M, $_S, $_I; $mainmenus=getMainMenus(); for($a=0;$a<count($mainmenus);$a++) { echo "<b>".$_M[$a]['menuname']."</b><br>"; foreach ($_M[$a] as $key => $value) { echo "$key=$value<br>"; } echo "<HR>"; } } function getItems() { global $_M; getMenuData(); $items=Array(); $itemCounter=0; for($a=0;$a<count($_M);$a++) { foreach ($_M[$a]['items'] as $key1 => $value1) { foreach ($value1 as $key => $value) { $items[$itemCounter][$key]=$value; } $itemCounter++; } } return $items; } function showItems() { $items=getItems(); for($a=0;$a<count($items);$a++) { foreach ($items[$a] as $key => $value) { echo "$key=$value "; } echo "<br>"; } } function getAllMenus() { global $_M; getMenuData(); return $_M; } function showAllMenus($datafile) { global $_M, $_S, $_I; $menus=getAllMenus(); for($a=0;$a<count($menus);$a++) { echo "<b>".$_M[$a]['menuname']."</b><br>"; foreach ($_M[$a] as $key => $value) { echo "$key=$value<br>"; } echo "<HR>"; } } function showMenusAndItems($datafile) { global $_M, $_S, $_I; getMenuData(); for($a=0;$a<count($_M);$a++) { echo "<b>".$_M[$a]['menuname']."</b><br>"; foreach ($_M[$a] as $key => $value) { echo ".....$key=$value<br>"; } foreach ($_M[$a]['items'] as $key1 => $value1) { echo "..........."; foreach ($value1 as $key => $value) { echo "$key=$value--"; } echo "<br>"; } } echo "<hr>"; } function newShowMenus() { global $_M, $_S, $_I; getMenuData(); for($a=0;$a<count($_S);$a++) { echo "<b>".$_S[$a]['stylename']."</b><br>"; foreach ($_S[$a] as $key => $value) { echo ".....$key=$value<br>"; } } echo "<HR>"; for($a=0;$a<count($_M);$a++) { echo "<b>".$_M[$a]['menuname']."</b><br>"; foreach ($_M[$a] as $key => $value) { echo ".....$key=$value<br>"; } foreach ($_M[$a]['items'] as $key1 => $value1) { echo ".........."; foreach ($value1 as $key => $value) { echo "$key=$value--"; } echo "<br>"; } } } ?> I have another site which gives the option at the host of changing from 5.2 to 5.3 the map fnction works in 5.2 but gives the same error when i set the php version to 5.3.... To see it in action (different site to the one i am having probs with) see http://79.170.40.43/locodocs.co.uk/misc/sitemap.php I would appreciate any thoughts regards this matter, i have of course asked milonic, but as the sitemap util is part of the extras, they dont support it as such! A while back my webhost upgraded to PHP5 and broke a few of my simple scripts - primarily forms using a text box for entry. I renamed and relinked the forms to .php4 and it "solved" the problem. I've decided to fix them correctly and use proper PHP 5 code. What's the easiest way to actually retrieve the value of a text input in PHP5? My old reference tricks return null. When I started reading up I saw only PHP4 examples and then in over my head with global variables, httaccess and php.ini. I don't want to mess about with the default settings. I'm sure I zoomed right past a simple answer on my way to that mess. A simple example script: Code: [Select] <FORM NAME="form1" ID="form1" METHOD="POST" ACTION="simple.php"> <INPUT Type='Text' Name="i1Text" ID="i1Text" Value="Default"> <INPUT Type="Submit" Name="Submit1" Value="Read the Text"> </FORM> <?PHP if (isset($_POST['Submit1'])) { $RefText=$i1Text; print "Text: $RefText"; <!-- Returns blanks unless .php4 --> } ?>So, how do I actually get to that text value? Thanks in advance! Hi, I was wondering if any one can help me out with this little issue. I select some data, and put it on a while loop, so something like while($row = mysql_fetch_array($result)){ body } but at the very last element in the array I'd like to something a little different than else. So, i have 4 elements. For the first 3 I'd like to print element1, element2, element 3, element4 Notice the missing comma at element4 Hi , i am working on a PHP code that would fetch me the" title and the description" from another web page something similar to www.Digg.com .After searching a couple of Open source codes developed by some generous coder I found this piece of code: I have tested this code and it works fine, but the confusion here is it only works from external internet and Iam not able to extract the contents when i use the same piece of code from my office intranet(Our intranet has full access to the internet ) and the best part is when i use the same url for fetching content from Digg.com from my office intranet it works fine. The error I get is file_get_contents time out after 60 seconds OR I get a blank page result without any content But the same piece of code when used outside of my intranet works perfectly fine. Please let me know if you find anything incorrect! Thanks Code: [Select] <?php if(isset($_POST['submitlink'])) { function getMetaTitle($content){ $pattern = "|<[\s]*title[\s]*>([^<]+)<[\s]*/[\s]*title[\s]*>|Ui"; if(preg_match($pattern, $content, $match)) return $match[1]; else return false; } $url = $_POST['submitlink']; $data = array(); // get url title $content = @file_get_contents($url); $data['title'] = getMetaTitle($content); // get url description from meta tag $tags = @get_meta_tags($url); $data['description'] = $tags['description']; $dom = new domDocument; @$dom->loadHTML($content); $dom->preserveWhiteSpace = false; $images = $dom->getElementsByTagName('img'); foreach($images as $img) { $imgurl = $img->getAttribute('src'); $alt = $img->getAttribute('alt'); //$size = getimagesize($imgurl); //echo "Title: $alt<br>"; //echo $imgurl; //echo '<img src="'.$imgurl.'" title="'.$alt.'" width="50px"/>'; } $formdata .= '<table><tr><td>Title:</td><td><a href='; $formdata .= 'gethome.php?url='; $formdata .= $url; $formdata .= '>'; $formdata .= json_encode($data['title']); $formdata .= '</a></td></tr>'; $formdata .= '<tr><td>Description:</td><td> '; $formdata .= json_encode($data['description']); $formdata .= '</td></tr></table>'; } hello guys i heard there is a way that you can make something like a database on a text editor and when ever u want to change the info you just open a text editor and change the information How is this called? where can i find a tutorial? any tips? thanks you very much I'm trying to do a following feed. This feed includes posts and comments that the user is following.
The first 3 following types are in the content table and the last following type is in the comments table.
This query fetches the first 3 following types successfully.
$construct = $connectdb->prepare("SELECT parent.* FROM `content` as parent JOIN followers ftable on ( (ftable.parent_id=parent.sid AND ftable.userposts='1') OR (ftable.`parent_id`=parent.pageid AND ftable.topic='1') OR (ftable.parent_id=parent.pageid AND ftable.page='1') ) AND ftable.userid=:userid WHERE parent.deleted='0' GROUP BY parent.id ORDER BY parent.posted DESC");This query fetches the following comments type successfully $construct = $connectdb->prepare("SELECT parent.* FROM `comments` as parent JOIN followers ftable on ftable.parent_id=parent.postid AND ftable.comments='1' AND ftable.userid=:userid WHERE parent.deleted='0' ORDER BY parent.posted DESC");How do i combine the two queries? In this feed i want the results to be ORDER by posted DESC. my current code for getting a page is <?php $page = $_GET['page']; //Gets the (page=) from the URL if($page){ $site = file_exists($page.'.html') ? $page.'.html' : 'home.html';} else{ $site = 'home.html'; // Else include the default home.php file. } include($site); ?> the problem with it is it only checks for html pages. I would like to have it check for html then php pages and it pull up whichever is valid. i tried to do it myself but im a php n00b. pls help <?php $page = $_GET['page']; //Gets the (page=) from the URL if($page){ $site = file_exists($page.'.html') ? $page.'.html' : 'home.html';} elseif $site = file_exists($page.'.php') ? $page.'.php' : 'home.html'; else{$site = 'home.html'; // Else include the default home.php file. } include($site); ?> ^^ is what i did. any help will be appreciated. Thanks ok i display description from database with no isue but the thing is if there are links in description even the links like http://somesite.com shows as normal text on browser. how can i make them clickable? Hello, iam almost done with my project .. except there is one more thing left which somehow i cant manage to figure it out....... i manged to make a proxy array which rotates proxies randomly on every try..... but i want for my users to be able to add them manually via the textarea... so they put their proxies and as much as they want...... so then i guess explode should be used to fetch the proxies that were added by the user from the textarea and put them in an array like u see down and then with the curl array_rand it randomises them on evry try The real problem is i dnt know how to indetidy the explode cause iam not adding them manually they will be added via textare by users....... so when they add the ips they need to be fetched from the textare. THNX IN ADVACE $proxies = array( '000.000.000.00:000', <----------------- should i keep this ? cause ips will be added from textarea by users ? '000.000.000.00:000', '000.000.000.00:000', '000.000.000.00:000', ); curl_setopt($ch, CURLOPT_PROXY,$proxies[array_rand($proxies)]); <----- AFTER and array is made using exploit this will call it :) <textarea cols='22' class='area' rows='14' name='proxies'>PROXIES</textarea><br><input type='submit' value='Test'><br></p><p align='center' dir='ltr'><b> Edited by madmike3, 20 August 2014 - 05:29 AM. Hi,
I am working on coupon script which generate coupon.
The coupon script have two types, one is redemption and second one is printable in the same process it send sms to customer.
But issue is when it send SMS, sometime SMS works nice and lots of time SMS content got missing.
I could not understand why it happening. Is it scripting issue or another?
The script code as below:
----------------------------------------------------------------------------------------------------------
//Send coupon code to customer by SMS
$smsparameters = "select * from cs_options where option_id in ('23','24','25','26')";
if(!($smsparametersresult = mysql_query($smsparameters))) { echo $smsparameters.mysql_error(); exit; }
while($smsparametersrow = mysql_fetch_array($smsparametersresult)) {
$smsparametersarray[] = $smsparametersrow['option_value'];
}
define('SMS_SERVICE_URL', $smsparametersarray[0]);
define('KEY', $smsparametersarray[1]);
define('USERNAME', $smsparametersarray[2]);
define('PASSWORD', $smsparametersarray[3]);
$automationquery = "select * from cs_automation where automation_id='6'";
if(!($automationresult = mysql_query($automationquery))) { echo $automationquery.mysql_error(); exit; }
$automationrow = mysql_fetch_array($automationresult);
$automationrow['automation_value'];
if($automationrow['automation_value']=='1') {
$sms_order_id = $_SESSION['new_order_id'];
$current_date = date('Y-m-d');
$smsquery = "select * from cs_order as ord left join cs_customer as cust on ord.order_user_id = cust.customer_id where ord.order_id = '$sms_order_id'";
if(!($smsresult = mysql_query($smsquery))) { echo $smsquery.mysql_error(); exit; }
$sms_items = mysql_fetch_assoc($smsresult);
$order_coupon_id4 = explode(", ", $customer_email_items['order_coupon_id']);
foreach($order_coupon_id4 as $coup_id) {
$coupon_id = $coup_id['order_coupon_id'];
$query = "select * from cs_coupons as coup inner join cs_company as comp on coup.coupons_store = comp.retailer_id inner join cs_payments_currency as curr on coup.coupons_currency_id = curr.currency_id inner join cs_countries as cont on comp.country = cont.country_id inner join cs_states as stat on comp.state = stat.state_id inner join cs_cities as citi on comp.city = citi.city_id inner join cs_area as aria on comp.local_area = aria.area_id where coup.coupons_id = '$coupon_id'";
if(!($result = mysql_query($query))) { echo $query.mysql_error(); exit; }
$coupon = mysql_fetch_array($result);
$coup_name = $coupon['coupons_name'];
$coup_code = $coupon['coupons_code'];
$custdiscount = $coupon['coupons_product_discount'];
$coup_valid_date = date("d-m-Y", strtotime($coupon['coupons_exp_date']));
$couponcodeforsms = $sms_items['order_coupon_code'];
$couponcodeforsms1 = explode(", ", $sms_items['order_coupon_code']);
$smscount = count($couponcodeforsms1);
$mobilenoforsms = $sms_items['customer_mobile'];
$custnameforsms = ucwords($sms_items['customer_fname']);
$company_name = $coupon['company_name'];
$company_address = $coupon['city_name'];
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, "".SMS_SERVICE_URL."?user=".USERNAME."&password=".PASSWORD."&phone=".urlencode($mobilenoforsms)."&text=".urlencode('Hi '.$custnameforsms.', Coupon from CrackMyDeal : '.$coup_code.', '.$custdiscount.'% off on '.$coup_name.' at '.$company_name.', '.$company_address.', Valid till '.$coup_valid_date.'. T&C Apply.')."&type=t&senderid=".KEY."");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
}
}
----------------------------------------------------------------------------------------------------------------
The SMS which works nice:
Hi Paresh, Coupon from CrackMyDeal : CRACKD2014, 20% off on WebHosting (Business) at Unique InfoTech, Kamothe, Valid till 31-12-2014. T&C Apply.
--------------------------------------------------------------------------------------------------------------
And missing content SMS :
Hi Paresh, Coupon from CrackMyDeal : , % off on at , , Valid till 01-01-1970. T&C Apply.
-------------------------------------------------------------------------------------------------------------- Hello I have the following code Code: [Select] <?php // STORE DATABASE VARIABLES $hostname_cnConnection = "localhost"; $database_cnConnection = "tekou"; $username_cnConnection = "root"; $password_cnConnection = "1234"; $cnConnection = mysql_pconnect($hostname_cnConnection, $username_cnConnection, $password_cnConnection); mysql_set_charset('utf8',$cnConnection); // CONNECT TO DATABASE mysql_select_db($database_cnConnection, $cnConnection); $data = mysql_query("SELECT * from jos_users") or die(mysql_error()); // Print "<table border cellpadding=3>"; while($info = mysql_fetch_array( $data )) { // echo $info['id']; $prod_id=$info['id'] ; // echo "Product ID " .$prod_id; //Show Product Id mysql_query("UPDATE jos_vm_user_info SET first_name = '".$info['name']." WHERE user_id = ".$info['id']) or die(mysql_error()); } echo $info['id']; ?> I want to read every $name and update in jos_vm_user_info the first_name but I think I have error in code because nothing happens. I quess that .$info['id'] doesnt return a single number but all numbers but I dont know how to fix it. Please someone to help me. Hello, I'm using pbb forum http://xemix.pl/ When I tried to get topics using rss feeds module, I got this error. Code: [Select] Fatal error: Uncaught exception 'Exception' with message 'Erroe occured while loading url by cURL. Couldn't resolve host 'pbboard.com'' in /home/a5402323/public_html/includes/FeedParser.php:226 Stack trace: #0 /home/a5402323/public_html/includes/FeedParser.php(157): FeedParser->getUrlContent() #1 /home/a5402323/public_html/modules/admin/feeder.module.php(218): FeedParser->parse('http://absba.or...') #2 /home/a5402323/public_html/modules/admin/feeder.module.php(49): PowerBBFeederMOD->_AddFeedStart() #3 /home/a5402323/public_html/admin.php(89): PowerBBFeederMOD->run() #4 {main} thrown in /home/a5402323/public_html/includes/FeedParser.php on line 226 the host said thet Hello,cURL is installed by default here Many Thanks,Helpdesk Staff any help !!!! hi
i am trying to fetch all my data from table
here is the code
function premiumview($cn,$table) { $table=mysqli_real_escape_string($cn,$table); $result=$cn->query("select * from $table"); if($result->num_rows >0) { while($f=$result->fetch_all(MYSQL_ASSOC)) { $result[]=$f; } return $result; } else { return $result=$cn->error; } }and the error is Fatal error: Cannot use object of type mysqli_result as array ( in while loop line ) What i am doing wrong? I have made an autocomplete form... originally the values were static: $aUsers = array( "Adams, Egbert", "Altman, Alisha", "Archibald, Janna", ); Now I want the values from a database table DEVICES row name DeviceName: $sql = "SELECT DeviceName FROM DEVICES"; $res = mysql_query($sql); $aUsers = array(); while ($row = mysql_fetch_assoc($res)) { $aUsers[] = $row; } It will not display the values in my autocomplete form when text is entered.... but with static data it will. Im confused! Thank you Hi, I am trying to fetch a file with function file_get_contents() from a website, but am getting following error. [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden in /data/22/1/27/17/1842180/user/1999295/htdocs/web/modules/index.php on line 14. using following code, Code: [Select] $content = file_get_contents($source); $handle = fopen($destination, 'wb'); fwrite($handle, $content); fclose($handle); does it have something to with http header, which might be required to set as HTTP/1.1 in php Regards, Abhishek |