ady01 Posted May 24, 2008 Share Posted May 24, 2008 Im getting an error when running the below code, anybody got a clue why ? Error is : Parse error: syntax error, unexpected T_VARIABLE in /data/members/paid/a/d/ady01.co.uk/htdocs/smb1buddylist/close.php on line 11 My code is : <?php include 'config.php' $query = "SELECT * FROM Addresses"; $result = mysql_query($query) or die('Error, query failed'); $tsv = array(); while($row = mysql_fetch_array($result, MYSQL_NUM)) { $tsv[] = implode("\t", $row); } $tsv = implode("\r\n", $tsv); $fileName = 'mysql-to-excel.xls'; header("Content-type: application/vnd.ms-excel"); header("Content-Disposition: attachment; filename=$fileName"); echo $tsv; ?> Link to comment https://forums.phpfreaks.com/topic/107115-t_varible-error/ Share on other sites More sharing options...
BlueSkyIS Posted May 24, 2008 Share Posted May 24, 2008 you're missing a semi-colon on the first line. Link to comment https://forums.phpfreaks.com/topic/107115-t_varible-error/#findComment-549139 Share on other sites More sharing options...
ady01 Posted May 24, 2008 Author Share Posted May 24, 2008 Thanks thats fixed the error ! now im getting another !!!! Error, query failed Link to comment https://forums.phpfreaks.com/topic/107115-t_varible-error/#findComment-549157 Share on other sites More sharing options...
BlueSkyIS Posted May 24, 2008 Share Posted May 24, 2008 get more info: $result = mysql_query($query) or die('Error, query failed: '.mysql_error()); Link to comment https://forums.phpfreaks.com/topic/107115-t_varible-error/#findComment-549160 Share on other sites More sharing options...
ady01 Posted May 24, 2008 Author Share Posted May 24, 2008 your good by the way ... this what im getting now.. Error, query failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) Link to comment https://forums.phpfreaks.com/topic/107115-t_varible-error/#findComment-549166 Share on other sites More sharing options...
Cory94bailly Posted May 24, 2008 Share Posted May 24, 2008 Are you even connecting to mysql? What's in config.php? Error, query failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) ^^That means that you can't connect through localhost. Link to comment https://forums.phpfreaks.com/topic/107115-t_varible-error/#findComment-549167 Share on other sites More sharing options...
ady01 Posted May 24, 2008 Author Share Posted May 24, 2008 strange because i can use my config file to connect on other php parts of my site, this is my config file ::: <?php $AddressBook_HOST="localhost"; $AddressBook_Username="*******"; $AddressBook_Password="*******"; $AddressBook_DatabaseName="*********"; if($AddressBook_Username=="[username]"){ die('Please Specify the Username'); } if($AddressBook_Password=="[pw]"){ die('Please Specify the Password'); } if($AddressBook_DatabaseName=="[database]"){ die('Please Specify the Database'); } ?> Link to comment https://forums.phpfreaks.com/topic/107115-t_varible-error/#findComment-549169 Share on other sites More sharing options...
Cory94bailly Posted May 24, 2008 Share Posted May 24, 2008 $AddressBook_HOST="localhost"; $AddressBook_Username="*******"; $AddressBook_Password="*******"; $AddressBook_DatabaseName="*********"; Those variables aren't even in the script you posted... I don't see anywhere "mysql_connect()" Link to comment https://forums.phpfreaks.com/topic/107115-t_varible-error/#findComment-549173 Share on other sites More sharing options...
ady01 Posted May 24, 2008 Author Share Posted May 24, 2008 Good point , how the hell i forgott that i dont know... now its working but not displaying in excel like its meant to ! its now showing the blow but needs to be downloaded to excel ? 50 522380 Ptechnology group alivemore tgoater [email protected] example example Joanne A [email protected] None 51 358225 eservices person a Person 1 [email protected] example example Robert [email protected] Place order Via EDI link 54 test test test test test test test test test testing server Link to comment https://forums.phpfreaks.com/topic/107115-t_varible-error/#findComment-549182 Share on other sites More sharing options...
ady01 Posted May 24, 2008 Author Share Posted May 24, 2008 **bump** Link to comment https://forums.phpfreaks.com/topic/107115-t_varible-error/#findComment-549193 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.