Jump to content
Larry Ullman's Book Forums

Recommended Posts

Hello guys,


I'm using the following script to rename my directory to values stored in a table. The one table (table1) has the name of the current directory and

we are trying to rename it to the new value in the second table (table2):


Below is the script: (NOTE: the 'echo' statement was used just to let me know if the values were pulled.




<?php # Named 'script3.php sets the new random number. In other words, it is responsible for naming a new filename/url.'


require_once ('./stuff); // Connect to the database.


$query="SELECT * FROM table2";

$result = mysql_query($query); // Run the query.

while ($row = mysql_fetch_array($result, MYSQL_ASSOC))

$url2_id = $row[url2_id];

echo $url2_id;

$query1="SELECT * FROM table1";

$result = mysql_query($query1); // Run the query.

while ($row = mysql_fetch_array($result, MYSQL_ASSOC))

$url1_id = $row[url1_id];

echo $url1_id;




Below is the error we get:


Warning: rename(832740485,857465976) [function.rename]: No such file or directory in /home/content/01/7477001/html/join/step6.php on line 15.


Any advice???

Link to comment
Share on other sites

The error just means that the file doesn't exist at the location you've specified.


Are those numbers actually the filenames you're using? Is the file you're trying to rename in the same directory as the executing script? Because thats just the filename and not a full path it's going to be looking in the /join directory for the file named 832740485 - also do they not have extensions?


You should really be providing the full path to the filename - here's the basic example from the PHP manual:


rename("/tmp/tmp_file.txt", "/home/user/login/docs/my_file.txt"

  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...