Read a row on the server-side
Read a row on the server-side
obrienj
Posts: 93Questions: 38Answers: 0
Assuming:
DB: $editor->db()
Table: "table1"
Where: "id = '54'"
What is the PHP code using datatalbes facilities to read that row into an key-value array?
Regards,
Jim
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi Jim,
Document for it is available here.
Allan
Allan,
Sorry, I didn't know that documentation was there.
Can I assume that if I write:
that the data will be in $rowdata at completion?
Sorry to ask such a basic question but I get on a 13 hour plane ride in about an hour with no internet to access "stuff".
Again, thanks for all the support.
Regards,
Jim
Allan,
Just curious, what is the SQL operator "=>" that you used in "'id' => 54"?
I can't find it documented anywhere but if I use "=" instead the select fails.
Regards,
Jim
It isn't an SQL operator - its a PHP array assignment. In Javascript it would be
{ id: 54 }
.Yes - that will contain an array of the row(s) selected.
print_r( $rowdata );
to see its structure.Alan
Allan,
I am convinced that PHP will drive me to drink!
This is what I have: (Note: $log is a logging class I have built)
And the log contains: (Note: 'id' is a valid column and the value is also valid as well as the "calendar.events". I see no errors in the Web Console or network traffic.)
If I remove the "select", the function runs to the end and exits as written.
Be patient with me, but what is going on?
Regards,
Jim
Try
Thanks tangerine, that did it.
And PHP has driven me to drink!!
I'm sitting in the bar at a Hilton mumbling to myself and drinking iced tea.
I didn't know that after 50 year doing this coputer stuff that learning a new programming language (my 25th by last count) could be so much fun!?!?!
Regards,
Jim
Long Island iced tea...
Many people start on PHP so things only get better ;-)
In fairness to PHP, it really is quite good these days. You just need to get used to some of its quirks. I enjoy writing in PHP (albeit not as much as some other languages...).
Allan