Jump to content

SyLon

Members
  • Posts

    19
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

SyLon's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I know it would work. But I need to get a result based on TWO queries at a time. Let's say I have 2 vars: $q1 and $q2. Each contains a query. I want to run them both and get ONE result based on those queries. Theoretically something like this: mysql_query($q1,$q2) or die(mysql_error()); The result I would get will mach the two queries $q1 and $q2. I hope its clear now. Thanks.
  2. Hello every one. How can I get a result based on multiple queries? For example: query 1: select * from users where user_id=3346 query 2: select * from users where reg_date=$time I would like to receive a result similar to the result I would get if I would run this query: select * from users where user_id=3346 AND reg_date=$time Is that possible? Thanks in advance, Leon.
  3. So it would look like this? function _INPUT($name) { if ($_SERVER['REQUEST_METHOD'] == 'GET') //return mysql_real_escape_string(strip_tags($_GET[$name])); return mysql_real_escape_string(htmlentities($_GET[$name], ENT_QUOTES)); if ($_SERVER['REQUEST_METHOD'] == 'POST') //return mysql_real_escape_string(strip_tags($_POST[$name])); return mysql_real_escape_string(htmlentities($_POST[$name], ENT_QUOTES)); } Also, what do you think about the _STR function? Thanks, Leon.
  4. Hello everyone! After reading some php security articles, I've created 2 function to prevent sql injection and display html tags correctly. The first one is for user input formatting: function _INPUT($name) { if ($_SERVER['REQUEST_METHOD'] == 'GET') return mysql_real_escape_string(strip_tags($_GET[$name])); if ($_SERVER['REQUEST_METHOD'] == 'POST') return mysql_real_escape_string(strip_tags($_POST[$name])); } The second one is for output: function _STR($string) { return nl2br(htmlspecialchars(stripcslashes($string))); } What do you think about those two function? Will they provide the maximum security for my websites? Thanks, Leon.
  5. Hello everyone. Is there a way to go over each member of a given object using a foreach loop for example?? Here is an theoretical example: foreach( object_members($object) as $object_name->$value ) { echo $object_name.": ".$value; } OR foreach( objects_member_names($object) as $member_name ) { echo $member_name.": ".$object->$member_name; } I hope you an help me Thanks, Leon.
  6. Yes they are.. The table structure, as well as the values were created and inserted using PhpMyAdmin's GUI (i.e. NOT by writing the sql). Also, I must point out that when trying to edit the values, They show up fine (in normal English letters) Anyway, Some body told me that this is the way it should be. I would be glad if someone would create the same table structure and see if he gets the same thing. Oh and by the way, I used the utf8_unicode_ci encoding (the last one on the list) Thanks.
  7. Here is a screenshot of the structure:
  8. Hello. I have a little problem: I've tried some encodings for my mysql tables but every time the same thing happens: In PhpMyAdmin, when browsing it shows this kind of values: What's wrong?? P.S. I need an encoding that will support Hebrew,English and Russian inputs. Thanks in advance, Leon.
  9. Hi! I'm looking for a good editor with code completion for PHP classes - But for the Mac. I tried EasyEclipse PHP but It doesn't seem to have any code completion for classes. I also found a great editor called TSWebEditor (http://tswebeditor.net.tc/) But it's for PC's only. Does anyone knows of a good editor or how to make EasyEclipse for PHP to support code completion for classes? Thanks in advance, Leon.
  10. Is that possible? Cause when I'm trying to do that, PHPMyAdmin shows me this error: #1170 - BLOB/TEXT column 'fff' used in key specification without a key length Thanks.
  11. Problem solved! I put the query inside the foreach loop, like that: (It's a function and $query is a parameter) foreach($tag as $k=>$v) { $query2=mysql_query($query); while( $row=mysql_fetch_assoc($query2)) { $post_tags=return_tags_by_id($row['id']); if( in_array($v,$post_tags) && !in_array($row['id'],$matching_posts) ) { $matching_posts[]=$row['id']; } } # while } # foreach Thanks for helping guys! ohh, by the way, whats the difference between mysql_fetch_assoc() and mysql_fetch_array() ?
  12. $vid=$_GET['vid']; DOES worked. You only added an echo function to output it..
  13. hi This code should return me an array with posts IDs who match the $tag (array), so here what I did: foreach($tag as $k=>$v) { while( $row=mysql_fetch_assoc($query)) { show($row['id'].$v); $post_tags=return_tags_by_id($row['id']); if( in_array($v,$post_tags) && !in_array($row['id'],$matching_posts) ) { $matching_posts[]=$row['id']; } } # while } # foreach After some testing I figured out that the while loop is getting looped only once - only at the first time, while the foreach loop is fine. it seems like $row != mysql_fetch_assoc($query) after the first loop, so I tried to unset($row) at the beginning of each foreach loop but it doesn't work. I'm pretty sure that there is something wrong with my while loop, but what?? Hope you can help, Thanks!
×
×
  • 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.