Jump to content

Running an SQL File and having PHP Execute it


Twister1004

Recommended Posts

Hey everyone,

 

I have an SQL file called "Cype.sql" and I was wanting to have it run when the install feature is going on. However I can't seem to figure out why exactly the code is not working.

 

is it possible to have it run without getting too in depth the PHP coding?  I'm not OOP Literate yet.

 

//Connection is opened
//While in installation file


$sqlFile = "Cype.sql";

if(!file_exists($sqlFile)){
echo "File not found";
}
else{
$openFile = fopen($sqlFile, "r");
$tryQuery = mysql_query($openFile);
}

 

Now obviously, I'm not the best coder. I've been out of the works of PHP for quite some time now as well.

However, I have researched it and found no answers to my issue.

 

 

Any help would be greatly appreciate. Thank you.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.