PHP Builder Forum IndexPHP Builder
free solutions for web developers
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in            Calendar



COMPUSORY UPGRADE!!! Request an upgrade NOW! 32+ Pre-installed Modifications! 3 Server Locations to choose from: USA, UK and JAPAN.

11th December 2012 - phpBB88: All servers are upgraded to run using SSD drive. Click Here to report problems!

Trouble Connecting To MySQL Database

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PHP Builder Forum Index -> PHP DataGrid {bugs}
View previous topic :: View next topic  
Author Message
accetturo
Newbie
Newbie


Joined: 15 Sep 2008
Posts: 3
:


Items

PostPosted: Mon Sep 15, 2008 10:37 pm    Post subject: Trouble Connecting To MySQL Database Reply with quote

I have been having alot of issues linking with a mysql database, mostly due to my inexperience with Raw editing of MySQL and your script. I took the sample script and loaded the demo SQL data into the database, and the sample worked great. I then created a new table called posystem and added several columns, PO_Number being the primary(tinyint(3)) and added all varchar(100). I replaced the text from the sample with the new table info and columns, and it didnt work as expected.

Errors Received


Code:

search sql (total: 0) SELECT countries.PO_Number, countries.name, countries.description, FROM countries WHERE 1=1 ORDER BY name ASC LIMIT 0, 10

search sql (total: 0) SELECT countries.PO_Number, countries.name, countries.description, FROM countries WHERE 1=1 ORDER BY name ASC LIMIT 0, 10

Errors:

1) SELECT countries.PO_Number, countries.name, countries.description, FROM countries WHERE 1=1 ORDER BY name ASC LIMIT 0, 10
[nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM countries WHERE 1=1 ORDER BY name ASC LIMIT 0, 10' at line 1]

2) SELECT countries.PO_Number, countries.name, countries.description, FROM countries WHERE 1=1 ORDER BY name ASC LIMIT 0, 10
[nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM countries WHERE 1=1 ORDER BY name ASC LIMIT 0, 10' at line 1]

3) SELECT countries.PO_Number, countries.name, countries.description, FROM countries WHERE 1=1 ORDER BY name ASC LIMIT 0, 10
[nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM countries WHERE 1=1 ORDER BY name ASC LIMIT 0, 10' at line 1]

4) SELECT countries.PO_Number, countries.name, countries.description, FROM countries WHERE 1=1 ORDER BY name ASC LIMIT 0, 10
[nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM countries WHERE 1=1 ORDER BY name ASC LIMIT 0, 10' at line 1]


Warnings:

1) Wrong parameter in [SELECT]: Check this field carefully, it may be not a Primary Key!

POST: Array ( )

GET: Array ( )


Notice: Undefined property: DataGrid::$columns_view_mode in /x/x/x/x/x/datagrid/datagrid.class.php on line 3189

Warning: Invalid argument supplied for foreach() in /x/x/x/x/x/datagrid/datagrid.class.php on line 3189



Notice: Undefined property: DataGrid::$columns_view_mode in /x/x/x/xx/x/datagrid/datagrid.class.php on line 2344

Warning: Invalid argument supplied for foreach() in /x/x/x/x/x/datagrid/datagrid.class.php on line 2344


NOTE WILDCARDS*/X WERE ADDED

Here is the sample im using


Code:

<php>
################################################################################   
## +---------------------------------------------------------------------------+
## | 1. Creating & Calling:                                                    |
## +---------------------------------------------------------------------------+
##  *** only relative (virtual) path (to the current document)
  define ("DATAGRID_DIR", "datagrid/");
  define ("PEAR_DIR", "datagrid/pear/");
 
  require_once(DATAGRID_DIR.'datagrid.class.php');
  require_once(PEAR_DIR.'PEAR.php');
  require_once(PEAR_DIR.'DB.php');

##  *** creating variables that we need for database connection
  $DB_USER='*';            /* usually like this: prefix_name             */
  $DB_PASS='*';                /* must be already enscrypted (recommended)   */
  $DB_HOST='*';       /* usually localhost                          */
  $DB_NAME='*';          /* usually like this: prefix_dbName           */

ob_start();
  $db_conn = DB::factory('mysql');
  $db_conn -> connect(DB::parseDSN('mysql://'.$DB_USER.':'.$DB_PASS.'@'.$DB_HOST.'/'.$DB_NAME));

 

##  *** put a primary key on the first place
  $sql=" SELECT " 
   ."posystem.PO_Number, "
   ."posystem.Date, "
   ."posystem.Use_Code, "
   ."posystem.Originator, "
   ."posystem.Description, "
   ."posystem.Est_Cost, "
   ."posystem.Contact, "
   ."posystem.Signed_Off_By, "
   ."FROM posystem ";
   
##  *** set needed options
  $debug_mode = false;
  $messaging = true;
  $unique_prefix = "f_"; 
  $dgrid = new DataGrid($debug_mode, $messaging, $unique_prefix, DATAGRID_DIR);
##  *** set data source with needed options
  $default_order_field = "PO_Number";
  $default_order_type = "ASC";
  $dgrid->dataSource($db_conn, $sql, $default_order_field, $default_order_type);      

## +---------------------------------------------------------------------------+
## | 6. View Mode Settings:                                                    |
## +---------------------------------------------------------------------------+
##  *** set columns in view mode
   $dgrid->setAutoColumnsInViewMode(true); 

## +---------------------------------------------------------------------------+
## | 7. Add/Edit/Details Mode settings:                                        |
## +---------------------------------------------------------------------------+
##  ***  set settings for edit/details mode
  $table_name = "posystem";
  $primary_key = "PO_Number";
  $condition = "";
  $dgrid->setTableEdit($table_name, $primary_key, $condition);
  $dgrid->setAutoColumnsInEditMode(true);
 
## +---------------------------------------------------------------------------+
## | 8. Bind the DataGrid:                                                     |
## +---------------------------------------------------------------------------+
##  *** set debug mode & messaging options
    $dgrid->bind();       
    ob_end_flush();
####################################################



Again, Wildcards were added

Server is updated with all the standards, and has been tested on samples to show it works.


Last edited by accetturo on Mon Sep 15, 2008 11:07 pm; edited 3 times in total
Back to top
View user's profile Send private message
zewa666
Site Moderator
Site Moderator


Joined: 01 Feb 2007
Posts: 606
:


Items

PostPosted: Tue Sep 16, 2008 5:32 am    Post subject: Reply with quote

mmhm

try to make the Primary key integer not tinyint.


greetings
Zewa
Back to top
View user's profile Send private message Send e-mail Visit poster's website
accetturo
Newbie
Newbie


Joined: 15 Sep 2008
Posts: 3
:


Items

PostPosted: Tue Sep 16, 2008 2:10 pm    Post subject: Reply with quote

Would it be possible for someone to help me setup my database
Back to top
View user's profile Send private message
egrafeuille
Newbie
Newbie


Joined: 19 Sep 2008
Posts: 2
:
Location: Argentina

Items

PostPosted: Fri Sep 19, 2008 7:07 pm    Post subject: Reply with quote

I think the problem is the comma before the FROM clause! Very Happy
Regards
Back to top
View user's profile Send private message
     
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PHP Builder Forum Index -> PHP DataGrid {bugs} All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
PHP Builder topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group

FREE FORUM HOSTING by AtFreeForum. Terms of Service - Privacy Policy
FASHION ACCESSORIES - BLING BLING - LADIES WATCHES - KOREAN CHILDREN CLOTHING - ONLINE BARGAIN STORE - FASHION JEWELLERIES