problem with php mysql query....sos

Reply

Join Date: May 2009
Posts: 5
Reputation: anna05 is an unknown quantity at this point 
Solved Threads: 0
anna05 anna05 is offline Offline
Newbie Poster

problem with php mysql query....sos

 
0
  #1
May 20th, 2009
  1. <?php
  2. if ($_SERVER['REQUEST_METHOD'] == 'POST'){
  3. $getLima=$_POST['Onoma'];
  4. include "connect.php";
  5.  
  6.  
  7. $rsSelectOnomata=mysql_query("SELECT * FROM titloslimmatos WHERE LimmatikosTypos='$getLima'");
  8. //$result=mysql_query($query);
  9.  
  10.  
  11.  
  12. while($rsRow=mysql_fetch_assoc($rsSelectOnomata)) {
  13.  
  14. echo $rsRow[titloslimmatos.LimmatikosTypos];
  15. $rsRow[titloslimmatos.MerosLogoy];
  16. $rsRow[titloslimmatos.YfologikoEpipedo];
  17. $rsRow[titloslimmatos.GlwssikoEpipedo];
  18. //$rsRow[extralimmatikoitypoi.ExtraLimmatikosTypos];
  19. //$rsRow[extralimmatikoitypoi.YfologikoEpipedo];
  20. //$rsRow[Simasia.XrisiLeksis];
  21. //$rsRow[synonimo.Synonimo];
  22. //$rsRow[synonimo.Example];
  23. //$rsRow[antitheto.Antitheto];
  24. //$rsRow[antitheto.Example];
  25. }
  26.  
  27.  
  28. }
  29. else {
  30. ?>
  31. <html>
  32. <body bgcolor="#FFFFCC">
  33. <h3><center><b>Δώστε το λήμμα που ψάχνετε</b></center></h3>
  34.  
  35. <table>
  36. <form method="post" action="<? echo $PHP_SELF ?>">
  37. <input name="onoma" type="text">
  38. <input type="Submit" name="set" >
  39. </form>
  40. </table>
  41.  
  42. </body>
  43. </html>
  44. <?
  45. }
  46. ?>
Last edited by Ezzaral; May 20th, 2009 at 10:44 pm. Reason: Added [code] [/code] tags. Please use them to format any code that you post.
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 524
Reputation: Will Gresham is on a distinguished road 
Solved Threads: 86
Sponsor
Will Gresham's Avatar
Will Gresham Will Gresham is offline Offline
Posting Pro

Re: problem with php mysql query....sos

 
0
  #2
May 20th, 2009
Might help to state what the problem is. I don't want to sit here looking through your code without knowing what I am looking for.

Also, use code tags.
AJAX is not a programming language, scripting language or any other sort of language.
It is acheived by using JavaScript http functions.
So, AJAX = JavaScript.
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 5
Reputation: anna05 is an unknown quantity at this point 
Solved Threads: 0
anna05 anna05 is offline Offline
Newbie Poster

Re: problem with php mysql query....sos

 
0
  #3
May 21st, 2009
i want to make a site on line dictionary, i use the programm xampp,
when i run this code (localhost) and insert a word that exist in my database the result is a blank page...
can someone help me? its emergency!

also sometimes when i run this code it's show me:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\index.php on line 12
Last edited by anna05; May 21st, 2009 at 1:06 pm.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,760
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 332
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: problem with php mysql query....sos

 
0
  #4
May 21st, 2009
Print and execute the query in phpmyadmin / mysql console. Check the error message.
OR
Use
  1. $rsSelectOnomata=mysql_query("SELECT * FROM titloslimmatos WHERE LimmatikosTypos='$getLima'") or die(mysql_error());
This will print the error message on failure. This is good for testing purpose (and not in the production environment as it exposes your table structure and all that!)
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 524
Reputation: Will Gresham is on a distinguished road 
Solved Threads: 86
Sponsor
Will Gresham's Avatar
Will Gresham Will Gresham is offline Offline
Posting Pro

Re: problem with php mysql query....sos

 
0
  #5
May 21st, 2009
What nav33n said.

Also, if you want to search for values which I guess you will do for a dictionary, look into the LIKE operator for your SQL query.
AJAX is not a programming language, scripting language or any other sort of language.
It is acheived by using JavaScript http functions.
So, AJAX = JavaScript.
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 5
Reputation: anna05 is an unknown quantity at this point 
Solved Threads: 0
anna05 anna05 is offline Offline
Newbie Poster

