Jump to content

jamesxg1

Members
  • Posts

    1,133
  • Joined

  • Last visited

Everything posted by jamesxg1

  1. Like Thorpe said, http://www.php.net/preg_match. James.
  2. Have the value of $icon_settings put into a textarea inside a form, then have it write to a file on submission. http://uk2.php.net/fwrite James.
  3. Hiya MMDE, Thanks for a prompt reply, it's not the search page that isnt working, as all that works fine. It's the search class I have attached to this post that is playing up, and returning the array with missing data. Regarding the queries; I do this for 1) Security. 2) It's clean. 3) And to close open varibles. Many many thanks, James.
  4. <?php if(isset($_POST['submit'])) { foreach($_POST as $k => $v) { echo $k . ' = ' . $v; if($_POST[$v] == 'the right answer') { echo 'well done you got ' . $_POST[$k] . ' right'; } else { echo 'you have failed'; } } } $transport = array('r' => 'Cruise the street in your hot ride', 'a' => 'Join the army', 'p' => 'go to a science convention', 'h' => 'stay home and work on the computer'); foreach ($transport as $key => $transport) { $return .= '<input type="radio" name="transport" value="' . $key . '"/> ' . $transport . '<br/>'; } echo '<form action="" method="">' . $return . '<input type="submit" name="submit"></form>'; James.
  5. <?php //This is the directory where images will be saved $target = "image/"; $target = $target . md5() . '-' . basename( $_FILES['photo']['name']); //This gets all the other information from the form $name=$_POST['name']; $email=$_POST['email']; $phone=$_POST['phone']; $pic=($_FILES['photo']['name']); // Connects to your Database mysql_connect("localhost", "data_admin2", "data25") or die(mysql_error()) ; mysql_select_db("Resumebank") or die(mysql_error()) ; //Writes the photo to the server move_uploaded_file($_FILES['photo']['tmp_name'], $target); //Writes the information to the database mysql_query("INSERT INTO `employee` VALUES ('$name', '$email', '$phone', '$pic')") ; echo "The file has been uploaded, and your information has been added to the directory"; ?> James.
  6. Hiya peeps, Here is my search code; <?php include("top.php");?> <?php $resultStr=''; $columns=1; if($_GET) { if(isset($_GET['q'])) { $arrwords=explode(" ",$_GET['q']); $searchObj=new FIRM_Search($_GET['q']); $resultStr=$searchObj->search(); $columns=$searchObj->totalcols; //echo $columns."arrsize=".sizeof($searchObj->compResult); //var_dump($searchObj->compResult); exit('<pre>' . print_r($searchObj->compResult, true) . '</pre>'); if($columns==1 && sizeof($searchObj->compResult)==1) { foreach($searchObj->compResult as $key=>$value) $_GET['c']=$value['company_id']; $companyObj = new FIRM_Company_detail($_GET['c']); $resultStr = $companyObj->showDetails(); } if($columns==1 && sizeof($searchObj->categoryList)==1) { foreach($searchObj->categoryList as $catKey=>$value) { $_GET['cat']=$catKey; } $catObj = new FIRM_Category($_GET['cat']); $resultStr = $catObj->fetchByCategory(); $columns=$catObj->totalcols; } } if(isset($_GET['c'])) { $companyObj = new FIRM_Company_detail($_GET['c']); $resultStr = $companyObj->showDetails(); } if(isset($_GET['cat'])) { $catObj = new FIRM_Category($_GET['cat']); $resultStr = $catObj->fetchByCategory(); $columns=$catObj->totalcols; } /*$darr = array('p'=>'q','q'=>'p','w'=>'m','m'=>'w','b'=>'d','d'=>'b','a'=>'o','o'=>'a','g'=>'d','d'=>'g',6=>9,9=>6); if($resultStr=='' && isset($_GET['q'])) { $word=FIRM_Common::wordCombination($_GET['q']); //var_dump($word); for($i=0;$i<sizeof($word);$i++) { $searchObj=new FIRM_Search($word[$i]); //echo $word[$i]."=".$searchObj->checkExist()."<br>"; if($searchObj->checkExist()){ $resultStr=$searchObj->search(); $columns=$searchObj->totalcols; if($columns==1 && sizeof($searchObj->compResult)==1) { foreach($searchObj->compResult as $key=>$value) $_GET['c']=$value['company_id']; $_GET['cname']=$value['compname']; $companyObj = new FIRM_Company_detail($_GET['c']); $resultStr = $companyObj->showDetails(); } } if($resultStr!='') break; } }*/ } if(!isset($_GET['c']) && !isset($searchObj->compResult) && $searchObj->compResult == NULL && empty($searchObj->compResult) && count($searchObj->compResult, COUNT_RECURSIVE) == 0) { $arrayCount = count($searchObj->compResult, COUNT_RECURSIVE); if($_SESSION['currentlang'] == 'en') { $sql = "SELECT * FROM `firm_text_strings` WHERE `id` = '100' AND `languages_id` = 'en' ORDER BY `id` ASC"; $result = mysql_query($sql) ; if($result) { while($row = mysql_fetch_array($result)) { $resultStr .= '<br /><br /><br /><br />'; $resultStr .= '<span style="margin-left: 330px;">' . $row['data'] . '</span><br />'; $resultStr .= '<span style="margin-left: 330px;">' . $row['3'] . '</span>'; } } else { $resultStr = 'error'; } } elseif($_SESSION['currentlang'] == 'is') { $sql = "SELECT * FROM `firm_text_strings` WHERE `id` = '100' AND `languages_id` = 'is' ORDER BY `id` ASC"; $result = mysql_query($sql) ; if($result) { while($row = mysql_fetch_array($result)) { $resultStr .= '<br /><br /><br /><br />'; $resultStr .= '<span style="margin-left: 330px;">' . $row['data'] . '</span><br />'; $resultStr .= '<span style="margin-left: 330px;">' . $row['3'] . '</span>'; } } else { $resultStr = 'error'; } } } ?> <body onLoad="checkSrcoll()"><script type="text/javascript" src="js/wz_tooltip.js"></script> <a name="top" /> <form name="Form1" id="Form1" action="search.php" method="get"> <div class="header"><a href="index.php"> <img src="images/header_top.gif" alt="" height="70" width="179" id="subLogo" alt="Firmaskra Islands exporters directory - Iceland food, mineral, shipping, IT technology,medical fishery equipements, travel firm and exporters" /></a> <div id="hdFrm"> <span id="Label1"><?php echo $text[1]?$text[1]:__('Leita a');?>: </span> <input type="text" name="q" size="42" id="q" value="<?php echo $_GET['q']!=""?$_GET['q'] :'';?>"/> <input type="submit" value="<?php echo $text[2]? $text[2]:__('Hefja leit')?>" name="search" id="search"/> <br /> <div id="Label2" style="position:relative; float:left;"> </div><span style="width:auto;" id="searchinfo"><?php echo $text[3]? $text[3]: __('Skr inn nafn fyrirtkis - vru - vrumerkis - nafn stjrnanda');?> </span> </div> </div> </form> <div class="subHead"> <table style="width:100%" > <tr> <td nowrap="nowrap"> <div class="left" style="width:100%"> <?php echo $oCommon->getflags($_SERVER['SCRIPT_NAME'],$_SERVER['QUERY_STRING']); ?> <?php echo $oCommon->getPrintinfoLinks();?> </div> </Td> </td><td nowrap="nowrap"> <div class="right" style="height: 14px; width:100%"> <?php echo $oCommon->getInfoPagesLink();?> </div> </Td></tr></table> </div> <div class="printinfo"> <div id="pHead"><?php echo __('Firmaskrá Íslands')?></div> <div id="pLeft">www.firmaskra.is</div><div id="pRight">firmaskra@firmaskra.is</div> </div> <div style="position:relative; float:left; min-width:999px; width:99%;" id="datadiv"> <?php if($resultStr) { echo $resultStr; ?> <script language="javascript" type="text/javascript"> var columns='<?php echo $columns;?>'; //alert(columns); if(columns==1) { h2width=970; ulwidth=970; <?php if(!isset($_GET['cat'])):?> liwidth=960; <?php else:?> liwidth=470; <?php endif;?> } else { //alert(1) h2width=920/columns; ulwidth=960/columns; liwidth=930/columns; } $('ul').toggleClass('ul'+columns); $('li').toggleClass('li'+columns); $('h2').css('width',(h2width+10)+'px'); $('ul').css('width',ulwidth+'px'); $('li').css('width',liwidth+'px'); $('div.FloatLeftPadding').css('width',h2width+'px'); $('div.FloatLeftNoPadding').css('width',h2width+'px'); $("#WzTtDiV").css('opacity',0.9); if(columns==1) { $('#firms_by_name').css('width',(ulwidth+ulwidth)+20); $('#h2firmsbyname').css('width',(h2width+h2width+20)) } else{ $('#firms_by_name').css('width',ulwidth-40); $('#firms_by_name1').css('width',ulwidth-40); $('#ulname').css('width',ulwidth-60); $('#h2firmsbyname').css('width',h2width-60) } $('#ulname').css('width',(ulwidth+ulwidth+20)); $('#firms_by_name').css('width',(ulwidth+ulwidth)+20); $('#h2firmsbyname').css('width',(h2width+h2width+20)) </script> <?php } ?> </div> </body> <script> $('#Label2').width($('#Label1').width()); </script> <script type="text/javascript"> $().ready(function() { //$('#q').width($('#searchinfo').width()-($('#search').width()+20)); if($('#searchinfo').width()<300) $('#q').width(300); else $('#q').width($('#searchinfo').width()); }); function checkSrcoll() { x=$(document).scrollTop(); if(x){ $("#datadiv").append('<a href=\"#\" class=\"toplink\" style=\"\"><img src="images/arrow_up.gif" alt="Efst su" border=0/> <?php echo htmlspecialchars(isset($text[35])?$text[35]:__('Efst su'));?></a>'); } } </script> </html> I get this return. Array ( [0] => Array ( [compname] => [address] => [postcode] => IS-200 [communityname] => Kopavogur [rank] => 2 [company_id] => 14875 ) [1] => Array ( [compname] => Toyota Kopavogur [address] => [company_id] => 111686 [postcode] => IS-200 [communityname] => Kopavogur [rank] => 7 ) ) As you can see [1] the address is missing, and [0] most of it is missing lol. The data is all the in the MYSQL, I have made another script to echo it all out. I've been trying to solve this for ages now. The class for the search script is attached to this post, as it was too large to paste in here. If anyone has any ideas it would be very much appreciated. Many thanks, James. P.S; sorry to edit, I forgot to mention. The site has two languages, EN & IS it works perfectly in IS but not in EN. Confusing. [attachment deleted by admin]
  7. $q1 = "SELECT `data`, `data_2` FROM `firm_text_strings` WHERE `id` = '100' AND `languages_id` = 'EN'"; $r1 = mysql_query($q1); if($r1) { while($w1 = mysql_fetch_assoc($r1)) { $resultStr = $w1['data'] . '<br />' . $w1['data_2']; } } else { $resultStr = 'error'; } Changed, still nothing =/ Many thanks, James.
  8. Hmmm.... I didn't think of that. Let me change the code over, this is embarrassing...... lol. Many thanks, James.
  9. Hiya peeps! I have this code; $q3 = "SELECT `data` FROM `firm_text_strings` WHERE `id` = '100' AND `languages_id` = 'EN'"; $q4 = "SELECT `data_2` FROM `firm_text_strings` WHERE `id` = '100' AND `languages_id` = 'EN'"; $r3 = mysql_query($q3); $r4 = mysql_query($q4); if($r3 && $r4) { while($w3 = mysql_fetch_assoc($r3) && $w4 = mysql_fetch_assoc($r4)) { $resultStr = $w3['data'] . '<br />' . $w4['data_2']; } } else { $resultStr = 'error'; } everything is working up to the while function, it just wont do the loop for some reason. Anyone have any ideas. Many thanks, James.
  10. Hiya peeps, I was wondering if anyone could help. I have a search page that returns and array, if there are no results. It will either not exist or it will be empty. I was wondering how I would check this and if its not empty how I would count how many other arrays are inside it, as it will be array(array(1=>'1', 2=>'2')); if it is not empty, for instance. if(empty($searchObj->compResult) OR !isset($searchObj->compResult)) { echo 'its empty'; } else { $count = count($searchObj->compResult); } Many thanks, James.
  11. There is yes Thank you very much BlueSkyIS, your help has been very much appreciated. Many thanks, James.
  12. Sorry, I need to change it from company to addresses how would I go about this =/ Many thanks, James.
  13. You are a STAR! There isn't an avatar for a star but if there was it's yours! Thanks buddy much appreciated. Many many thanks, James.
  14. Hiya peeps, I have been sent this today; select company_map.*, map.*,addresses.address,addresses.nomitative,addresses.number, c.postcode from company_map join map on map.id=company_map.map_id join company c on c.company_id=company_map.company_id join addresses on addresses.address_id=c.address_id where company_map.company_id='79' and company_map.ui_shell_id <> 0 and language_id='en' when I print all the results from this I get a postcode, I was wondering if anyone could read this code and simplify it for me, I really need to know what table this query is pulling the postcode from. Many many thanks, James.
  15. Here is a test account for lanlords. Please login to the landlords test account with the credentials as follows; Username: test Password: test12
  16. Hiya ignace, I beleive I have sorted the menu issue, as for the news colums. I have no idea how I would change this LOL! But give me 15 and I shall try my best. I would appreciate it so much if you would kindly re-review the site and let me know any other feedback you have. Please login to the landlords test account with the credentials as follows; Username: test Password: test12 Many many thanks, James.
  17. Hiya! Thank you so much for your review, I'm pleased to say many issues with the site (including one's you have stated) have been fixed. It would be so very much appreciated if you would kindly re-review the site and give me your feedback on the revamp. Many many thanks, James.
  18. Does anyone have any ideas? I really need some help here. Many thanks, James.
  19. Any have any ideas? Any help will be much appreciated. Many thanks, James.
  20. Hiya! I have an issue, here is my code. <?php class generateInvoice { private $invoiceID; public function __construct($invoiceID) { $this->_INID = mysql_real_escape_string($invoiceID); } public function __drawInvoice() { $get_invoice = "SELECT * FROM `invoices` WHERE `id` = '$this->_INID' LIMIT 1"; $run_get_invoice = mysql_query($get_invoice); if($run_get_invoice) { if(mysql_num_rows($run_get_invoice) == 1) { while($invoice_m = mysql_fetch_assoc($run_get_invoice)) { if($invoice_m == 1) { $status = 'Awaiting Payment'; } elseif($invoice_m == 2) { $status = 'Paid'; } $items_mass = explode(',', $invoice_m['items']); foreach($items_mass as $item_key => $item_value) { $item_split = explode('-', $item_value); echo '<pre>' . print_r($item_split, true) . '</pre>'; foreach($item_split as $item_key_final => $item_value_final) { $invoice .= ' <tr class="item-row"> <td class="item-name"><div class="delete-wpr">' . $item_value_final[1] . '</div></td> <td class="description">THIS IS THE DESCRIPTION</td> <td><span class="cost">$650.00</span></td> <td><span class="qty">1</span></td> <td><span class="price">$650.00</span></td> </tr>'; } } } return $invoice; } else { return false; } } else { return false; } } } ?> This is what is displayed. Array ( [0] => 1 [1] => Test Product [2] => 6.99 [3] => 2 ) Array ( [0] => 5 [1] => Tester Product [2] => 600.99 [3] => 1 ) THIS IS THE DESCRIPTION $650.00 1 $650.00 e THIS IS THE DESCRIPTION $650.00 1 $650.00 . THIS IS THE DESCRIPTION $650.00 1 $650.00 THIS IS THE DESCRIPTION $650.00 1 $650.00 THIS IS THE DESCRIPTION $650.00 1 $650.00 e THIS IS THE DESCRIPTION $650.00 1 $650.00 0 THIS IS THE DESCRIPTION $650.00 1 $650.00 THIS IS THE DESCRIPTION $650.00 1 $650.00 I need it so that I can use each of the array's above and echo out each item (key) individually. I don't understand whats going wrong? Many thanks, James.
  21. Could people please tell me there reviews on what they think of my companys website. Heres the link. http://www.yourhomely.co.uk/ Many thanks, James.
  22. Anyone have any ideas? Many thanks, James.
  23. Hiya peeps! Here are my scripts; test.php <?php include 'formValidation.php'; $new = new formValidation( array( array( 'formname' => 'firstname', 'value' => 'james', 'options' => 'required, alllowercase, onlyletters', 'name' => 'First Name' ), array( 'formname' => 'password', 'value' => 'blahblah', 'options' => 'required, oneuppercase, alphanumerical', 'name' => 'Password' ), array( 'formname' => 'username', 'value' => 'blahblah', 'options' => 'required, oneuppercase, alphanumerical', 'name' => 'Username' ) ) ); ?> formValidation.php <?php class formValidation { private $inputs; function __construct($inputs = array()) { foreach($inputs as $input_key => $input_value) { foreach($input_value as $key => $value) { echo $value . '<br />'; } } } public function __prep($formname, $options, $value, $name) { echo $formname . ' ' . $options . ' ' . $value . ' ' . $name . '<br />'; } } ?> This outputs; firstname james required, alllowercase, onlyletters First Name password blahblah required, oneuppercase, alphanumerical Password username blahblah required, oneuppercase, alphanumerical Username But what i need to do is for every four values I need them to be sent to the __prep function. EG; $this->__prep('firstname', 'required, alllowercase, onlyletters', 'james', 'First Name'); I have no idea how to do this tho, I have tried a for() loop, another foreach loop, array the first four values then foreaching them again. I'm stuck, someone please help! Many thanks, James.
  24. You will need a dedi/vps server. * Can PHP handle this volume of traffic with multiple SELECTS, INSERTS etc - YES. * Can PHP ever crash due to overload or is it always the server which has the overload and crashes, if it's PHP, what can be done to stop that? - GENERALLY THE SERVER. * What would be the best way to hold user data? Is is best to spread the data over multiple tables - MYSQL. * Is there anything I should consider in PHP when working out a viable system - THERE ARE A LOT OF DEPRECIATED OR SLOW FUNCTIONS, AND ALSO CODE IN PHP5 AS IT IS GOOD WITH OOP. * Any advice on the type and level of server we should use - DEDI/VPS. James.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.