0

Have 2 tables - one for new titles and the other for authors.

I want to tag the "new titles" table with the "author" value if the author's name appears in list of new titles.

As you can see from my code, I don't have a clue what is wrong but its a type of query that I will be using a lot.

Suggestions where to start?

<?
	$sql="SELECT author FROM author_list ";
	
	$rs = mysql_query($sql);
	
	While($row = mysql_fetch_array($rs)){
	
	$id= ['author']; 
	
	$result = mysql_query("SELECT author, title from author_list, title_list WHERE title like '.$id.' ");
?>
4
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by sv3tli0
0

Have a look at JOIN.

Your DB could have the following:

AUTHORS
auth_id
name
surname
...

TITLES
title_id
auth_id
title
...

However,this setup would only allow a single author for each title
A better structure would be:

AUTHORS
auth_id
name
surname
...

TITLES
title_id
title
...

AUTHTITLE
auth_id
title_id
main_auth (tinyint, default=1)


What you need to retrieve title and author would be a JOIN. Read up on this in the mysql manual.

0

Please give us your database structure for both tables.
To return you a correct working code.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.