Re: problem with php mysql query....sos

 
0
  #6
May 21st, 2009
index.php

  1. <?php
  2. if ($_SERVER['REQUEST_METHOD'] == 'POST'){
  3. $getLima=$_POST['Onoma'];
  4. include "connect.php";
  5.  
  6.  
  7. $rsSelectOnomata=mysql_query("SELECT * FROM titloslimmatos WHERE LimmatikosTypos='$getLima'") or
  8.  
  9. die(mysql_error());
  10. $result1=mysql_query($query);
  11.  
  12.  
  13.  
  14. while($rsRow=mysql_fetch_assoc($rsSelectOnomata)) {
  15.  
  16. echo $rsRow[titloslimmatos.LimmatikosTypos];
  17. $rsRow[titloslimmatos.MerosLogoy];
  18. $rsRow[titloslimmatos.YfologikoEpipedo];
  19. $rsRow[titloslimmatos.GlwssikoEpipedo];
  20. //$rsRow[extralimmatikoitypoi.ExtraLimmatikosTypos];
  21. //$rsRow[extralimmatikoitypoi.YfologikoEpipedo];
  22. //$rsRow[Simasia.XrisiLeksis];
  23. //$rsRow[synonimo.Synonimo];
  24. //$rsRow[synonimo.Example];
  25. //$rsRow[antitheto.Antitheto];
  26. //$rsRow[antitheto.Example];
  27. }
  28.  
  29.  
  30. }
  31. else {
  32. ?>
  33. <html>
  34. <body bgcolor="#FFFFCC">
  35. <h3><center><b>Δώστε το λήμμα που ψάχνετε</b></center></h3>
  36.  
  37. <table>
  38. <form method="post" action="<? echo $PHP_SELF ?>">
  39. <input name="onoma" type="text">
  40. <input type="Submit" name="set" >
  41. </form>
  42. </table>
  43.  
  44. </body>
  45. </html>
  46. <?
  47. }
  48. ?>

-------------------------------------------------------------
connect.php

  1. <?php
  2. $link = mysql_connect('localhost', 'root', '');
  3. if (!$link) {
  4. die('Could not connect: ' . mysql_error());
  5. }
  6. echo 'Connected successfully';
  7. mysql_close($link);
  8. ?>

when i run the file index.php the result was:
Connected successfully No database selected

any idea please?
Last edited by Ezzaral; May 21st, 2009 at 4:02 pm. Reason: Added [code] [/code] tags. Please use them to format any code that you post.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,760
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 332
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: problem with php mysql query....sos

 
0
  #7
May 21st, 2009
Yeah. You don't have mysql_select_db("Databasename"); in your script.
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 1,407
Reputation: ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light 
Solved Threads: 226
Sponsor
ShawnCplus's Avatar
ShawnCplus ShawnCplus is offline Offline
Code Monkey

Re: problem with php mysql query....sos

 
0
  #8
May 21st, 2009
Why oh why did I even bother writing the FAQ that answers this very issue if no one is going to read it? It never stops baffling me when I see these posts.
GCS d- s+ a-->? C++(++++) UL+++ P+>+++ L+++ E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 5
Reputation: anna05 is an unknown quantity at this point 
Solved Threads: 0
anna05 anna05 is offline Offline
Newbie Poster

Re: problem with php mysql query....sos

 
0
  #9
May 21st, 2009
sorry.. that was by mistake...

the code of connect.php is:

  1. <?php
  2. $link = mysql_connect('localhost', 'root', '');
  3. if (!$link) {
  4. die('Could not connect: ' . mysql_error());
  5. }
  6. echo 'Connected successfully';
  7.  
  8. mysql_select_db("annadb");
  9.  
  10. //mysql_close($link);
  11. ?>

i run again the file index.php and the result was:
Connected successfully

whay it doesn't show me the word that i insert?
Last edited by Ezzaral; May 21st, 2009 at 4:01 pm. Reason: Added [code] [/code] tags. Please use them to format any code that you post.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,760
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 332
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: problem with php mysql query....sos

 
0
  #10
May 21st, 2009
Originally Posted by ShawnCplus View Post
Why oh why did I even bother writing the FAQ that answers this very issue if no one is going to read it? It never stops baffling me when I see these posts.
Newbies prefer to skip the first post I believe ! Sigh.
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC