Jump to content

skidmark10

Members
  • Posts

    27
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

skidmark10's Achievements

Member

Member (2/5)

0

Reputation

  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); ?>
×
×
  • 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.