[sqlite] REMOVE ME

2020-03-14 Thread Edmondo Borasio

___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Please unsubscribe me. Thanks

2018-07-12 Thread Edmondo Borasio

___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Selecting NEXT / PREVIOUS recurring item in a column

2017-08-06 Thread Edmondo Borasio
Hi Richard. Thanks for the suggestion. It makes lots of sense but
unfortunately I am unable to test it.. Completely out of the blue yesterday
I got this error message and OpenSuse is no longer starting on VirtualBox
(Mac). Really weird because I didn't make any changes...
In the previous days it started giving me a blank screen and freezing when
it was idle. I have updated Mac OS and VB but nothing.

No valid rapl domain found in package 0.

Failed to start journal service

Do you have any idea by any chance of what it could be?


Cheers


Edmondo


-- 
Dr Edmondo Borasio, MedC BQ Ophth, FEBO
Consultant Ophthalmologist
Specialised in Cornea, Cataract & Laser Refractive Surgery

Head of Corneal and Refractive Surgery Department
Burjeel Hospital
Abu Dhabi, UAE
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Selecting NEXT / PREVIOUS recurring item in a column

2017-08-06 Thread Edmondo Borasio
Hi Simon,

Yes, you are correct. The program should get me to the previous one which
is 2 or the next one which is 6.
It know it because I have previously manually selected that particular one.

Regards,

Edmondo
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Selecting NEXT / PREVIOUS recurring item in a column

2017-08-06 Thread Edmondo Borasio
*progr_no* *ID*
1 grace
*2* *john*
3 alan
4 tim
*5* *john*
*6* *john*
7 sandra
*8* *john*

What is the simplest and most efficient way of telling SQLITE to select the
NEXT or the PREVIOUS *progr_no *for a given recurring ID, let's say "john"?

Let's assume that I currently I am at progr_no=5.

I was thinking of maybe looping for a given ID and building an associative
array with also the progr_no, but there must be a more efficient and direct
solution, I guess!

Cheers

Ed
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] SQLITE PHP syntax issues - INSERT INTO db

2017-08-05 Thread Edmondo Borasio
$ID;
echo $ID; //This returns: *string(1) "5"*

$NewID = $ID + 1;
echo $NewID; //This returns: *6*

//If I input the $NewID manually as a string (for example '6', *it works
fine* and updates the db correctly)
*$query1="INSERT INTO
Table"."(ID,name,surname)"."VALUES('6','newName','newSurname');"; *

//However if I try to use the $NewID variable from above *it does't
work*

*$query1="INSERT INTO Table"."(ID,name,surname)"."VALUES(\' ' . $NewID .
'\','newName','newSurname');"; *

Any idea about the right syntax to use for $NewID, please?

Cheers

Edmondo
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] What is the exact syntax for SELECT MAX in PHP?

2017-08-05 Thread Edmondo Borasio
Bingo! Many thanks!

Hey, do you know where I can find good instructions on how to use SQLITE in
PHP?
I have searched a lot but haven't found much more than isolated questions
from different users on some forum...

Regards

Edmondo

Dr Edmondo Borasio, MedC BQ Ophth, FEBO
Consultant Ophthalmologist
Specialised in Cornea, Cataract & Laser Refractive Surgery

Head of Corneal and Refractive Surgery Department
Burjeel Hospital
Abu Dhabi, UAE

On 5 August 2017 at 13:29, Tim Streater <t...@clothears.org.uk> wrote:

> On 5 Aug 2017, at 9:35, Edmondo Borasio <edmondobora...@gmail.com> wrote:
>
> > $results = $db->query("SELECT MAX(ID) FROM Table")->fetchArray();
> > $Highest_ID = $results['ID'];
> > var_dump($Highest_ID);
> >
> > I get NULL
>
> Try:
>
> $results = $db->query("SELECT MAX(ID) as mx FROM Table")->fetchArray();
>  $Highest_ID = $results['mx'];
>  var_dump($Highest_ID);
>
>
>
>
> --
> Cheers  --  Tim
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] What is the exact syntax for SELECT MAX in PHP?

2017-08-05 Thread Edmondo Borasio
$results = $db->query("SELECT MAX(ID) FROM Table")->fetchArray();
$Highest_ID = $results['ID'];
var_dump($Highest_ID);

I get NULL

Cheers

Ed
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] UPDATE database using parameters

2017-07-21 Thread Edmondo Borasio
Hi Tim.

It *almost* works..

$DbItemNameTest = "new name";
$hIdTest = "1";

