Jump to content

s0c0

Members
  • Posts

    422
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://www.cnizz.com

Profile Information

  • Gender
    Male
  • Location
    SLC - US

s0c0's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. Hello, I receive the following FATAL error: json_encode() [<a href='function.json-encode'>function.json-encode</a>]: Invalid UTF-8 sequence in argument Here is the code: echo json_encode($cart->get_products()); get_products returns an array even if its just an empty array. Does anyone have any experience with this or seen it before. Couldn't find any solutions through googling around and am wondering if I need pass the encoded data through something like http://www.php.net/manual/en/function.utf8-encode.php Please advise.
  2. data is not very sensitive, going to use a rotating character algorithm, never mind.
  3. I need a simple two-way encryption algorithm that does not require mcrypt. What did PHP use for 2ways prior to mcrypt? The reason for this is installing mcrypt on our production server requires a recompile of PHP and I'm not keen on doing that on a production server. Security and bit-length of the algo is not that important. Please advise.
  4. That cannot be the entire code because I don't see a query...you should invest in a book.
  5. s0c0

    Query Help

    If I understand what you are looking to accomplish here is some pseudo code that will help. Avoid looping through a result set and issueing a query each time. Instead utilize the IN and NOT IN operators in this case. $q1 = "SELECT storyId FROM ratings WHERE username='".$session->username."'; // store q1 in an array lets call that $storyArr $q2 = "SELECT username FROM ratings WHERE username NOT IN ('$session->username','Anonymous') AND storyId IN (".implode(',',$storyArr).")"; // $q2 is what you need and will have a list of compatible users...
  6. Marked solved for impossibility...back to the drawing board, thanks.
  7. If you are having difficulty with this it may behoove you to pick up a beginners MySQL/PHP book. Alls you are doing is taking a POST value, doing a query against the database, multiplying the two values, and displaying the result to the user.
  8. I am not sure why you would want to, but an inelegant solution would be to use the substr() function to remove the first character if the first character is equal to zero.
  9. I think I will have to write some code or a very fancy query to accomplish this, but thought I would ask. We have a log that stores changes to tables. The field_name is the column name, the name_table is the table name, and the name_pk is the primary key. id_row is the value for the primary key and the snapshot is what the value was. I am able to select the snapshot, but within the same query I would like to return what the current value is. Below I attempt using udv's within a sub query, but I don't believe MySQL will support this. Of course I try to do it without code and without multiple queries first, prospects look dismal. Any suggestions? SELECT @field:= field_name, id_row, change_type, @tbl:= name_table, @pk:= name_pk, snapshot, (SELECT @field FROM @tbl WHERE @pk = log_record_change.id_row) as current_value FROM log_record_change INNER JOIN log_field_change ON log_field_change.id_record_change = log_record_change.id INNER JOIN log_table ON log_table.id = log_record_change.id_table WHERE log_record_change.id_change = 36
  10. True that might be overkill. I learned how to program and about mysql from this book http://www.amazon.com/PHP-MySQL-Web-Development-4th/dp/0672329166/ref=sr_1_1?ie=UTF8&qid=1291051671&sr=8-1 albeit that was 5 years ago. Still gave me a solid start and was easy enough to read for a tech savy network admin with limited programming/database experience.
  11. Did you try googling that error? Did you see if there is more information in your php/iis error logs? Sorry, most on here likely run the LAMP stack.
  12. Hi is just asking for recommendations for reading material... not specific help. Read High Performance MySQL, its my fav and written my the guys over at mysqlperformanceblog.com. Make sure you get the most recent edition possible. I've got some pretty sweet information on my blog as well.
  13. I assume the slow down is in LOOKUPS. Pikachu is correct, 35k or even 10x that amount is nothing for a database. Please post your create table syntax and an example of a typical record in there.
  14. I'm with fenway on this, why do you need to do this? For whatever reason you would want to do this, you could put this logic in your applications code.
  15. Interestingly enough High Performance MySQL has a chapter on query/index optimization that has an example VERY similar to your post. Just found that kinda interesting.
×
×
  • 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.