Jump to content

Germaris

Members
  • Posts

    97
  • Joined

  • Last visited

About Germaris

  • Birthday 04/08/1941

Profile Information

  • Gender
    Male
  • Location
    Canada

Germaris's Achievements

Member

Member (2/5)

0

Reputation

  1. 05:00AM... Tough to read... Oh là là... Please, cool it! Hey, fellows, this isn't a war... We all are on a forum to exchange our points of view and opinions. Nothing more, nothing less... To "Jessica": I never stated you must fetch before to get the number of rows. I stated you must fetch before to get some data for the variable "$flashstr". Did you give your script a try? Me too I'm curious to see the output you got. Despite what you have written, I gave a try to your script. It didn't work, exactly because of the reason I told you : You didn't define the variable "$flashstr". To "cpd" and "Jessica": As my project (for this function) is at its very beginning, the table contains only a dozen of rows. I know their content almost by heart... I'm working on my own server and have full access to my databases and all their tables. So, it isn't difficult for me to see if the outputs I get are okay or not. I gave a try to your suggestion to add columns to SELECT and, as I predicted, it didn't change anything. To "PFMaBiSmAd": My first posting contained all which was necessary to determine if the script should work or not. I worked meanwhile you posted and didn't necessary have the time to post all the verifications I did. And I also have, like all of you, a familily life. Even at the age of 72. It didn't mean I was ignoring advices and suggestions from the members partipating to this discussion. To "shlumph": Your script is very well wrote and worked nice. I gave it a try replacing the sent variables by their actual values. It comforted me in my opinion that my own script was good. Conclusion: After having the proof that my PHP Script was good, I made a deep investigation of my Flash .fla file. Debugging shown that Flash had a misinterpretation of the PHP output it received. The error was in Flash, not in PHP!!! And the error was due to a human error. Mea culpa. For who is still interested, look at my PHP Test in action and the script at the end of this post. You can see the results at: http://www.notre-annuaire.com/strict/photos.php I want to thank you all very much for your interest and the time you dedicated to my problem even if I had the sensation some were irritated by my apparent lack of interest for their posts. Best regards. PS: English isn't my native language, please excuse my mistakes. ---------------------------------------------------------------------------- My Test script as follows: <?php include "key.php"; $link = mysql_connect( $host ,$user ,$pass); if (!$link) { die("&erreur=Connexion impossible avec le serveur : " . mysql_error()); } $db_selected = mysql_select_db( $db, $link); if (!$db_selected) { die ($db." inutilisable : " . mysql_error()); } $table = "_files"; $courriel = "myemailaddress@xxxxxx.com"; // here, of course, my real email address $sql =mysql_query("SELECT * FROM $table WHERE email = '$courriel'AND ok = '1' ORDER BY id DESC LIMIT 0 , 3") or die("&erreur=Échec de la requête !"); if ( mysql_num_rows($sql) > 0) { while ($row =mysql_fetch_array ($sql)) { $flashstr .= $row['img_name']."|"; } print "&erreur="."&nombre=".mysql_num_rows($sql)."&liste=".$flashstr; } else { print "&erreur=Pas de photos présentes pour cet utilisateur."; } ?>
  2. It couldn't work because you have first to fetch the result and, foremost, you should define the $flashstr variable... And even if you define it, this couldn't work that way... Thanks any way for responding! Question remains: Why the script outputs a wrong number of rows (3 instead of 2)?
  3. Grrr... Some terms in the script are in french, that's why I didn't post everything... Here is the actual and full script for this function excerpt from the general script (2500 lines!!!) <?php function photo_history_bypaths($courriel) { $table = "_files"; $courriel = trim($courriel); $sql =mysql_query("SELECT img_name FROM $table WHERE email = '$courriel'AND ok = '1' ORDER BY id DESC LIMIT 0 , 3") or die("&erreur=Échec de la requête !"); if ( mysql_num_rows($sql) > 0) { while ($row =mysql_fetch_array ($sql)) { $flashstr .= $row['img_name']."|"; } print "&erreur="."&nombre=".mysql_num_rows($sql)."&liste=".$flashstr; } else { print "&erreur=Pas de photos présentes pour cet utilisateur."; } } ?> The script works nice. My only problem is: Why it outputs a wrong number of rows (3 instead of 2)? I tried the query in phpMyAdmin with known parameter (my actual email) and it outputs two rows with the expected image names.
  4. Thanks PFMaBISmAd and cpd for responding. Actual output is as I wrote: numberOfRows : 3 myArray : two image names (as expected) Fields in my Flash application display the right information about the array and in the expected order : element1|element2| with no extra space and nothing after the last "|" glyph To "cpd" = I don't understand how useful will be to select the "email" column in the query. Would you please explain? Best regards to both of you!
  5. Hi there! This query : PHP Code: SELECT img_name FROM $table WHERE email = '$email' AND ok = '1' ORDER BY id DESC LIMIT 0 , 3") or die("&error=Failed !"); is supposed to return a 2 element array (as I already know the content of $table satisfying to the query statements) "ok" is a column which content is 1 (valid image) or 0 (invalid image) there's 3 rows containing the required $email and only two where ok='1' Statement PHP Code: if ( mysql_num_rows($sql) > 0) { while ($row =mysql_fetch_array ($sql)) { $array .= $row['img_name']."|"; } print "&numberOfRows=".mysql_num_rows($sql)."&myArray=".$array; } else { print "&error=No images found."; } returns a wrong number of rows (3 instead of 2) but a right array !!!??? Why? Many thanks for your advices, remarks and suggestions!
  6. You are right. I thought first to add to security... But it's true, "trim" is useless.
  7. (1)Yes it is. (2)Already done since my first post and no error reported. Mystery...
  8. You are wrong. Only uppercases, lowercases and numbers are allowed. And my form verification reject any user name or password containing anything else (including spaces) More than 4700 users have registered through almost nine years and no one has ever complained of a rejected credential...
  9. Thanks for replying mrMarcus! During registration, I already warned that only Uppercases, Lowercases and Number can be used and a verification process insure this. However, as it is possible for the user to mistakingly enter a space when typing the credentials, I prefer to trim them. (and it's not messing with them...) For more on my problem please read my reply to Christian...
  10. Thanks for your interest in my concerns. I simply have no result at all when using this function inside a very larger script grouping all the functions I use to make a Flash SWF to communicate with a MySQL Database. I made a simple script for testing purpose using the same function I posted here and... it works! You can have a look at the result at: http://www.notre-annuaire.com/strict/try_synchro.php (the only difference is the language (french) "donnees_utilisateur" stands for "mydata") As you can see, the result is presented in clear text. Why can't I get it when the function is integrated in the larger script is a mystery... I made multiple verifications and scripts are good on both sides (Flash AS and PHP)... PS: About the article, I think I use the fair language for a newby. If not, simply ignore my postings... :-)
  11. Thank you very much, Christian, for replying. Besides all security concerns which (as important as they are for sure), I thought I was clear enough with the simple title I've chosen... My problem is : "From this sql query, how can I output an array containing all the results of the query in the order I enumerated them and separated with the specified delimiter?"
  12. Hi there! I wish to output an array. In my PHP Script, I wrote this: function synchrouser($user,$pass) { $user = trim($user); $pass = md5(trim($pass)); $table = '_a_users'; $query ="SELECT * FROM $table WHERE userName='$user' AND userPassword='$pass'"; $myresult =mysql_query($query); $mydata = ""; while ($row =mysql_fetch_array($myresult)) { $lastName = $row["lastName"]; $firstName = $row["firstName"]; $school = $row["school"]; $promoYear = $row["promo"]; $exitYear = $row["promoOut"]; $promoNumber = $row["promoNum"]; $email = $row["email"]; //insertion of a "|" delimiter $mydata .= "|".$lastName."|".$firstName."|".$school."|".$promoYear."|".$exitYear."|".$promoNumber."|".$email; print "&mydata=".$mydata; } } What's wrong in this coding? Many thanks in advance for your help!
  13. This was too simple for my tired mind !!! Thank you SO MUCH !
  14. Hi there ! I maintain a database of former students (more than 32000 entries). I wish to build a query to retrieve in lastName field all and only the two letter names it contains. Something like: $query =mysql_query ("SELECT school, lastName, firstName, promo, region, gone FROM $table WHERE lastName LIKE XXXXXX ORDER BY lastName, firstName, school, promo" ) What should I write where the XXXXXX are? Sorry to be somehow... stupid! And many thanks in advance for your help!
  15. It was just a joke. :-) Didn't want to offend anybody...
×
×
  • 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.