Posts Topics Forums Images
Search videos from message boards Videos Search messages from microblogs Microblogs Search messages from imdb.com Imdb Search messages from yuku.com Yuku Search messages from lefora.com (free forums) Lefora
My account: Login | Sign Up
Loading... 

Thread: empty data in databsae when add it

Started 1 month, 2 weeks ago by Abdulaziiz
hello i wrote method that get the array variable and record it in the database this is the code PHP Code: $db -> connect (); $category = new Category (); $data =array(); $data [ 'name' ] = $_POST [ 'name' ]; $data [ 'desc' ] = $_POST [ 'desc' ]; $data [ 'parentid' ] = $_POST [ 'parentid' ]; $result = $...
Site: PHPBuilder.com  PHPBuilder.com - site profile
Forum: Coding  Coding - forum profile
Total authors: 3 authors
Total thread posts: 4 posts
Thread activity: no new posts during last week
Domain info for: phpbuilder.com

Other posts in this thread:

NogDog replied 1 month, 2 weeks ago
I'd start by verifying that the $data array has the expected values (var_dump(), perhaps). If not, then work backwards from there to figure out why. If $data looks OK, then we'll probably have to see the query_insert() method.

Abdulaziiz replied 1 month, 2 weeks ago
PHP Code: function query_insert ( $table , $data ) { $q = "INSERT INTO `" . $this -> pre . $table . "` " ; $v = '' ; $n = '' ; foreach( $data as $key => $val ) { $n .= "`$key`, " ; if( strtolower ( $val )== 'null' ) $v .= "NULL, " ; elseif( strtolower ( $val )== 'now()...

Weedpacket replied 1 month, 2 weeks ago
And does $data look okay?

 

Top contributing authors

Name
Posts
Weedpacket
2
user's latest post:
empty data in databsae when add it
Published (2009-11-11 08:25:00)
And does $data look okay?
Abdulaziiz
2
user's latest post:
empty data in databsae when add it
Published (2009-11-11 06:43:00)
PHP Code: function query_insert ( $table , $data ) {      $q = "INSERT INTO `" . $this -> pre . $table . "` " ;      $v = '' ; $n = '' ;     foreach( $data as $key => $val ) {          $n .= "`$key`, "...
NogDog
1
user's latest post:
empty data in databsae when add it
Published (2009-11-09 09:07:00)
I'd start by verifying that the $data array has the expected values (var_dump(), perhaps). If not, then work backwards from there to figure out why. If $data looks OK, then we'll probably have to see the query_insert() method.

Related threads on "PHPBuilder.com":

Related threads on other sites:

Thread profile page for "empty data in databsae when add it" on http://www.phpbuilder.com. This report page is a snippet summary view from a single thread "empty data in databsae when add it", located on the Message Board at http://www.phpbuilder.com. This thread profile page shows the thread statistics for: Total Authors, Total Thread Posts, and Thread Activity