Jump to content

christo

Members
  • Posts

    32
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

christo's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. That's it you were right about putting it in the form ! i changed the script too and at least i have the alert now! I still have some probs  like : Warning: mysql_connect(): Can't connect to MySQL server on 'localhost' (10061) in c:\program files\easyphp1-8\www\search.php on line 57 Erreur de connection avec MySQL ! Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in c:\program files\easyphp1-8\www\search.php on line 58 Erreur connection avec la DB ! Warning: mysql_query(): Can't connect to MySQL server on 'localhost' (10061) in c:\program files\easyphp1-8\www\search.php on line 68 That might be that i have to configure easyphp  ???
  2. but in the form i have already the action for the php script, where/ can i add this too ?
  3. the problem with the onClick is that if the user hits enter at the keyboard and not use the mouse then the js won't do anything...that why i'm not using it. But i will do the changes that you talked about and hope for the best, thank eh !
  4. Hi to everybody ! I'm writing an html page where the user fils one or more (if zero infos then pop up Alert) forms (javascript check) and then the page sends the info to a php scipt for treatment and then database check (mysql). What i don't know is this : Since with the form action = script.php to send the infos then where do i place the javascript ? Here's what i've donne but it doesn't work. [code] <html>     <head>         <title> * Annuaire * </title>             <script type="text/javascript">                 function verifForm(formulaire){                     if( formulaire.name.value == "")                     alert('Le champ est vide !!!');                         else                             formulaire.submit();} </script>     </head>         <body>             <h2 style = "text-align": center;></div>             <h2 style = "text-align": center;> * Annuaire du xyz * </h2>                             <form action = search.php method = "POST">                     <table border=\"0\">                                         <tr><td>Nom :</td> <td><input type="text" name="name"></td></tr> <tr><td>Prenom :</td> <td><input type="text" name="surname"></td></tr> <tr><td>Tel:</td> <td><input type="text" name="tel" maxlength="10"></td></tr> <tr><td>Email:</td> <td><input type="text" name="email"></td></tr> <tr><td>Web :</td> <td><input type="text" name="web"></td></tr> <td>Departement:</td><td align="center"><select name="depart" > <option value="all" selected="selected">Tous les departements</option> <option >Info</option> <option >Micro</option> <option >Robo</option> <option >Admin</option>                         </select> </td> </tr> <td>Statut:</td><td align="center"><select name="statut" > <option value="all" selected="selected">Tout statut</option> <option >Permanent</option> <option >Doc</option> <option >Post-Doc</option> <option >Invite</option> <option >Stagiaire</option>                         </select> </td> </tr>                 <td><br><input type="submit" value="Envoye" onsubmit="verifForm(this.form)"></input></td>     <td><br><input type="reset" value="Retablir"></input></td>       </form>     </table>     <body> <html>[/code] What do you think ? is the js well placed and why doen't it do anything ? thanks
  5. What i would like to do here is to retrieve the infos of a row in a DB and display it in a form (the same i entered the data) correct them and save . Here's what i've done [code]<? session_start(); if(!isset($HTTP_SESSION_VARS['valid_user'])) {     echo "blablah"; }     else{         echo "Welcome $HTTP_SESSION_VARS[valid_user] <html>         <title>* Blah *</title>     <body>          $objid = $HTTP_POST_VARS['objid']; echo"objid=$objid"; $host = ""; $user = ""; $pass = ""; $base = ""; $db_conx = mysql_connect($host,$user,$pass) or print("error de connection mysql"); mysql_select_db($base, $db_conx) or print("error connection base"); $query ="UPDATE object SET region state city='$city' district='$_POST[district]'accomodation transaction nb_rooms floor price='$_POST[price]' garage cellar garden pool descr='$_POST[descr]'age_par pic WHERE username='".$HTTP_SESSION_VARS['valid_user']."'AND objid='$objid'"; $result = mysql_query($query) or die(mysql_error());     if ($resultat) {         echo"updated !";     }         else {             echo" problem !";         } } ?>[/code] But honestly i haven't understood the concept...Do i need to write 2 requests? (display,update)How can get the infos from the DB and show the values appearing in the form (another php that i enter infosin the DB from, tx radio, checkbox) ?? What do you think of the above script, am i in the right way ??? Any info on this subject is welcome, Thanks Christos
  6. sorted ,no need for * at the request ...
  7. K problem sorted but there is another one :) I manage to pass the value but it won't delete the row from the DB... [code]$objid = $HTTP_POST_VARS['objid']; echo"objid=$objid"; //connection $db_conx = mysql_connect($host,$user,$pass) or print("error de connection mysql"); mysql_select_db($base, $db_conx) or print("error connection base"); $query="DELETE * FROM object WHERE objid=$objid"; $resultat=mysql_query($query); if ($resultat) { echo"deleted !"; } else { echo" problem !"; } My request seems ok,right?
  8. hmm i don't understand your point ! Myself i send data via post and it should work normally, do you mean i should try $_REQUEST (i tried it) the isset thing is no use for me...or maybe i don't see what you're trying to explaing me :( Can you be more clear ? christos
  9. This time from scrip1.php i need to press a button and it will send a value (number) to another script2.php that will erase a row from the DB so at script1.php i have :[code] echo "    </table><br> <td><form method=post action=upd_obj.php> <input type=submit value='Modifier une annonce '> N°: <input type=text name=objid size=1></form></td>";[/code] //the value i need to sent is objid...a box next to N and at script2.php :[code] $objid = $HTTP_POST_VARS['objid']; // in order to bring the value submited by post...at thisline a get the Notice too :( //conncetion with DB $query="DELETE * FROM  object WHERE objid=$objid"; $resultat=mysql_query($query); [/code] The message i get... [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Notice: Undefined index: objid in c:\foreign\easyphp1-8\www\agence\test\del_obj.php on line 21[/quote] what have i done wrong, any ideas ??? Christos
  10. Well i would like to know if i can use OR at my requests... [code]$query = "SELECT * FROM object WHERE city = '$city' AND transaction = '$transaction' AND accomodation = '$accomodation' AND nb_rooms = '$nb_rooms' AND price = '$price' AND age_par = '$age_par'";[/code] for exemple replacing AND with OR above. Would that work ? I haven't found much on the net about it:( christos
  11. First step start from the tutorial of this site (for exemple) and try to customize the code for your own needs. Read read read and start from making small blocks of code and go bigger... No easy way from my experience ! christos
  12. I didn't think that would wok !!! 1000 Thanks :-) christos
  13. That's it ;-) When i try to display the data from the DB i get an endles While loop with an error... [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in c:\foreign\easyphp1-8\www\agence\test\search.php on line 31[/quote] [code] $query = "SELECT * FROM object WHERE city = '$city' AND transaction = '$transaction' AND accomodation = '$accomodation' AND nb_rooms = '$nb_rooms' AND price = '$price' AND age_par = '$age_par'"; $rs = mysql_query($query) or die ('Probleme avec la requette :'.$query.'<br><br>'.mysql_error()); while(($data=mysql_fetch_array($query))!==false) {                   //I get the Warning here     echo "<tr>     <td>".$data['city']."</td>         <td>".$data['transaction']."</td>     <td>".$data['accomodation']."</td>     <td>".$data['nb_rooms']."</td>     <td>".$data['price']."</td>     <td>".$data['age_par']."</td>     </tr>"; } [/code] Any ideas???
  14. Once again i'm passing values from html to php but the request is not working and gives [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Problem with query: SELECT * FROM object WHERE city = Montpellier AND transaction = Location AND accomodation = Maison AND nb_rooms = 6 AND price = 1650000 AND age_par = Agence Unknown column 'Montpellier' in 'where clause'[/quote] i'm passing the values with [code]$city = $HTTP_POST_VARS['city']; $transaction = $HTTP_POST_VARS['transaction']; $accomodation = $HTTP_POST_VARS['accomodation']; $nb_rooms = $HTTP_POST_VARS['nb_rooms']; $age_par  = $HTTP_POST_VARS['age_par']; $price = $HTTP_POST_VARS['price'];[/code] at the top of the script and my request is [code] $host = "???"; $user = "???"; $pass = "???"; $base = "???"; $db_conx = mysql_connect($host,$user,$pass) or print("error connection  MySQL !"); mysql_select_db($base, $db_conx) or print("Error connection  DB !"); $query = "SELECT * FROM object WHERE city = $city AND transaction = $transaction AND accomodation = $accomodation AND nb_rooms = $nb_rooms AND price = $price AND age_par = $age_par"; $rs = mysql_query($query) or die('Problem with query: '.$query.'<br><br>'.mysql_error());[/code] I need to check if the values i'm passing exist in the DB and if yes show results, but i wonder if linking all the vals with AND is the correct way to go... ?
  15. damnnn i'm bad lol... I must be tired, i will take a break...yeah he he he Well that's it sorted (well a big part is yours [b]kenrbnsn[/b]) Thanks christos
×
×
  • 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.