does anyone know how to manually read from the ys script database

paypal1352

New Member
YetiShare User
Wurlie User
Mar 2, 2012
297
2
0
does anyone know how to manually read from the ys script database

im trying to include something on a page that requires reading directly from the user table,

i tried first declaring $db = Database::getDatabase();
but that didnt work,

any other way i can think of would be vulnerable and a security risk
 

paypal1352

New Member
YetiShare User
Wurlie User
Mar 2, 2012
297
2
0
tried this but it doesnt seem to like the $row = $db->getRow('YOUR QUERY HERE');
line, and gives an error 500
 

paypal1352

New Member
YetiShare User
Wurlie User
Mar 2, 2012
297
2
0
when i put the query in " instead ' it works but the when i echo row i get Array, i'm only trying to get 1 cell not a whole row though
 

paypal1352

New Member
YetiShare User
Wurlie User
Mar 2, 2012
297
2
0
and when i tried $db->query it echos blank, however i verified in phpmyadmin that its a valid query so it should work
 

paypal1352

New Member
YetiShare User
Wurlie User
Mar 2, 2012
297
2
0
nevermind was looking though the yscode and found $db->getValue and that works, thanks for your help
 

enricodias4654

Member
YetiShare User
Jan 13, 2015
411
1
16
Error 500 is probably a syntax error in your code.

getRows will return an array with many rows. You can access each row using a while or a foreach.
getRow (without the s) will return only one row, but still an array.

$row = $db->getRow('select field1, field2 from table');
echo $row['field1'];
echo $row['field2'];
 

paypal1352

New Member
YetiShare User
Wurlie User
Mar 2, 2012
297
2
0
nice that works perfectly as well, definitely better than getvalue if one intends to do multiple queries within a row, might as well get the array n fetch from it versus multiple db lookups.

thanks