Jump to content

c_pattle

Members
  • Posts

    295
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

c_pattle's Achievements

Advanced Member

Advanced Member (4/5)

0

Reputation

  1. I have a .sql file that has the following in it DROP TABLE IF EXISTS `flights`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `flights` ( `flight_id` int(11) NOT NULL AUTO_INCREMENT, `flight_icon` int(11) NOT NULL, `flight_path` int(11) NOT NULL, `flight_from` int(11) NOT NULL, `flight_to` int(11) NOT NULL, PRIMARY KEY (`flight_id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; I have read the contents of the file using file_get_contents. I was wondering what is the best way to strip out everything before "CREATE TABLE" and everything after "CHARSET=latin1"? Does anyone have any suggestions on the best way to do it? Thanks
  2. I was just wondering if anyone knows what the most efficient way of checking to see if two tables contain matching records. So for example I have a table called 'orders' which have a primary key of order_id. Then I have a table called 'order_comments' which also has a field called order_id and I want to run a query that will check which orders don't have entries in order_comments. Thanks for any help
  3. I have a php script that needs to replace trademark symbols in a string. At the moment it works by doing str_replace(™, '', $string); This works when I have tested it on Windows but is this a bad way of doing it? I'm guessing it is. Does anyone know a better way. I know I could convert the string to html entities and then replace the html code but I don't want to do this as there are other things in the string I don't want to convert to html entities. Thanks
  4. I've began work on a project recently and all of the password in the database have been encryped using the mysql password function. I was just wonder if there is a PHP function that is equalivalent to that. So the PHP function will return the same result as they mysql function? Thanks for any help
  5. I have a .sql file that has lots of sql commands in it. What I want to do is then run all of these commands on a database. I was just wondering what the best approach would be. Is there a way to import the file or am I best opening the file, reading each line and then performing that query? Thanks for any help.
  6. I have a checkout section of my website where the user can apply coupons code to certain items in the cart. When the user enters a coupon code it changes the price of the item in the cart. Because you can't just update the price I am deleting the old cart item and then re inserting it. However when I do this some of the items don't seem to get re-inserted. I think it's the items with things like brackets in the product name. My code is below //Create an array of product details $newItem = array( 'id' => $items['id'], 'name' => $items['name'], 'qty' => $items['qty'], 'price' => number_format($newPrice, 2), 'supplier' => $items['supplier'], 'coupon' => $coupon, 'full_price' => $items['price'], 'type' => $items['type'] ); //Create an array to remove the item from the cart $data = array( 'rowid' => $items['rowid'], 'qty' => '0' ); $this->cart->product_name_rules = '[:print:]'; //Remove the item then re-insert it $this->cart->insert($newItem); $this->cart->update($data); Can anyone see what I'm doing wrong? Thanks for any help
  7. In my core controller I'm trying to create an array of the user's history. I am creating an array and then setting the key as the time and the value as the page URL. However the problem that I'm having is that the previous array seems to get overwritten so there is only ever one key and value pair in the array. How can I do it so that instead each page will get appended to the array $history = array( time() => curPageURL() ); $this->session->set_userdata('history', $history); Thanks for any help
  8. Also I've made sure that its not a permissions problem by giving the text file 777 permissions
  9. I have the following form the just has one field. <html> <head> <title>Post</title> </head> <body> <form action="worldpay_callback.php" method="post"> <input type="text" name="username" id="username" /> <input type="submit" name="submit" id="submit" value="send" /> </form> </body> </html> I am then posting the form to the following page that is meant to loop through all of the post values and save them to a text file. For some reason my foreach loop doesn't seem to be working as done of the post values are getting written to the text file. Can anyone see anything I'm doing wrong? $myFile ="notifications.txt"; $fh = fopen($myFile, 'w+') or die("can't open file"); foreach($_POST as $k=>$v) { $data = 'POST: Key:'.$k.' - Value:'.$v ." \n"; fwrite($fh, $data); } fclose($fh); return "[OK]"; Thanks for any help
  10. So for example I want to run a query that performs a full text on a field orders by relevance and returns the results. Then on the results I've got from that query I want to perform another query to order the results by price. I tried doing 2 orders by on the first query but that didn't work because althought it did order them by price I got not very relevant results
  11. I was just wondering if it's possible to run a query on data that has been returned from a previous query? For example, if I do $sql = 'My query'; $rs = mysql_query($sql, $mysql_conn); Is it then possible to run a second query on this data such as $sql = 'My query'; $secondrs = mysql_query($sql, $rs, $mysql_conn); Thanks for any help
  12. I have an image uploader that works well and stores the name of the file uploaded in a session. Once the files has been uploaded how do I then rename that file? I would rename it during the uploaded but I need to rename it to an order number and I only get that order number after the image has been uploaded. Thanks for any help.
  13. I'm in the process of building an e-commerce website but am unsure on the best way to accept payments. I've looked into Paypal and using their IPN system but I think thats only paypal to paypal payments. Does anyone have any experience of accepting credit card payments online and can recommend a certain path to go down? Thanks
  14. I'm currently developing an e-commerce website and I've been asked to integrate a live chat tool into the website. I was just wondering if anyone here has done something similar and would reccomend a certain path go down? Thanks for any help.
  15. I have a form with a file input field to allow users to upload image files. <input id="petPhoto" type="file" value="photo" name="petPhoto"> The problem I'm having is that I can't get the value in this field when the form is submitted (e.g images/fileimage.jpg). In my controller I have the following line to try to get the value but when I do a var dump on it, it just returns false. $petPhoto = $this->input->post('petPhoto'); Does anyone know what I'm doing wrong?
×
×
  • 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.