I am working on a directory site that is still in beta. I have decided to create a url_base field (derived from the name in the database) to use in place of numerical ids in urls.
The reason I am making this change is to have more meaningful urls.
The database already has a fair bit of data in it, so I am trying to update the data in the table with the new field.
This is where I am having difficulties. The script is very short.
PHP Code:
$ask="SELECT * FROM org";
$result=mysql_query($ask) or die(mysql_error());
while ($data=mysql_fetch_assoc($result)) "INSERT into org.url_base VALUES ".strtolower(ereg_replace(" ","_",trim(ereg_replace("[^A-Za-z0-9 ]", "",$data['name']))))." WHERE orgid=".$data['orgid.'];
I think maybe I am using the WHILE loop with the INSERT statement wrong.
Thanks for taking the time to look over this script.
d.
|