Thanks so much for replying! Yes, I posted the super-simplified code (that worked at one host) but before I posted here, I had run the code with lots of error checking. I was hoping that your error check would give more info but it doesn't.
Just creating the db file works fine:
<?php
if(!function_exists("debug")){
function debug($varname,&$v){
// debug('$var',$var);
if (isset($v)){
print("<pre><b>$varname = </b>");
if($printable = print_r($v,TRUE) )echo $printable;
else var_dump($v);
print '</pre>';
}
else print("<pre><b>$varname not set.</pre></b>");
return;
}}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>test.php</title>
</head>
<body>
<?php
echo 'Test<br />';
$dbFile = 'foo.db';
unlink($dbFile);
$dbhandle = sqlite_open($dbFile, 0666, $sqliteerror);
echo '<b>sqlite_last_error</b> '.sqlite_error_string(sqlite_last_error($dbhandle));
debug('$dbhandle',$dbhandle);
debug('$sqliteerror',$sqliteerror);
/*
Comment out the rest of it
sqlite_query($dbhandle,"CREATE TABLE foo (bar varchar(10))",$sqliteerror);
echo '<b>sqlite_last_error</b> '.sqlite_error_string(sqlite_last_error($dbhandle));
debug('$sqliteerror',$sqliteerror);
sqlite_query($dbhandle, "INSERT INTO foo VALUES ('fnord')",$sqliteerror);
$result=sqlite_query($dbhandle, 'SELECT bar FROM foo',$sqliteerror);
$values = sqlite_fetch_array($result);
echo '$values = ';
foreach($values as $value){
echo $value.'<br/>';
}
*/
?>
</body>
</html>
gives:
Test
sqlite_last_error not an error
$dbhandle = Resource id #2
$sqliteerror not set.
Which is just fine but when I un-comment only one sqllite_query() call
i.e.
<?php
if(!function_exists("debug")){
function debug($varname,&$v){
// debug('$var',$var);
if (isset($v)){
print("<pre><b>$varname = </b>");
if($printable = print_r($v,TRUE) )echo $printable;
else var_dump($v);
print '</pre>';
}
else print("<pre><b>$varname not set.</pre></b>");
return;
}}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>test.php</title>
</head>
<body>
<?php
echo 'Test<br />';
$dbFile = 'foo.db';
unlink($dbFile);
$dbhandle = sqlite_open($dbFile, 0666, $sqliteerror);
echo '<b>sqlite_last_error</b> '.sqlite_error_string(sqlite_last_error($dbhandle));
debug('$dbhandle',$dbhandle);
debug('$sqliteerror',$sqliteerror);
sqlite_query($dbhandle,"CREATE TABLE foo (bar varchar(10))",$sqliteerror);
echo '<b>sqlite_last_error</b> '.sqlite_error_string(sqlite_last_error($dbhandle));
debug('$sqliteerror',$sqliteerror);
/*
Comment out the rest of it
sqlite_query($dbhandle, "INSERT INTO foo VALUES ('fnord')",$sqliteerror);
$result=sqlite_query($dbhandle, 'SELECT bar FROM foo',$sqliteerror);
$values = sqlite_fetch_array($result);
echo '$values = ';
foreach($values as $value){
echo $value.'<br/>';
}
*/
?>
</body>
</html>
The page will not load so I cannot see what the error is.
I am really tearing my hair out here,that's for sure!