Jump to content

bugmero

Members
  • Posts

    17
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

bugmero's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks mjdamato , i worked great
  2. Hi all, how can i put my code , the echo results in a html table : $qres = mysql_query("SELECT * FROM `$clubprefix"."_player` WHERE id='$id'"); WHILE ($row = mysql_fetch_array ($qres, MYSQL_ASSOC)) { $FB=$row['FB']; $FM=$row['FM']; $SR=$row['SR']; $Vol=$row['Vol']; $SS=$row['SS']; $PS=$row['PS']; $TE=$row['TE']; echo "Forehand/Backhand :$FB <br>" . "Fitness/Movement :$FM <br>" . "Serve/Return :$SR <br>" . "Volley :$Vol <br>" . "Special Shots :$FB <br>" . "Playing Style :$FB <br>" . "Tournament Experience :$FB <br>" ; i want to put the name and the variable in different columns on the same row thanks
  3. Thanks JAY6390 , that did it , i will try to rewrite the code without global on .
  4. when i send the data i get in the url update_skill.php?='$id' , not the id number , the post code is : <form name="form1" method="post" action="update_skill.php?='$id'"> i have defined the variables in the update code : $id=$_GET['id']; $FB=$_POST['FB']; $FM=$_POST['FM']; $SR=$_POST['SR']; $Vol=$_POST['Vol']; $SS=$_POST['SS']; $PS=$_POST['PS']; $TE=$_POST['TE']; $qsql="UPDATE `$clubprefix"."_player` SET FB='$FB', FM='$FM', SR='$SR', Vol='$Vol', SS='$SS', PS='$PS', TE='$TE' WHERE id='$id'"; echo $qsql; $result=mysql_query($qsql) or die("Problem with the query: $qres<br>" . mysql_error()); i get the data from the variables , but not the id
  5. How do i define them from the form ?
  6. I found out that the problem is that is not getting the id the code are as follow : imput script is : <?php session_start(); require_once('include/connect.php'); include('include/header.php'); include('include/rollover.php'); require_once('include/functions.php'); include('include/toptemplate.php'); connecttodb($hostname_connSquash,$database_connSquash,$username_connSquash,$password_connSquash); function connecttodb($hostname_connSquash,$database_connSquash,$username_connSquash,$password_connSquash) { global $link; $link=mysql_connect ("$hostname_connSquash","$username_connSquash","$password_connSquash"); if(!$link){die("Could not connect to MySQL");} mysql_select_db("$database_connSquash",$link) or die ("could not open db".mysql_error()); } $id=$_GET['id']; $qres="SELECT * FROM `$clubprefix"."_player` WHERE id=". $row['ID'].""; $result=mysql_query($qres) or die("Problem with the query: $qres<br>" . mysql_error()); $rows = mysql_fetch_array ($result); ?> <table width="400" border="0" cellspacing="1" cellpadding="0"> <tr> <form name="form1" method="post" action="update_skill.php?id='$id'"> <td> <table width="100%" border="0" cellspacing="1" cellpadding="0"> <tr> <td> </td> <td align="center" colspan="3"><strong>Update skill level</strong> </td> </tr> <tr> <td align="center"> </td> <td align="center"> </td> <td align="center"> </td> <td align="center"> </td> </tr> <tr> <td align="center"> </td> <td align="center"><strong>Forehand/Backhand</strong></td> <td align="center"><strong>Fitness/Movement</strong></td> <td align="center"><strong>Serve/Return</strong></td> <td align="center"><strong>Volley</strong></td> <td align="center"><strong>Special Shots</strong></td> <td align="center"><strong>Playing Style</strong></td> <td align="center"><strong>Tournament Experience</strong></td> </tr> <tr> <td> </td> <td align="center"><input name="FB" type="text" id="FB" value="<? echo $rows['FB']; ?>"></td> <td align="center"><input name="FM" type="text" id="FM" value="<? echo $rows['FM']; ?>" size="15"></td> <td><input name="SR" type="text" id="SR" value="<? echo $rows['SR']; ?>" size="15"></td> <td align="center"><input name="Vol" type="text" id="Vol" value="<? echo $rows['Vol']; ?>"></td> <td align="center"><input name="SS" type="text" id="SS" value="<? echo $rows['SS']; ?>"></td> <td align="center"><input name="PS" type="text" id="PS" value="<? echo $rows['PS']; ?>"></td> <td align="center"><input name="TE" type="text" id="TE" value="<? echo $rows['TE']; ?>"></td> </tr> <tr> <td> </td> <td><input name="id" type="hidden" id="id" value="<? echo $rows['id']; ?>"></td> <td align="center"><input type="submit" name="Submit" value="Submit"></td> <td> </td> </tr> </table> </td> </form> </tr> </table> <? // close connection mysql_close(); ?> and the update script is : <?php session_start(); require_once('include/connect.php'); include('include/header.php'); include('include/rollover.php'); require_once('include/functions.php'); include('include/toptemplate.php'); connecttodb($hostname_connSquash,$database_connSquash,$username_connSquash,$password_connSquash); function connecttodb($hostname_connSquash,$database_connSquash,$username_connSquash,$password_connSquash) { $link=mysql_connect ("$hostname_connSquash","$username_connSquash","$password_connSquash"); if(!$link){die("Could not connect to MySQL");} mysql_select_db("$database_connSquash",$link) or die ("could not open db".mysql_error()); } $id=$_GET['id']; $qsql="UPDATE `$clubprefix"."_player` SET FB='$FB', FM='$FM', SR='$SR', Vol='$Vol', SS='$SS', PS='$PS', TE='$TE' WHERE id='$id'"; echo $qsql; $result=mysql_query($qsql) or die("Problem with the query: $qres<br>" . mysql_error()); if($result){ echo "Successful"; } ?> The id is not send to the update script .I tried a lot of ways , but no success
  7. When i echo results i get this : UPDATE `worldclass_player` SET FB='', FM='', SR='', Vol='', SS='', PS='', TE='' WHERE id=''Successful I don't get a value for each variable
  8. Thanks kenrbnsn, i get no errors now in the script , but still no update in the database, maybe is something wrong with the id , i defined <td><input name="id" type="hidden" id="id" value="<? echo $rows['id']; ?>"></td> in the input form , maybe is not getting the id correctly , any ideas ?
  9. I have added echo qsql; and i received this information : UPDATE `worldclass_player` SET FB='', FM='', SR='' Vol='' SS='' PS='' TE='' WHERE id=''Problem with the query: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Vol='' SS='' PS='' TE='' WHERE id=''' at line 1 I think i'm not getting the data from the submit script , but i don't understand why
  10. I don't get it a get a lot of errors with what i am doing <?php session_start(); require_once('include/connect.php'); include('include/header.php'); include('include/rollover.php'); require_once('include/functions.php'); include('include/toptemplate.php'); connecttodb($hostname_connSquash,$database_connSquash,$username_connSquash,$password_connSquash); function connecttodb($hostname_connSquash,$database_connSquash,$username_connSquash,$password_connSquash) { global $link; $link=mysql_connect ("$hostname_connSquash","$username_connSquash","$password_connSquash"); if(!$link){die("Could not connect to MySQL");} mysql_select_db("$database_connSquash",$link) or die ("could not open db".mysql_error()); } $qsql="UPDATE `$clubprefix"."_player` SET FB='$FB', FM='$FM', SR='$SR' Vol='$Vol' SS='$SS' PS='$PS' TE='$TE' WHERE id='$id'"; $result=mysql_query($qsql) or die("Problem with the query: $qres<br>" . mysql_error()); if($result){ echo "Successful"; } ?> This is the update script that i am using to send to the data base , used the "or die " statement and i get this error : Problem with the query: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Vol='' SS='' PS='' TE='' WHERE id=''' at line 1 I don't get was is wrong
  11. Thanks for all the help Pikachu2000 this was the problem , so stupid, programing is hard a lot of little things that can make problems , an most of them are stupid mistakes . Great eye Pikachu2000 , i will take your advice and use <?php . kenrbnsn, I will use also the " or die " statement so i see errors in the future . Thanks a a lot guys, great forum . great people .
  12. Hi all, I have this code ,a resolved the issues that i had with fetch_array , but the data is not showing in the filed boxes .This is the code , i get no errors in page but textboxes are empty , no data . it should retrieve some data . <?php session_start(); require_once('include/connect.php'); include('include/header.php'); include('include/rollover.php'); require_once('include/functions.php'); include('include/toptemplate.php'); connecttodb($hostname_connSquash,$database_connSquash,$username_connSquash,$password_connSquash); function connecttodb($hostname_connSquash,$database_connSquash,$username_connSquash,$password_connSquash) { global $link; $link=mysql_connect ("$hostname_connSquash","$username_connSquash","$password_connSquash"); if(!$link){die("Could not connect to MySQL");} mysql_select_db("$database_connSquash",$link) or die ("could not open db".mysql_error()); } $id=$_GET['id']; $qres="SELECT * FROM `$clubprefix"."_player` WHERE id='$id'"; $result=mysql_query($qres); $row = mysql_fetch_array ($result); ?> <table width="400" border="0" cellspacing="1" cellpadding="0"> <tr> <form name="form1" method="post" action="update_skill.php?"> <td> <table width="100%" border="0" cellspacing="1" cellpadding="0"> <tr> <td> </td> <td colspan="3"><strong>Update skill level</strong> </td> </tr> <tr> <td align="center"> </td> <td align="center"> </td> <td align="center"> </td> <td align="center"> </td> </tr> <tr> <td align="center"> </td> <td align="center"><strong>Forehand/Backhand</strong></td> <td align="center"><strong>Fitness/Movement</strong></td> <td align="center"><strong>Serve/Return</strong></td> <td align="center"><strong>Volley</strong></td> <td align="center"><strong>Special Shots</strong></td> <td align="center"><strong>Playing Style</strong></td> <td align="center"><strong>Tournament Experience</strong></td> </tr> <tr> <td> </td> <td align="center"><input name="FB" type="text" id="FB" value="<? echo $rows['FB']; ?>"></td> <td align="center"><input name="FM" type="text" id="FM" value="<? echo $rows['FM']; ?>" size="15"></td> <td><input name="SR" type="text" id="SR" value="<? echo $rows['SR']; ?>" size="15"></td> <td align="center"><input name="Vol" type="text" id="Vol" value="<? echo $rows['Vol']; ?>"></td> <td align="center"><input name="SS" type="text" id="SS" value="<? echo $rows['SS']; ?>"></td> <td align="center"><input name="PS" type="text" id="PS" value="<? echo $rows['PS']; ?>"></td> <td align="center"><input name="TE" type="text" id="TE" value="<? echo $rows['TE']; ?>"></td> </tr> <tr> <td> </td> <td><input name="id" type="hidden" id="id" value="<? echo $rows['id']; ?>"></td> <td align="center"><input type="submit" name="Submit" value="Submit"></td> <td> </td> </tr> </table> </td> </form> </tr> </table> <? // close connection mysql_close(); ?> Am i doing something wrong ? Thanks
  13. Hi, I made this code : connecttodb($hostname_connSquash,$database_connSquash,$username_connSquash,$password_connSquash); function connecttodb($hostname_connSquash,$database_connSquash,$username_connSquash,$password_connSquash) { global $link; $link=mysql_connect ("$hostname_connSquash","$username_connSquash","$password_connSquash"); if(!$link){die("Could not connect to MySQL");} mysql_select_db("$database_connSquash",$link) or die ("could not open db".mysql_error()); } $id=$_GET['id']; $qres = mysql_query("SELECT * FROM `$clubprefix"."_player` WHERE id='$id'"); $result=mysql_query($qres); $rows=mysql_fetch_array($result); ?> <table width="400" border="0" cellspacing="1" cellpadding="0"> <tr> <form name="form1" method="post" action="update_skill.php"> <td> <table width="100%" border="0" cellspacing="1" cellpadding="0"> <tr> <td> </td> <td colspan="3"><strong>Update skill level</strong> </td> </tr> <tr> <td align="center"> </td> <td align="center"> </td> <td align="center"> </td> <td align="center"> </td> </tr> <tr> <td align="center"> </td> <td align="center"><strong>Forehand/Backhand</strong></td> <td align="center"><strong>Fitness/Movement</strong></td> <td align="center"><strong>Serve/Return</strong></td> <td align="center"><strong>Volley</strong></td> <td align="center"><strong>Special Shots</strong></td> <td align="center"><strong>Playing Style</strong></td> <td align="center"><strong>Tournament Experience</strong></td> </tr> <tr> <td> </td> <td align="center"><input name="FB" type="text" id="FB" value="<? echo $rows['FB']; ?>"></td> <td align="center"><input name="FM" type="text" id="FM" value="<? echo $rows['FM']; ?>" size="15"></td> <td><input name="SR" type="text" id="SR" value="<? echo $rows['SR']; ?>" size="15"></td> <td align="center"><input name="Vol" type="text" id="Vol" value="<? echo $rows['Vol']; ?>"></td> <td align="center"><input name="SS" type="text" id="SS" value="<? echo $rows['SS']; ?>"></td> <td align="center"><input name="PS" type="text" id="PS" value="<? echo $rows['PS']; ?>"></td> <td align="center"><input name="TE" type="text" id="TE" value="<? echo $rows['TE']; ?>"></td> </tr> <tr> <td> </td> <td><input name="id" type="hidden" id="id" value="<? echo $rows['id']; ?>"></td> <td align="center"><input type="submit" name="Submit" value="Submit"></td> <td> </td> </tr> </table> </td> </form> </tr> </table> <? // close connection mysql_close(); ?> And i get this error : Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in .............line 23 It displays the form but not the data inside each box . What am i doing wrong ? Thanks
  14. Thanks for the help , that did it, so many details you have to watch for .
  15. Hi all , I have this code : <?php $dbuser=""; $dbpassword=""; $servername=""; $dbname=""; connecttodb($servername,$dbname,$dbusername,$dbpassword); function connecttodb($servername,$dbname,$dbuser,$dbpassword) { global $link; $link=mysql_connect ("$servername","$dbuser","$dbpassword"); if(!$link){die("Could not connect to MySQL");} mysql_select_db("$dbname",$link) or die ("could not open db".mysql_error()); } $query="select * from swr_player" $rt=mysql_query($query); echo mysql_error(); while($nt=mysql_fetch_array($rt)){ echo "$nt[FName] $nt[Lname] $nt[FB]<br>"; } ?> The data for connection is entered correctly . But i get this error messege : Parse error: syntax error, unexpected T_VARIABLE in ................ line 18 Please 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.