Ok Guys, This is driving me nuts, but it is more likely something simple I’m missing.
I have a php/sqlite app that is working online. In trying to convert that so that I can use it as
a standalone I changed some code (db storage location etc) but no luck. So I did the sensible thing and built a very simple app, so that I could work out where I was going wrong
Here’s the code for the 2 pages
First Page
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
</head>
<body>
<table align="center" width="400" height="200" border="1">
<tr>
<td colspan="2">Enter your first name and last name</td>
</tr> <form action="<?php $_SERVER'php_self'] ?>" method="post">
<tr>
<td>First</td>
<td><input type="text" name="first"> </td>
</tr>
<tr>
<td>Last</td>
<td><input type="text" name="last"> </td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="send" value="send"> </td>
</tr> </form>
<tr>
<form action="readtest.php">
<td colspan="2"><input type="submit" value="read" name="send"></td>
</form>
</tr>
</table>
</body>
</html>
<?php
if($_POST'send']) {
// get and assign vars
$first=$_POST'first'];
$first=ucwords($first);
$last=$_POST'last'];
$last=ucwords($last);
$storagelocation = exo_getglobalvariable('HEPHPDataPath', '');
sqlite_open($storagelocation.'tester.db');
sqlite_query('CREATE TABLE IF NOT EXISTS names
(first varchar(20), last varchar(20), PRIMARY KEY (first)');
sqlite_query("insert into names(first,last)
values('$first','$last')");
}
?>
Second Page
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
</head>
<body> <table align="center" width="400" height="200" border="1">
<tr>
<form action="index.php">
<td colspan="2"><input type="submit" value="back" name="send"></td>
</form>
</tr><tr>
<td>
<?php
$storagelocation = exo_getglobalvariable('HEPHPDataPath', '');
sqlite_open($storagelocation.'tester.db');
$result=sqlite_query("select * from names");
while($row=sqlite_fetch_array($result)) {
echo "<tr><td class='text'>".$row'first']."</td><td class='text'>".$row'last']."</td></tr>";
}
?>
</td>
</tr>
</table>
</body>
</html>
Now, in page 1, the database is created, but the table is not so consequently, page 2 reads nothing.
What am I missing? Help…Please!!!