PDA

View Full Version : Dont know whats wrong..



MrCraig
31-12-2007, 09:19 PM
Im making a script that automatically resets the HabboSoft UserSystem!

So far, i have this code



<?php
require("config.php");
$dump = @file_get_contents("SQL.txt");
mysql_query($dump);
?>
The SQL.txt file is CHMODDed to 0644

And ive tried running the file in phpmyadmin seperately and it works fine, however, the script doesnt affect the database at all. It just seems to do nothing.

Ive tried print_r'ing the $dump variable and all the SQL is there.

Any suggestions?

Moved by Agesilaus (Forum Moderator) from Designing & Development: Please post in the correct forum next time. :)

Baving
31-12-2007, 09:23 PM
Try using file() instead of file_get_contents

MrCraig
31-12-2007, 09:26 PM
Made no difference :S

Baving
31-12-2007, 09:40 PM
If it is a static file why not just post the SQL into a variable? Then you won't have to mess about with file handling

MrCraig
31-12-2007, 09:53 PM
Well surely using


file_get_contents();


OR



file();


is the same as posting it into a variable, without the need to worry about backslashing quotations.?

Assassinator
31-12-2007, 09:54 PM
Try having


<?php
include; ("config.php");
$dump = @file_get_contents("SQL.txt");
mysql_query($dump);
?> </span> </span>

Flisker
01-01-2008, 09:47 AM
why did you put a ; after include???



<?php
include("config.php");
$dump = @file_get_contents("SQL.txt");
mysql_query($dump);
?>

There sorted Kane's error xD

MrCraig
02-01-2008, 03:37 PM
is that not the same as what i posted first..? :S

Want to hide these adverts? Register an account for free!