<?php
$dbhost = 'localhost';
$dbuser = 'user';
$dbpass = 'pass';
$dbname = 'dbname';
$query = file_get_contents('carsql.sql');
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname);
mysql_query($query);
mysql_close($conn);
?>
the script above reads long sql stetment from carsql.sql file, i have no idea why this simple code doesnot work? and i get no errors when i excute the page that holds these lines.
the username/pass/query file/ all is valid, pls someone help me this urgent thanks in advanced.
here is a part of the carsql.sql file i tested it with phpmyadmin and there is no problem at all.
DROP TABLE IF EXISTS cars;CREATE TABLE cars (id INT(5),picid INT(6),model VARCHAR(20),type1 VARCHAR(15),type2 VARCHAR(15),color VARCHAR(15),sdate VARCHAR(15),km INT(6),spower VARCHAR(15),sdesc VARCHAR(15),price INT(6));INSERT INTO cars VALUES ( 918, 51607, 'Opel Corsa', '', 'Sedán', 'rot', '09/92' , 153600 , '33 KW Gasolina/E2' , '' , 250);INSERT INTO cars VALUES ( 1266, 52566, 'VW Golf-2', '', 'Sedán', 'rot', '07/88' , 230579 , '51 KW Gasolina/01' , '' , 450);INSERT INTO cars VALUES ( 432, 48143, 'Ford Mondeo', 'CLX', 'Sedán', 'rot', '09/94' , 220772 , '65 KW Gasolina/E2' , 'de cinco marchas, velour, techo corredizo, sistema antibloqueo, radiocassette, airbag delantero, banco trasero dividido, reposacabezas, dirección asistida, cierre centralizado, cristales de color, 2 levantacristales eléctricos, etc' , 991);