My program needs to select a username based on the criteria of the userid being 2. The database holds a table with fields userid and username. How do I access that table? The database is mysql.

What is this for? School?

Why not search for a mysql tutorial. It will show you everything you need to know.

It is not for school it is for a program I am writing to create a PTC site where users are paid to view advertisers' ads. Got the connect problem figured out. I was using the wrong host, user, and password. But now I can't get the frame to show using the code:

<?php
mysql_connect("mysql503.opentransfer.com", "C258596_Laurie", "BetsyG123") or die(mysql_error());
mysql_select_db("C258596_windmill") or die(mysql_error());
$id = (int)$_POST['ad'];
$target = $db->query("SELECT target FROM ads WHERE id ='$id' LIMIT 1");
if($db->num_rows() < 1)
  {die('invalid ad id');}
list($target) = $db->fetch_array($target);
echo "database";
?>
<frameset rows = "90,*">
  <frame src="accept_again.php?username=<?php echo htmlentities($_POST['username'], ENT_QUOTES); ?>&adid=<?php echo htmlentities($id, ENT_QUOTES); ?>">
  <frame src="<?php echo htmlentities($target, ENT_QUOTES) ?>">
</frameset>

I was using the frame with a different host and it worked but when I transferred to this host and altered the connection data the frame no longer worked.

Strange...

Will have another look.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.