dmiric
Posts: 3
|
| Posted: 05/09/2008, 7:10 AM |
|
Hey all,
I have a problem with selecting rows from database with CCS 4 / PHP / MySQL
heres my code;
$DjeloviConn = New clsDBstrojevi();
$SQL = "SELECT * FROM djelovi";
$DjeloviConn->query($SQL);
print_r ($DjeloviConn);
$DjeloviConn->close();
you noticed print_r there I just use it for debbuging and heres what it returns
clsDBstrojevi Object
(
[DateFormat] => Array
(
[0] => yyyy
[1] => -
[2] => mm
[3] => -
[4] => dd
[5] =>
[6] => HH
[7] => :
[8] => nn
[9] => :
[10] => ss
)
[BooleanFormat] => Array
(
[0] => true
[1] => false
[2] =>
)
[LastSQL] => SELECT * FROM djelovi
[Errors] => clsErrors Object
(
[Errors] => Array
(
)
[ErrorsCount] => 0
[ErrorDelimiter] => <br>
)
[RecordsCount] => 0
[RecordNumber] => 0
[PageSize] => 0
[AbsolutePage] => 0
[SQL] =>
[Where] =>
[Order] =>
[Parameters] =>
[wp] =>
[NextRecord] => Array
(
)
[Provider] => DB_MySQL Object
(
[DBHost] => localhost
[DBPort] =>
[DBDatabase] => strojevi
[DBUser] => root
[DBPassword] => xxxxxx
[Persistent] =>
[Auto_Free] => 1
[Debug] => 0
[Seq_Table] => db_sequence
[Record] => Array
(
)
[Row] => 0
[Errno] => 0
[Error] =>
[type] => mysql
[revision] => 1.2
[Link_ID] => Resource id #22
[Query_ID] => Resource id #23
[Connected] => 1
[Encoding] => Array
(
[0] =>
[1] => utf8
)
[Uppercase] =>
[Errors] => clsErrors Object
(
[Errors] => Array
(
)
[ErrorsCount] => 0
[ErrorDelimiter] => <br>
)
)
[Link_ID] => Resource id #22
[Query_ID] => Resource id #23
[DBHost] => localhost
[DBPort] =>
[DBDatabase] => strojevi
[DBUser] => root
[DBPassword] => xxxxx
[Persistent] =>
[Auto_Free] =>
[Debug] =>
[Record] => Array
(
)
[Row] =>
[Errno] =>
[Error] =>
[DateLeftDelimiter] => '
[DateRightDelimiter] => '
[Uppercase] =>
[DB] => MySQL
[Type] => MySQL
)
There are many results in database for this query when i run it phpmyadmin or elsewhere it works just fine and returns what I need. Also as you can see in object print you can see there is a connection set and everything . I just cant see why this wont work its so simple it hurts and still I cant make it work. 
Please help
|
 |
 |
wkempees
Posts: 1679
|
| Posted: 05/09/2008, 9:38 AM |
|
Where is this code located, which event?
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
wkempees
Posts: 1679
|
| Posted: 05/09/2008, 9:49 AM |
|
I do not know what you are trying to acheive or why, but
$DjeloviConn = New clsDBstrojevi();
$SQL = "SELECT * FROM djelovi";
$DjeloviConn->query($SQL);
$DjeloviConn->next_record(); // <--- added
print_r ($DjeloviConn);
$DjeloviConn->close();
will pick up first row from result set.
tested.
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
wkempees
Posts: 1679
|
| Posted: 05/09/2008, 9:53 AM |
|
..........
[Persistent] =>
[Auto_Free] => 1
[Debug] => 0
[Seq_Table] => db_sequence
[Record] => Array ( [0] => 1 [country_id] => 1 [1] => Afghanistan [country_name] => Afghanistan ) [Row] => 1
[Errno] => 0
[Error] =>
[type] => mysql
[revision] => 1.2
[Link_ID] => Resource id #12
[Query_ID] => Resource id #15
[Connected] => 1
[Encoding] => [Uppercase] => [Errors] => clsErrors Object ( [Errors] => Array ( ) [ErrorsCount] => 0 [ErrorDelimiter] =>
) ) [Link_ID] => Resource id #12 [Query_ID] => Resource id #15 [DBHost] => localhost [DBPort] => [DBDatabase] => internet [DBUser] => root [DBPassword] => daotec [Persistent] => [Auto_Free] => [Debug] => [Record] => Array ( [0] => 1 [country_id] => 1 [1] => Afghanistan [country_name] => Afghanistan ) [Row] => [Errno] => [Error] => [DateLeftDelimiter] => ' [DateRightDelimiter] => ' [Uppercase] => [DB] => MySQL [Type] => MySQL )
As result of (parts removed) obtained from
$db = New clsDBInternetDB();
$SQL = "SELECT * FROM countries";
$db->query($SQL);
$db->next_record();
print_r ($db);
$db->close();
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
dmiric
Posts: 3
|
| Posted: 05/09/2008, 10:03 AM |
|
yeah you are right i was missing next_record sorry for a dumb question :)
|
 |
 |
wkempees
Posts: 1679
|
| Posted: 05/09/2008, 10:22 AM |
|
No problem, we all do them....... 
change the topic to [Resolved] please`
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
|