Q:

adding the URL_Id (primary key) from the url table to each row in the data table's URL_Id. mysql

With this php code I save the url of the current page and the primary key auto increments
mysql_query("INSERT INTO url (url)
VALUES ('$url')");

I have another table with 2 columns in my data table (data, and URL_Id)
I store each data value as such: 
foreach($textnode as $key => $value) {

$value = stripslashes($value);
 $value = mysql_real_escape_string($value, $con);

 mysql_query("INSERT INTO data (data)
 VALUES ('$value')");

}

how would I store the URL_Id in the url table-into each row of the data table.

A:

Not sure if I understand your question as there is no logic about fetching from the url table in your code snippet. 
If you just want to retrieve the last inserted id, you can use the mysql-insert-id function and use that in your "foreach" loop.

