Jump to content

PHP and SQL help


Trevor

Recommended Posts

I am trying to get a echo in PHP to print in a table i have created on the same page. This is my current coding

 

<?php
$con
= mysql_connect("localhost","****","****");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("****", $con);

$result = mysql_query("SELECT * FROM members
WHERE member_msisdn='$slusername'"
);
echo "<table border='1'>
<tr>
<th>Membership</th>
<th>Number</th>
<th>Registration Date</th>
<th>End Date</th>
<th>Copy of ID</th>
</tr>"
;
while($row = mysql_fetch_array($result))
{
echo "<td><center>" . $row['member_id'] . "</td>";
echo "<td><font color=blue>" . $row['member_msisdn'] . "</td>";
echo "<td><center>" . $row['asdate'] . "</td>";
echo "<td><center>" . $row['aedate'] . "</td>";
echo "<td><center>" . $row['attid'] . "</td>";
echo "</tr>";
}
echo "</table>";

mysql_close($con);
?></div>
<div class="Notes"><strong><br>
Emergency Contact Numbers:</strong><br>
<?php
$con
= mysql_connect("localhost","****","****");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("****", $con);

$result = mysql_query("SELECT * FROM members a INNER JOIN recipients b ON a.member_id =
b.member_id WHERE member_msisdn=$slusername"
);
echo "<table border='1'>
<tr>
<th>Number</th>
<th>Name</th>
<th>Surname</th>
</tr>"
;
while($row = mysql_fetch_array($result))
{
echo "<td><font color=blue>" . $row['recipient_msisdn'] . "</td>";
echo "<td>" . $row['recipient_name'] . "</td>";
echo "<td>" . $row['recipient_surname'] . "</td>";
echo "</tr>";
}
echo "</table>";

mysql_close($con);
?>
</div>
<p>
<label for="member_id"></label>
<input type="text" name="member_id" id="member_id"> // here i need the member_id of members to be printed so i can have it entered into another table on same sql DB
</p>
<p><br>
</p>
</div></td>

 

Basically i need the to print or past it in the input that it will use it later on a different table in the SQL DB

Link to comment
Share on other sites

I'm not understanding the question but I know that you need a <form action="somethingToDoWithTheInput.php" method="POST"> before the input and a submit and /form after it. If you wnat to prepopulate the input you need to do something like:

<input type="text" name="member_id" value="<?php echo $mydata['name'];?>"  id="member_id">

 

Does that help?

David

Edited by davidannis
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.