Here is the thing. I am trying to create an oop php login form.There are 2 tables, users and applications where applications have 2 fields -> title [50 chars] -> active [boolean] in which I have set the title as primary key. By the other hand The users table construction is : id->primary key,name [50 chars],password [50 chars] and in the end the foreign key from applications ,title.
Also when I am tryinf for an example to select the user with 2 titls ,eg , a user with 2 applications and since I insert the data to the database I canot select it. When the other users with one title->application are displayed normally. SO my question is why I cannot display one user with 2 values as a title instead of user with one value.
here is my code :
[code=php]1)Part with the necessary part of selection.
<?php
define(‘DB_SERVER’,’localhost’);
define(‘DB_USER’,’super_user’);
define(‘DB_PASS’ ,’fotis281986#’);
define(‘DB_NAME’, ‘login_oop’);
class DB_con
{
function __construct()
{
$conn = mysql_connect(DB_SERVER,DB_USER,DB_PASS) or die(‘localhost connection problem’.mysql_error());
mysql_select_db(DB_NAME, $conn);
}
public function select()
{
$res = mysql_query(“SELECT u.* , a.* FROM users u,applications a WHERE u.title = a.title”);
//$length = mysql_field_len($res, $title);
//echo $length;
if($res === FALSE) {
die(mysql_error()); // TODO: better error handling
} else {return $res;}
}
2)Part with important parts of index.php
<?php
include_once ‘mysql.php’;
$con = new DB_con();
$res=$con->select();
$res2= $con->select_app();
?>
<?php
while($row=mysql_fetch_array($res))
{
?>
<tr>
<td><?php echo $row[‘id’]; ?></td>
<td><?php echo $row[‘name’]; ?></td>
<td><?php echo($row[‘title’]); ?> </td>
<td align=”center”><a href=”javascript:edit_id(<?php echo $row[0]; ?>)”><img src=”b_edit.png” alt=”EDIT” /></a></td>
<td align=”center”><a href=”javascript:del_id(<?php echo $row[0]; ?>)”><img src=”b_drop.png” alt=”DELETE” /></a></td>
</tr>
<?php
}
?><td align=”center”><a href=”javascript:create_id(<?php echo $row[0]; ?>)”><img src=”b_create.png” alt=”create” /></a></td>
</table>