$db->exec ('UPDATE Anagrafica SET name = \'' . $DbItemNameTest .
'\' WHERE hospital_ID="1"'); //IT WORKS
   $db->exec ('UPDATE Anagrafica SET name = \'' . $DbItemNameTest . '\'
WHERE hospital_ID=' . $hIdTest); //IT DOESN'T WORK

The second one doesn't work even if I change hIdTest to integer.

$hIdTest = 1;

Any suggestions pls?

Cheers



On 21 July 2017 at 12:35, Tim Streater <t...@clothears.org.uk> wrote:

> On 21 Jul 2017 at 07:33, Edmondo Borasio <edmondobora...@gmail.com> wrote:
>
> > I am updating a record of a SQLite database as follows:
> >
> > $db->exec('UPDATE Movies SET name = "new movie" WHERE ID="4"');
> >
> > but instead of using name and ID I want to use some variables,
> $NewItemName
> > and $hId.
> >
> > Entering the variables as they are won't work. Neither using escape
> > characters like \"$DbItemName\" and \"$hId\".
>
> It would help if you said what language you are using.
>
> In PHP, one could do this:
>
>   $db->exec ('UPDATE Movies SET name = \'' . $DbItemName . '\' WHERE ID='
> . $hId);
>
> or perhaps:
>
>   $db->exec ("UPDATE Movies SET name = '$DbItemName' WHERE ID=$hId");
>
>
> --
> Cheers  --  Tim
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] UPDATE database using parameters

2017-07-21 Thread Edmondo Borasio
Hi and thanks for your email.

I am using PHP with SQLite on an Apache server.
That statement was taken from some advice I got from a forum.  I wasn't
aware it was MySQL.
I am new to SQLite and this is my first database.

*"Table/column names cannot use parameters.  You have to put it directly*
*into the string:"*

I guess however there must be a way, because for example with SELECT it
works.
The query below works perfectly using variables:

$results = $db->query("SELECT \"$DbItemName\" FROM Anagrafica WHERE
hID=\"$hId\"")->fetchArray();

Cheers

Edmondo


On Fri, 21 Jul 2017 at 12:24, Clemens Ladisch <clem...@ladisch.de> wrote:

> Edmondo Borasio wrote:
> > $stmt->bind_param($p_name,$bind_value);
>
> This looks like PHP's MySQL driver.  Which DB are you actually using?
>
> Anyway, I recommend you start with the examples from the manual, e.g.,
> <http://php.net/manual/en/sqlite3stmt.bindvalue.php>:
>
>   $stmt = $db->prepare('SELECT bar FROM foo WHERE id=:id');
>   $stmt->bindValue(':id', 1, SQLITE3_INTEGER);
>   $result = $stmt->execute();
>
> > I would also need to take the parameter "name" of "SET name" from a
> variable
>
> Table/column names cannot use parameters.  You have to put it directly
> into the string:
>
>   $sql = "UPDATE Anagrafica SET ".$col." = ..."
>
>
> Regards,
> Clemens
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] UPDATE database using parameters

2017-07-21 Thread Edmondo Borasio
Hi Thanks but it doesn't work.

It's weird because the following works:

$db->exec('UPDATE Anagrafica SET name = "new name" WHERE hID="1"');
//WORKS

But this doesn't:

$p_name ="new name";
$bind_value = "1";
$stmt = $conn->prepare('UPDATE Anagrafica SET name=? WHERE hID=?');
$stmt->bind_param($p_name,$bind_value);
$stmt->exec();

To make things more complex, once this is working, then I would also need
to take the parameter "name" of "SET name" from a variable..

Thanks

On 21 July 2017 at 10:45, <no...@null.net> wrote:

> On Fri Jul 21, 2017 at 06:33:55AM +, Edmondo Borasio wrote:
> > I am updating a record of a SQLite database as follows:
> >
> > $db->exec('UPDATE Movies SET name = "new movie" WHERE ID="4"');
> >
> > but instead of using name and ID I want to use some variables,
> $NewItemName
> >  and $hId.
> >
> > Entering the variables as they are won't work. Neither using escape
> > characters like \"$DbItemName\" and \"$hId\".
> >
> > Any idea of the right syntax pls?
>
> It appears that you are using something like Perl or Ruby to access
> your database?  If that is the case, then you will find that the
> concept of "placeholders" is what you are looking for.
>
> Typically you specify a "?" (without the quotes) where you want your
> variables to be, and then "bind" the variables to those positions
> either before or during the exec call.
>
> Here is the Perl documentation on that topic:
>
> https://metacpan.org/pod/DBI#Placeholders-and-Bind-Values
>
> I suggest you look up the equivalent in whatever language you are
> using.
>
> --
> Mark Lawrence
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users