Jump to content

mch987

New Members
  • Posts

    5
  • Joined

  • Last visited

mch987's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you so much didn't think it was going to be that easy. I thought I tried that but i guess not because it worked.
  2. So i have this following code that doesn't work <?php $id = $_GET['id']; $data = $_GET['data']; $key = "Password"; mysql_query("update contest_data set '$key'='$data' where Contest_Data_ID='$id'") ?> it doesn't work unless i put it like this <?php $id = $_GET['id']; $data = $_GET['data']; $key = "Password"; mysql_query("update contest_data set `Password`='$data' where Contest_Data_ID='$id'") ?> is there a way to put the `` when setting the $key value i even tired to put $key = "`Password`" and that doesn't work. Also $key="password" is going to be $key= $_GET['key'] but for now i put it like this so i can test it out
  3. So i have this following code that doesn't work <?php $id = $_GET['id']; $data = $_GET['data']; $key = "Password"; mysql_query("update contest_data set '$key'='$data' where Contest_Data_ID='$id'") ?> it doesn't work unless i put it like this <?php $id = $_GET['id']; $data = $_GET['data']; $key = "Password"; mysql_query("update contest_data set `Password`='$data' where Contest_Data_ID='$id'") ?> is there a way to put the `` when setting the $key value i even tired to put $key = "`Password`" and that doesn't work. Also $key="password" is going to be $key= $_GET['key'] but for now i put it like this so i can test it out
  4. Thank You!!! It worked
  5. trying to write a code that will repeat a name until it gets to the number on the database. Database Information Name Number Mike 2 Oscar 2 Robert 1 Wanted to look like Full Name Mike Mike Oscar Oscar Robert Here is my Code <?php $result = mysql_query("SELECT * FROM `people`"); echo "<table border='1'> <tr> <th>Full Name</th> <th> </th> </tr>"; for ($i = 1 , $row = mysql_fetch_array($result) ; $i <= $row['Number'] ; $i++ ) { echo "<tr>"; echo "<td>" . $row['Name'] . "</td>"; echo "<td> </td>"; echo "</tr>"; } echo "</table>"; ?> When i run the code it will only show the result like this Full Name Mike Mike and when i put the "for" again in the bottom of the first one it will show like this Full Name Mike Mike Oscar Oscar <?php $result = mysql_query("SELECT * FROM `people`"); echo "<table border='1'> <tr> <th>Full Name</th> <th> </th> </tr>"; for ($i = 1 , $row = mysql_fetch_array($result) ; $i <= $row['Number'] ; $i++ ) { echo "<tr>"; echo "<td>" . $row['Name'] . "</td>"; echo "<td> </td>"; echo "</tr>"; } for ($i = 1 , $row = mysql_fetch_array($result) ; $i <= $row['Number'] ; $i++ ) { echo "<tr>"; echo "<td>" . $row['Name'] . "</td>"; echo "<td> </td>"; echo "</tr>"; } echo "</table>"; ?> i need something to repeat "For" until it finishes all the Names
×
×
  • 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.