Jump to content

skidmark10

Members
  • Posts

    27
  • Joined

  • Last visited

    Never

Everything posted by skidmark10

  1. Hello, Does anyone know the php code to display mysql table names?
  2. Hello, I am trying to select more than two mysql tables using php. All of the tables have one column in common "Client_ID". Does anyone know how I would pull information from all the columns with the same "Client_ID"? I don't have a code I'm working with yet, I'm stumped.
  3. I apologize for that, I'm gonna have to get more sleep, and quit being mean to people! Thank you so much!
  4. I tried a similar code (not the code I posted) I put this and got a parse error echo "<td>" . $row['FirstName'] . " . $row['LastName']"</td>" ; Then I tried your code too and received a parse error echo "<td>" . $row['FirstName'] . ' ' . $row['Last_Name']"</td>";
  5. I don't think that works, I keep receiving the same error as before :-\ Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';'
  6. Hello, I am trying to retrieve and display data from a mysql table into a html table using php. I am using this code and it works successfully. <?php mysql_select_db("my_db", $con); $result = mysql_query("SELECT * FROM Persons"); echo "<table border='1'> <tr> <th>Firstname</th> <th>Lastname</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['FirstName'] . "</td>"; echo "<td>" . $row['LastName'] . "</td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?> However, I want $row['FirstName'] and $row['LastName'] to appear in the SAME cell of the html table, next to one another. How would I write the code for that, if it is possible Thanks in advance!
  7. I'm sorry, forgot to mention that I have an html form that posts data into the mysql table. phpmyadmin is what I'm using for my database.
  8. Hello, I am using an html form where users submit their date of birth into a column in my mysql table. I am using phpmyadmin. I also have a table for current age that should get the users current age based on the information they submitted into the "date of birth" column. What date function would allow me to do the above? Also, where would I put that function? Again, I am using phpmyadmin.
  9. Hello, I have an html form with checkbox answers that I want to store into a mysql database. When I use php however, only one of the values is stored in the column. I know this isn't a mysql issue because my table is "SET". Any reason why it isn't working?
  10. I have an html form with checkbox answers. I want to store the answers in ONE mysql column. When I select for checkbox answers, only the very last one shows up in the column, but I have it enumerated so I don't know why it shows up like that. Any suggestions?
  11. Fixed it Instead of $sql = "SELECT * FROM `Partners_Body_Types` WHERE Client_ID=" .$_POST['clientid']. ""or die ('Error: '.mysql_error ()); It should be $sql = "SELECT * FROM `Partners_Body_Types` WHERE Client_ID='$_POST[clientid]'"
  12. How can I put in the error-handling logic? This is all of my php code (minus my database connection code), I'll post my html code so you can see the form. HTML <form name="input" action="fetchclientprofile.php" method="GET"> <center> Client ID <input type="text" name="clientid" /><br /> </center> <center> <input type="submit" value="Retrieve" /> </center> PHP $sql = "SELECT * FROM `Partners_Body_Types` WHERE Client_ID= " .$_POST['clientid']. ""; $query = mysql_query($sql); echo "<table border='0'> <tr> <th>Client ID</th> <th>Partner's Body Type</th> <th>Partner's Body Type</th> <th>Partner's Body Type</th> <th>Partner's Body Type</th> </tr>"; while ($row = mysql_fetch_array($query)) { echo "<tr>"; echo "<td>" . $row['Client_ID'] . "</td>"; echo "<td>" . $row['Slim_Slender'] . "</td>"; echo "<td>" . $row['Average'] . "</td>"; echo "<td>" . $row['Athletic'] . "</td>"; echo "<td>" . $row['Heavy'] . "</td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?>
  13. I am still receiving the error Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource after making the corrections. Is there anything else I can do? $sql = "SELECT * FROM `Partners_Body_Types` WHERE Client_ID= " .$_POST['clientid']. ""; $query = mysql_query($sql); echo "<table border='0'> <tr> <th>Client ID</th> <th>Partner's Body Type</th> <th>Partner's Body Type</th> <th>Partner's Body Type</th> <th>Partner's Body Type</th> </tr>"; while ($row = mysql_fetch_array($query)) { echo "<tr>"; echo "<td>" . $row['Client_ID'] . "</td>"; echo "<td>" . $row['Slim_Slender'] . "</td>"; echo "<td>" . $row['Average'] . "</td>"; echo "<td>" . $row['Athletic'] . "</td>"; echo "<td>" . $row['Heavy'] . "</td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?>
  14. I've never encountered this error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource Does anyone knows where it stems from, and ways to fix it? Here's my code just in case. $sql = "SELECT * FROM `Partners_Body_Types` WHERE Client_ID=" .$_POST['clientid']. ""or die ('Error: '.mysql_error ()); $query = mysql_query($sql); echo "<table border='0'> <tr> <th>Client ID</th> <th>Partner's Body Type</th> <th>Partner's Body Type</th> <th>Partner's Body Type</th> <th>Partner's Body Type</th> </tr>"; while ($row = mysql_fetch_array($sql)); { echo "<tr>"; echo "<td>" . $row['Client_ID'] . "</td>"; echo "<td>" . $row['Slim_Slender'] . "</td>"; echo "<td>" . $row['Average'] . "</td>"; echo "<td>" . $row['Athletic'] . "</td>"; echo "<td>" . $row['Heavy'] . "</td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?>
  15. I keep recieving the error: Parse error: syntax error, unexpected T_ECHO on Line 13. Does anyone know what "T_ECHO" means, so I can know for future reference? Here's my code, Line 13 is echo "<table border='0'>. Thanks in advance! $sql = "SELECT * FROM Partners_Body_Types WHERE Client_ID=" .$_POST['clientid']. ""; $query = mysql_query($sql) echo "<table border='0'> <tr> <th>Client ID</th> <th>Partner's Body Type</th> <th>Partner's Body Type</th> <th>Partner's Body Type</th> <th>Partner's Body Type</th> </tr>";
  16. Really haven't started any code yet, I'm confused. I know how to create an html form, with the form action of "post", and it stores the form data into the mysql table. Now I want an html form where I enter a client's ID number, hit submit, and the row with the ID number in the table is displayed.
  17. Hi, I have a table in mysql that I would like to retrieve data from, but only a particular row. I want to have an html form where I put the client id number in, hit submit, and have that member's row of data display (one row in the mysql table). Does anyone know the code for this?
  18. I am trying to insert answers from a checkbox on an html form into a mysql table using php. For some odd reason, the data doesnt make it to the mysql table. I'm not sure what the issue is, so I posted all of the information I have so I can see where I made my mistake. thanks in advance. Here is the html <table class=MsoNormalTable border=0 cellpadding=0 width="100%" style='width:100.0%;mso-cellspacing:1.5pt;mso-yfti-tbllook:1184;mso-padding-alt: 0in 5.4pt 0in 5.4pt'> <tr style='mso-yfti-irow:0;mso-yfti-firstrow:yes'> <td width="100%" style='width:100.0%;padding:.75pt .75pt .75pt .75pt'> <p class=MsoNormal><span style='mso-fareast-font-family:"Times New Roman"'><INPUT TYPE="checkbox" NAME="partnerbodytype1" VALUE="Slender|Slim"> Slender/Slim <o:p></o:p></span></p> </td> </tr> <tr style='mso-yfti-irow:1'> <td width="100%" style='width:100.0%;padding:.75pt .75pt .75pt .75pt'> <p class=MsoNormal><span style='mso-fareast-font-family:"Times New Roman"'><INPUT TYPE="checkbox" NAME="partnerbodytype2" VALUE="Average"> Average <o:p></o:p></span></p> </td> </tr> <tr style='mso-yfti-irow:2'> <td width="100%" style='width:100.0%;padding:.75pt .75pt .75pt .75pt'> <p class=MsoNormal><span style='mso-fareast-font-family:"Times New Roman"'><INPUT TYPE="checkbox" NAME="partnerbodytype3" VALUE="Athletic"> Athletic <o:p></o:p></span></p> </td> </tr> <tr style='mso-yfti-irow:3;mso-yfti-lastrow:yes'> <td width="100%" style='width:100.0%;padding:.75pt .75pt .75pt .75pt'> <p class=MsoNormal><span style='mso-fareast-font-family:"Times New Roman"'><INPUT TYPE="checkbox" NAME="partnerbodytype4" VALUE="Heavy"> Heavy <o:p></o:p></span></p> </td> </tr> </table> </div> Here is the php code $sqlpartnersbodytype= "INSERT INTO `Partners_Body_Types` (Slim_Slender, Average, Athletic, Heavy) VALUES ('$_POST[partnerbodytype1]','$_POST[partnerbodytype2]', '$_POST[partnerbodytype3]','$_POST[partnerbodytype4]')"; Here is the table information `Partners_Body_Types` CHANGE `Slim_Slender` `Slim_Slender` VARCHAR( 10 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL , CHANGE `Average` `Average` VARCHAR( 10 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL , CHANGE `Athletic` `Athletic` VARCHAR( 10 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL , CHANGE `Heavy` `Heavy` VARCHAR( 10 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL
  19. CHANGE `Slim_Slender` `Slim_Slender` ENUM( 'Slim|Slender' ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL , CHANGE `Average` `Average` ENUM( 'Average' ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL , CHANGE `Athletic` `Athletic` ENUM( 'Athletic' ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL , CHANGE `Heavy` `Heavy` ENUM( 'Heavy' ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL
  20. Hello, I am trying to store checkbox answers into a table in mysql. What should the table input be? I'm using enumeration, but my answers aren't appearing. What am I doing wrong?
  21. I've tried this way, but my answers still don't appear. Is there something wrong with my table? Is there something I can change with the table?
  22. Yikes! Is this the only way???? If so, I have to prepare myself for a LONG night of work....
×
×
  • 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.