Jump to content

daydreamer

Members
  • Posts

    203
  • Joined

  • Last visited

    Never

Everything posted by daydreamer

  1. That page is helpful, i am aware of __LINE__, but the problem is I would need to know the line number where the function was called without passing __LINE__ as a argument. e.g. function mysql_query(){//override mysql_query mysql_query()or error_function(error_code,error_string,line_number); } mysql_query(); //<<< need to log this line number
  2. I am currently using my own error handler so i can log all mysql errors into a mysql table: mysql_query('select data from table')or trigger_error(mysql_error(),256); If there's an error i need to know the line number where the mysql_query function was called. Is it possible to instead use this code: mysql_query('select data from table'); but somehow transparently log a mysql error and the line number if there is an error in the query? thanks
  3. categories would be good, but i have to many products to manually sort... used sphinx search server in the end
  4. similar items, so if a user is viewing one item i can suggest similar items to compare
  5. I have a database table of product titles. For each product, I want to link 10-20 similar products, ordered by relevance. For example: db.products IDTitle 1White Paint, Quick Dry 2Yellow light bulb >50000.... db.product_similarity IDPIDsimular_to_PIDrank 11221 213222 Anybody have any suggestions about how I could go about this? The main concern is quality/relevance and accuracy. thanks.
  6. This maybe useful: http://www.askapache.com/htaccess/sending-post-form-data-with-php-curl.html Try this: 1. install live http headers firefox plugin. 2. login with your browser. 3. view the initial first post, and see the post contents. It will be in this format: username=yourusername&password=yourpassword&otherstuff...... 4. the above post is what you need to replicate with your PHP script using cURL. 5. Login with cURL (enable cURL cookies) using PHP, then try to download the file you are after. It should work as you now have authenticated yourself to the server you are downloading from.
  7. I agree and prefer to use mysql_real_escape_string, but a site I am working on has their own escape function, that also replaces ' and " so that if data is taken out, processed in some way and then put back into a table (if it contained a ') it will not have to be escaped again. I just wondered how secure it is.
  8. Is not using mysql_real_escape_string before putting strings into a mysql query a security problem if you apply the following steps before: 1. take out all ' and ". 2. apply stripslashes(); 3. apply http://uk2.php.net/manual/en/function.addslashes.php 4. put the string between apostrophes: insert into table set column='user entered string' Thanks any opinions appreciated
  9. Code 4 detailspage.php: $user_id=mysql_real_escape_string($_GET['user_id']); $userinfo=mysql_query(SELECT * FROM users WHERE id=$user_id)
  10. http://www.sphinxsearch.com/ is good if your on a linux server and can install stuff. its much faster than like apparently. I have set it up its quite easy to do.
  11. use curly braces: <?php while(..){ if(...){ }else{ } } ?> Although I would recommend learning how to pull just the data you need using the mysql query, using a WHERE clause.
  12. <h1 id=unique>kdjkjd dwekjnd wk</h1> <div> match any whole sentences between the h1 and script tags only </div> <script> How would I match the whole sentences in this scenario? I am having trouble writing a reg ex for 'match from h1 to script tag'. This will match data between the tags, but it includes line breaks (which I dont need): >[^<]*\b([\s0-9a-zA-Z]+)[^<]*< Cheers
  13. A prices table will list the prices of products, and will be updated often. Prices id product_id qty price timestamp Each product ID will have multiple entry's. What I want to select is the newest entry's for each unique combination of 'product_id' and 'qty'. How do I fit max(timestamp) in with this query: (SELECT DISTINCT product_id, qty FROM prices)? Thanks
  14. Here is some code I wrote a while back for the same feature. Works like this: script.php?src=yourimage.jpg Then you can put that in an img html tag: <img src="script.php?src=youimage.jpg" /> <?php header('content-type: image/jpeg'); $watermark = imagecreatefromgif('watermark.gif'); //your watermark image. $watermark_width = imagesx($watermark); $watermark_height = imagesy($watermark); $image = imagecreatetruecolor($watermark_width, $watermark_height); $image = imagecreatefromjpeg("imageuploads/".$_GET['src']); // change to location of file. $get[src] is just the file name and extensions. e.g filename.jpg $size = getimagesize("imageuploads/".$_GET['src']); $dest_x = $size[0] - $watermark_width - 5; $dest_y = $size[1] - $watermark_height - 5; imagecopymerge($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, 100); imagejpeg($image); imagedestroy($image); imagedestroy($watermark); ?>
  15. Thanks for the link PFMaBiSmAd, did look at that page wasnt sure if I was able to use that method. Thanks alot this worked a treat
  16. Hi, I have a table like this: ---Prices--- Price Product ID Supplier ID Timestamp 44 1 2 45 1 2 40 1 3 I am trying to select the latest price for each supplier for a given product ID. This is what I have: $result = mysql_query("SELECT * FROM prices WHERE product_id='$id' ORDER BY price desc")or die(mysql_error()); I have tried a few things like group by, and distinct but cannot get the exact data set I need. How would I do this?
  17. Thanks for the solutions, my actual SQL had a left join in it so the normal SELECT ID, MIN(Price) FROM tblPrices GROUP BY Product ID wasnt working. This sorted it, Cheers
  18. something like <?php $unencrypted="hey"; $encrypted=md5($unencrypted); // save this into your database ?> Then when they login, convert what they input to md5, and check against what you have saved in your DB. search google for "md5 PHP"
  19. Hi, I have a table: ---tblPrices--- ID, Price, Product ID 1 22 106 2 25 106 3 19 106 4 88 107 5 77 107 I want to select only the lowest price for each unique product ID in one SQL call, how do I do it?! Thanks.
  20. Hi, I am trying to send a SOAP request but I am getting an error: "SoapFault exception: [soap:Server] Server was unable to process request. ---> Object reference not set to an instance of an object." Here is my code: <?php $wsdl="https://testweb.commidea.com/PayerAuth/PayerAuth.asmx?wsdl"; $client=new SoapClient($wsdl, array( "trace" => 1, "exceptions" => 0)); $a['MerchantDetails']['AccountID']='22'; echo $client->EnrollmentCheck($a); ?> How am I supposed to be sending the request? Any help much appreciated.
  21. Thanks, but it was a coding error. I put an exit in my code to stop it at 20 loops to prevent me accidentally running the full script, but then I forgot to remove it. It is an Awesome feature...
  22. Tried running it from the windows command line no luck. Cannot find any apache settings for timeouts.
×
×
  • 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.