Swarfega Posted March 7, 2013 Share Posted March 7, 2013 Hello. I am unsure if this is even possible, but I was wondering if there's any way to pass a parameter from a PHP file when Running a .SQL File using shell_exec? Something like $PassParameter = "Test"; $cmd = "mysql -uName -pHidden -h hostIP -D dBName $PassParameter < script/path/here"; $out = shell_exec($cmd . '/file.sql'); And let's say the SQL file is something like INSERT INTO test VALUES('1', '2', '@PASSED-PARAMETER@'); Reason I need to pass a parameter to an .SQL File before running it, is because using PHP to insert into a table that's using a Blob column (I have the Blobs Saved) does not work. It only inserts part of the Blob, and therefor I cannot use that method, but running an .SQL File inserts the entirety of the Blob, and can therefor be used, if I can pass a parameter. Any ideas? Link to comment https://forums.phpfreaks.com/topic/275380-passing-parameter-through-php-sql-file/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.